Skip to content

Add Google Agent SDK Support #1639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

HendricksJudy
Copy link
Contributor

@HendricksJudy HendricksJudy commented May 24, 2025

解决了 #XYZ

Motivation

This pull request introduces support for the Google Agent SDK in AstrBot, enabling integration with Google's agent-based functionalities. The changes include updates to documentation, configuration, provider management, and the addition of a new provider adapter for the SDK.

Modifications

Documentation Updates:

  • Updated README.md and README_en.md to include the Google Agent SDK in the list of supported providers, along with a link to its documentation. [1] [2] [3]

Configuration Enhancements:

  • Added a new configuration entry for the Google Agent SDK in astrbot/core/config/default.py, specifying its default settings such as model type, timeout, and API key support.

Provider Management:

  • Updated astrbot/core/provider/manager.py to handle the new google_agent_sdk provider type, including its initialization logic.

New Provider Adapter:

  • Introduced ProviderGoogleAgentSDK in astrbot/core/provider/sources/google_agent_sdk_source.py, which integrates with the Google Agent SDK for chat completions. This includes methods for initialization, API key management, and chat interactions.

Dependency Addition:

  • Added google-agents>=0.1.0 to pyproject.toml as a new dependency to support the Google Agent SDK integration.

Check

  • [ Y] 😊 我的 Commit Message 符合良好的规范
  • [ Y] 👀 我的更改经过良好的测试
  • [ Y] 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。
  • [Y ] 😮 我的更改没有引入恶意代码

好的,这是翻译成中文的 pull request 总结:

Sourcery 总结

添加对 Google Agent SDK 的支持,通过引入一个新的 provider adapter,更新配置和 provider 加载逻辑,更新文档,并添加所需的依赖项。

新特性:

  • 引入 ProviderGoogleAgentSDK 以支持通过 Google Agent SDK 进行聊天补全。

增强:

  • 在核心配置中为 Google Agent SDK 添加默认配置条目。
  • 更新 provider 管理器以加载 Google Agent SDK provider 类型。

构建:

  • pyproject.toml 中添加 google-agents>=0.1.0 依赖项

文档:

  • READMEREADME_en 中包含 Google Agent SDK,并附带文档链接。
Original summary in English

Summary by Sourcery

Add support for the Google Agent SDK by introducing a new provider adapter, updating configuration and provider loading logic, updating documentation, and adding the required dependency.

New Features:

  • Introduce ProviderGoogleAgentSDK to enable chat completions via Google Agent SDK.

Enhancements:

  • Add default configuration entry for Google Agent SDK in core config.
  • Update provider manager to load the Google Agent SDK provider type.

Build:

  • Add google-agents>=0.1.0 dependency in pyproject.toml

Documentation:

  • Include Google Agent SDK in README and README_en with documentation link.

Copy link
Contributor

sourcery-ai bot commented May 24, 2025

## Reviewer's Guide (审查指南)

This PR integrates support for the Google Agent SDK by adding its configuration, registering and implementing a new provider adapter, updating documentation to reflect the new provider, and including the necessary dependency.

此 PR 集成了对 Google Agent SDK 的支持,通过添加其配置、注册和实现新的 provider adapter、更新文档以反映新的 provider,以及包含必要的依赖项。

#### Sequence Diagram: Chat Processing with Google Agent SDK (序列图:使用 Google Agent SDK 的聊天处理)

```mermaid
sequenceDiagram
    actor User
    participant AstrBotCore as "AstrBot Core"
    participant PGoogleAgentSDK as "ProviderGoogleAgentSDK"
    participant GoogleAgentSvc as "Google Agent SDK (External Service)"

    User->>AstrBotCore: Sends chat prompt
    AstrBotCore->>PGoogleAgentSDK: text_chat(prompt, history, ...)
    PGoogleAgentSDK->>GoogleAgentSvc: agent.chat(prompt, history)
    GoogleAgentSvc-->>PGoogleAgentSDK: Receives agent_response
    PGoogleAgentSDK->>AstrBotCore: Returns LLMResponse (with agent_response)
    AstrBotCore-->>User: Delivers final response

File-Level Changes (文件级别更改)

Change (更改) Details (详情) Files (文件)
Documentation updated to include Google Agent SDK as a supported provider (文档已更新,以包含 Google Agent SDK 作为受支持的 provider)
  • Added Google Agent SDK entry and link in Chinese README (在中文 README 中添加了 Google Agent SDK 条目和链接)
  • Inserted Google Agent SDK row in supported providers table (在受支持的 provider 表中插入了 Google Agent SDK 行)
  • Added Google Agent SDK entry and link in English README (在英文 README 中添加了 Google Agent SDK 条目和链接)
README.md
README_en.md
Added default configuration for Google Agent SDK (添加了 Google Agent SDK 的默认配置)
  • Defined a new config entry with id, type, provider_type, enable flag, key list, timeout, and model_config (定义了一个新的配置条目,包含 id、type、provider_type、enable flag、key list、timeout 和 model_config)
  • Placed the entry alongside existing providers in default settings (将该条目与默认设置中现有的 provider 放在一起)
astrbot/core/config/default.py
Registered the new provider type in the provider manager (在 provider manager 中注册了新的 provider 类型)
  • Added a case branch for "google_agent_sdk" (为 "google_agent_sdk" 添加了一个 case 分支)
  • Imported ProviderGoogleAgentSDK within the load_provider function (在 load_provider 函数中导入了 ProviderGoogleAgentSDK)
astrbot/core/provider/manager.py
Implemented the ProviderGoogleAgentSDK adapter integrating with the Google Agent SDK (实现了与 Google Agent SDK 集成的 ProviderGoogleAgentSDK adapter)
  • Initialized Agent instance with API key and model (使用 API key 和 model 初始化了 Agent 实例)
  • Handled optional dependency and key management (处理了可选的依赖项和 key 管理)
  • Defined text_chat and text_chat_stream methods with error handling and result wrapping (定义了 text_chat 和 text_chat_stream 方法,包含错误处理和结果包装)
astrbot/core/provider/sources/google_agent_sdk_source.py
Added the Google Agent SDK dependency (添加了 Google Agent SDK 依赖项)
  • Included "google-agents>=0.1.0" in the project dependencies (在项目依赖项中包含了 "google-agents>=0.1.0")
pyproject.toml

Tips and commands (提示和命令)

Interacting with Sourcery (与 Sourcery 交互)

  • Trigger a new review: Comment @sourcery-ai review on the pull request. (触发新的审查: 在 pull request 上评论 @sourcery-ai review。)
  • Continue discussions: Reply directly to Sourcery's review comments. ( 继续讨论: 直接回复 Sourcery 的审查评论。)
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it. ( 从审查评论生成 GitHub issue: 通过回复审查评论,要求 Sourcery 从审查评论创建一个 issue。您也可以回复审查评论并使用 @sourcery-ai issue 从中创建一个 issue。)
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time. ( 生成 pull request 标题: 在 pull request 标题中的任何位置写入 @sourcery-ai 以随时生成标题。您也可以在 pull request 上评论 @sourcery-ai title 以随时(重新)生成标题。)
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time. ( 生成 pull request 摘要: 在 pull request 正文中的任何位置写入 @sourcery-ai summary 以随时在您想要的位置生成 PR 摘要。您也可以在 pull request 上评论 @sourcery-ai summary 以随时(重新)生成摘要。)
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time. ( 生成审查指南: 在 pull request 上评论 @sourcery-ai guide 以随时(重新)生成审查指南。)
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore. ( 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经解决了所有评论并且不想再看到它们,这将非常有用。)
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review! ( 忽略所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss 以忽略所有现有的 Sourcery 审查。如果您想从新的审查开始,这将特别有用 - 不要忘记评论 @sourcery-ai review 以触发新的审查!)

Customizing Your Experience (自定义您的体验)

Access your dashboard to: (访问您的 dashboard 以:)

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others. (启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查指南等。)
  • Change the review language. (更改审查语言。)
  • Add, remove or edit custom review instructions. (添加、删除或编辑自定义审查说明。)
  • Adjust other review settings. (调整其他审查设置。)

Getting Help (获取帮助)

```
Original review guide in English

Reviewer's Guide

This PR integrates support for the Google Agent SDK by adding its configuration, registering and implementing a new provider adapter, updating documentation to reflect the new provider, and including the necessary dependency.

Sequence Diagram: Chat Processing with Google Agent SDK

sequenceDiagram
    actor User
    participant AstrBotCore as "AstrBot Core"
    participant PGoogleAgentSDK as "ProviderGoogleAgentSDK"
    participant GoogleAgentSvc as "Google Agent SDK (External Service)"

    User->>AstrBotCore: Sends chat prompt
    AstrBotCore->>PGoogleAgentSDK: text_chat(prompt, history, ...)
    PGoogleAgentSDK->>GoogleAgentSvc: agent.chat(prompt, history)
    GoogleAgentSvc-->>PGoogleAgentSDK: Receives agent_response
    PGoogleAgentSDK->>AstrBotCore: Returns LLMResponse (with agent_response)
    AstrBotCore-->>User: Delivers final response
Loading

File-Level Changes

Change Details Files
Documentation updated to include Google Agent SDK as a supported provider
  • Added Google Agent SDK entry and link in Chinese README
  • Inserted Google Agent SDK row in supported providers table
  • Added Google Agent SDK entry and link in English README
README.md
README_en.md
Added default configuration for Google Agent SDK
  • Defined a new config entry with id, type, provider_type, enable flag, key list, timeout, and model_config
  • Placed the entry alongside existing providers in default settings
astrbot/core/config/default.py
Registered the new provider type in the provider manager
  • Added a case branch for "google_agent_sdk"
  • Imported ProviderGoogleAgentSDK within the load_provider function
astrbot/core/provider/manager.py
Implemented the ProviderGoogleAgentSDK adapter integrating with the Google Agent SDK
  • Initialized Agent instance with API key and model
  • Handled optional dependency and key management
  • Defined text_chat and text_chat_stream methods with error handling and result wrapping
astrbot/core/provider/sources/google_agent_sdk_source.py
Added the Google Agent SDK dependency
  • Included "google-agents>=0.1.0" in the project dependencies
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HendricksJudy - 我已经审查了你的更改 - 这里有一些反馈:

  • 在 default.py 中,顶层键 "Google Agent SDK" 使用空格—考虑使用一致的 snake_case 键(例如 google_agent_sdk)来匹配其他提供程序并避免 YAML 解析问题。
  • 当前的 text_chat_stream 只是包装了非流式调用—如果 Google Agent SDK 提供了原生流式 API,那么最好使用它来实现真正的增量响应。
  • 提供程序初始化忽略了配置的超时—考虑将 provider_config 中的 timeout 传递到 Agent SDK 调用中,以便尊重用户定义的超时。
以下是我在审查期间查看的内容
  • 🟡 一般问题:发现 2 个问题
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源是免费的 - 如果您喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进您的评论。
Original comment in English

Hey @HendricksJudy - I've reviewed your changes - here's some feedback:

  • In default.py the top-level key "Google Agent SDK" uses spaces—consider using a consistent snake_case key (e.g. google_agent_sdk) to match other providers and avoid YAML parsing issues.
  • The current text_chat_stream just wraps the non-streaming call—if the Google Agent SDK offers a native streaming API, it’d be better to use that for true incremental responses.
  • The provider initialization ignores the configured timeout—consider passing the timeout from provider_config into the Agent SDK calls so user-defined timeouts are respected.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +88 to +93
history = contexts or []
if system_prompt:
history = [{"role": "system", "content": system_prompt}, *history]
# TODO: handle func_tool and tool_calls_result via ADK Tool API
try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议: 警告何时提供 func_tool 或 tool_calls_result

如果提供了 func_tool 或 tool_calls_result,请考虑添加警告或异常,因为它们目前被忽略。

Suggested change
history = contexts or []
if system_prompt:
history = [{"role": "system", "content": system_prompt}, *history]
# TODO: handle func_tool and tool_calls_result via ADK Tool API
try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]
history = contexts or []
if system_prompt:
history = [{"role": "system", "content": system_prompt}, *history]
# TODO: handle func_tool and tool_calls_result via ADK Tool API
if kwargs.get("func_tool") is not None:
logger.warning("func_tool is provided but currently ignored by google_agent_sdk provider")
if tool_calls_result is not None:
logger.warning("tool_calls_result is provided but currently ignored by google_agent_sdk provider")
try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]
Original comment in English

suggestion: Warn when func_tool or tool_calls_result is provided

Consider adding a warning or exception if func_tool or tool_calls_result is provided, since they are currently ignored.

Suggested change
history = contexts or []
if system_prompt:
history = [{"role": "system", "content": system_prompt}, *history]
# TODO: handle func_tool and tool_calls_result via ADK Tool API
try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]
history = contexts or []
if system_prompt:
history = [{"role": "system", "content": system_prompt}, *history]
# TODO: handle func_tool and tool_calls_result via ADK Tool API
if kwargs.get("func_tool") is not None:
logger.warning("func_tool is provided but currently ignored by google_agent_sdk provider")
if tool_calls_result is not None:
logger.warning("tool_calls_result is provided but currently ignored by google_agent_sdk provider")
try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]

tool_calls_result=tool_calls_result,
**kwargs,
)
yield llm_response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议: 实施真正的流式传输或调整方法命名

由于 text_chat_stream 一次性产生完整响应,请实施分块流式传输或更新方法名称/文档,以明确不支持实时流式传输。

建议的实施方式:

    async def text_chat_full_response(self, prompt, session_id=None, image_urls=None, func_tool=None, contexts=None, system_prompt=None, tool_calls_result=None, **kwargs):
        """
        一次性返回完整的 LLM 响应。此方法不提供实时或分块流式传输。
        """
        llm_response = await self.text_chat(
            prompt,
            session_id=session_id,
            image_urls=image_urls,
            func_tool=func_tool,
            contexts=contexts,
            system_prompt=system_prompt,
            tool_calls_result=tool_calls_result,
            **kwargs,
        )
        yield llm_response
  • 在整个代码库中,将所有 text_chat_stream 的用法更新为 text_chat_full_response
  • 如果您有引用 text_chat_stream 的文档,请更新它以明确新的方法名称及其非流式传输行为。
Original comment in English

suggestion: Implement true streaming or adjust method naming

Since text_chat_stream yields the full response at once, please either implement chunked streaming or update the method name/documentation to clarify that real-time streaming is not supported.

Suggested implementation:

    async def text_chat_full_response(self, prompt, session_id=None, image_urls=None, func_tool=None, contexts=None, system_prompt=None, tool_calls_result=None, **kwargs):
        """
        Returns the full LLM response at once. This method does not provide real-time or chunked streaming.
        """
        llm_response = await self.text_chat(
            prompt,
            session_id=session_id,
            image_urls=image_urls,
            func_tool=func_tool,
            contexts=contexts,
            system_prompt=system_prompt,
            tool_calls_result=tool_calls_result,
            **kwargs,
        )
        yield llm_response
  • Update all usages of text_chat_stream to text_chat_full_response throughout the codebase.
  • If you have documentation referencing text_chat_stream, update it to clarify the new method name and its non-streaming behavior.

try:
response = await self.agent.chat(prompt, history=history) # type: ignore[attr-defined]
except Exception as e: # pragma: no cover - runtime errors
raise Exception(f"Google Agent SDK error: {e}") from e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题(代码质量): 引发特定错误,而不是一般的 ExceptionBaseException (raise-specific-error)

解释如果一段代码引发特定异常类型,而不是通用的 [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) 或 [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),则调用代码可以:
  • 获取有关错误类型的更多信息
  • 为其定义特定的异常处理

这样,代码的调用者可以适当地处理错误。

您如何解决这个问题?

因此,与其让代码引发 ExceptionBaseException,例如

if incorrect_input(value):
    raise Exception("输入不正确")

您可以让代码引发特定错误,例如

if incorrect_input(value):
    raise ValueError("输入不正确")

或者

class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("输入不正确")
Original comment in English

issue (code-quality): Raise a specific error instead of the general Exception or BaseException (raise-specific-error)

ExplanationIf a piece of code raises a specific exception type rather than the generic [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception), the calling code can:
  • get more information about what type of error it is
  • define specific exception handling for it

This way, callers of the code can handle the error appropriately.

How can you solve this?

So instead of having code raising Exception or BaseException like

if incorrect_input(value):
    raise Exception("The input is incorrect")

you can have code raising a specific error like

if incorrect_input(value):
    raise ValueError("The input is incorrect")

or

class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")

Comment on lines +52 to +53
keys = provider_config.get("key", [])
if keys:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议(代码质量): 使用命名表达式来简化赋值和条件 (use-named-expression)

Suggested change
keys = provider_config.get("key", [])
if keys:
if keys := provider_config.get("key", []):
Original comment in English

suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

Suggested change
keys = provider_config.get("key", [])
if keys:
if keys := provider_config.get("key", []):

Comment on lines +113 to +122
llm_response = await self.text_chat(
prompt,
session_id=session_id,
image_urls=image_urls,
func_tool=func_tool,
contexts=contexts,
system_prompt=system_prompt,
tool_calls_result=tool_calls_result,
**kwargs,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题(代码质量): 内联立即产生的变量 (inline-immediately-yielded-variable)

Original comment in English

issue (code-quality): Inline variable that is immediately yielded (inline-immediately-yielded-variable)

@HendricksJudy
Copy link
Contributor Author

No. The current code already works, so the suggestions are optional improvements rather than requirements. For instance, the configuration file stores the provider entry as "Google Agent SDK" with spaces, which works fine since keys are quoted and other providers use spaces or non‑ASCII names.

The text_chat_stream method in the Google Agent provider forwards to text_chat and yields one result, so it isn't an accurate streaming implementation. This still delivers a response, just without incremental tokens.
Although the provider reads the API key and model configuration during initialization, it currently ignores the configured timeout value—it is not passed to the Agent constructor or used elsewhere.

Adopting the suggestions (e.g., snake_case keys, native streaming support, honoring timeout) would improve consistency and functionality, but the existing implementation runs without them. They are functional enhancements, not strict necessities.

@Soulter
Copy link
Member

Soulter commented May 27, 2025

Hi, thank you for your contribution to adapting the Google Chat and Google Agent SDK! Can you provide a short tutorial about the configuration of Google Chat?

@HendricksJudy
Copy link
Contributor Author

Hi, thank you for your contribution to adapting the Google Chat and Google Agent SDK! Can you provide a short tutorial about the configuration of Google Chat?

Basic Setup Steps
1. Enable the adapter
Set "enable": true for the google_chat platform in your configuration, and fill in:
• "webhook_url" – the URL of your Google Chat incoming webhook.
• "verification_token" – optional token to validate callbacks.
• "callback_server_host" and "port" – where AstrBot listens for Google Chat callbacks.
• "bot_name" – name shown in chats.
2. Run AstrBot
The adapter starts a Quart server on the specified host and port (default 0.0.0.0:6200). Google Chat sends events to /astrbot-googlechat/callback. Messages from AstrBot are sent to the configured webhook_url.
3. Configure Google Chat
In Google Chat, create a webhook for the target space and note the URL. If you use verification, configure the same token in both Google Chat and AstrBot so incoming requests are validated.

Once configured and running, AstrBot can receive messages from Google Chat spaces and send responses or images back to the webhook URL. This provides a basic integration using Google Chat’s HTTP webhook mechanism.

@Soulter
Copy link
Member

Soulter commented May 29, 2025

Thanks for your response!

I'm sorry but I haven't used Google Chat yet. Does it need a Google Workspace account?

And what's the difference between the Google Agent SDK and Google Gen AI SDK? It seems like Google Gen AI SDK can handle all the model(such as gemini) API interactions.

@HendricksJudy
Copy link
Contributor Author

Thanks for your response!

I'm sorry but I haven't used Google Chat yet. Does it need a Google Workspace account?

And what's the difference between the Google Agent SDK and Google Gen AI SDK? It seems like Google Gen AI SDK can handle all the model(such as gemini) API interactions.

The README also distinguishes them in the provider support table, labeling “Google Gemini API” under “Text Generation” and “Google Agent SDK” under “Agent SDK”:

Google GenAI SDK: For direct Gemini (text generation) calls—supports images, tool calls, and other model-specific options.

Google Agent SDK: Wraps an “Agent” that can orchestrate interactions (chat history, potential tools, etc.) before using underlying models like Gemini.

Thus, while the GenAI SDK handles raw model interactions, the Agent SDK provides a higher-level agent framework that relies on those models internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants