google-antigravity-sdk

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Google Antigravity SDK

Google Antigravity SDK

Installation & Setup

安装与设置

Before proceeding with any Google Antigravity tasks, ensure the environment is ready:
  • Verify Applicability: If operating in an existing codebase, verify that using this Python SDK is possible and appropriate for the project.
  • Check Dependencies: Check if
    google-antigravity
    is listed in the project's dependencies (e.g.,
    requirements.txt
    ,
    pyproject.toml
    ).
  • Install Package: Ensure the
    google-antigravity
    Python package is installed.
  • Authentication Setup: Check for a valid
    GEMINI_API_KEY
    environment variable or a
    .env
    file (required to access Gemini models).
    • If credentials are missing, you MUST actively help the user get set up with an API key by providing the following link:
      • Default to Google AI Studio:
        https://aistudio.google.com/app/api-keys
    • Explain that the API key can be passed explicitly in code as shorthand (e.g.,
      LocalAgentConfig(api_key="...")
      ) or automatically read from the environment.
在进行任何Google Antigravity相关任务前,请确保环境已准备就绪:
  • 适用性验证:如果在现有代码库中操作,请确认使用此Python SDK对项目而言是可行且合适的。
  • 依赖检查:检查项目依赖中是否已列出
    google-antigravity
    (例如
    requirements.txt
    pyproject.toml
    )。
  • 安装包:确保已安装
    google-antigravity
    Python包。
  • 认证设置:检查是否存在有效的
    GEMINI_API_KEY
    环境变量或
    .env
    文件(访问Gemini模型必需)。
    • 如果缺少凭证,必须主动帮助用户获取API密钥,提供以下链接:
      • 默认链接为Google AI Studio:
        https://aistudio.google.com/app/api-keys
    • 说明API密钥可在代码中显式传递(例如
      LocalAgentConfig(api_key="...")
      ),也可自动从环境变量中读取。

Routing Table

路由表

Use the following information to dig deeper into specific topics based on the user request. Read the referenced files or explore the directories to find relevant information.
根据用户需求,使用以下信息深入了解特定主题。阅读参考文件或探索目录以查找相关信息。

References

参考文档

  • If the user needs to understand the high-level overview and core concepts of the Google Antigravity SDK (Agent, Conversation, Connection), read
    references/architecture.md
    .
  • If the user needs to perform advanced agent configuration, select appropriate models, or understand the critical rules for model identifiers to avoid assumptions, read
    references/agent_configuration.md
    .
  • If the user needs to extend an agent's capabilities by integrating Model Context Protocol (MCP) servers, or configure tool permissions for the agent, read
    references/mcp_integration.md
    .
  • If the user needs to define safety policies, resolve execution order, or restrict agent actions using predicates, read
    references/safety_policies.md
    .
  • If the user needs to debug failed agents, stream logs, or implement error recovery using hooks to make agents robust, read
    references/error_handling.md
    .
  • If the user needs to monitor costs, track token usage (including thinking tokens), or build custom audit logs for advanced monitoring, read
    references/observability.md
    .
  • If the user needs to see a list of built-in tools and understand their default state, read
    references/built_in_tools.md
    .
  • 如果用户需要了解Google Antigravity SDK的高级概述和核心概念(Agent、Conversation、Connection),请阅读
    references/architecture.md
  • 如果用户需要执行高级Agent配置、选择合适的模型,或了解模型标识符的关键规则以避免错误假设,请阅读
    references/agent_configuration.md
  • 如果用户需要通过集成Model Context Protocol (MCP)服务器扩展Agent的能力,或配置Agent的工具权限,请阅读
    references/mcp_integration.md
  • 如果用户需要定义安全策略、解决执行顺序问题,或使用谓词限制Agent操作,请阅读
    references/safety_policies.md
  • 如果用户需要调试故障Agent、流式传输日志,或使用钩子实现错误恢复以提升Agent的健壮性,请阅读
    references/error_handling.md
  • 如果用户需要监控成本、跟踪令牌使用情况(包括思考令牌),或构建自定义审计日志以实现高级监控,请阅读
    references/observability.md
  • 如果用户需要查看内置工具列表并了解其默认状态,请阅读
    references/built_in_tools.md

Examples

示例

  • If the user needs to implement basic agent behavior, streaming responses, or expose internal thoughts, read
    examples/getting_started/hello_world.md
    .
  • If the user needs to equip an agent with custom capabilities (tools) derived from Python functions, or maintain agent state across tool execution, read
    examples/getting_started/custom_tool.md
    .
  • If the user needs to shape an agent's persona, define its system instructions, or dynamically adapt its behavior, read
    examples/getting_started/persona_config.md
    .
  • If the user needs to build multimodal agents capable of processing images and PDFs, or generating visual content, read
    examples/getting_started/multimodal.md
    .
  • If the user needs to implement multi-agent delegation, allowing a main agent to spawn and orchestrate subagents for complex tasks, read
    examples/getting_started/subagents.md
    .
  • If the user needs to connect an agent to external services via MCP (Stdio or SSE), read
    examples/getting_started/mcp_tools.md
    .
  • If the user needs to create proactive agents that respond to time-based events or file system triggers in the background, read
    examples/getting_started/periodic_trigger.md
    .
  • If the user needs to intercept agent lifecycle events (e.g., pre/post turn, tool execution, errors) to customize execution flow, read
    examples/getting_started/hooks.md
    .
  • If the user needs to implement persistent agents that remember past interactions across sessions, read
    examples/getting_started/persistence.md
    .
  • If the user needs to override the default application data directory for agent artifacts, scratch files, and media storage, read
    examples/getting_started/app_data_dir_override.md
    .
  • If the user needs an agent to output structured data (e.g., JSON matching a Pydantic schema) for reliable integration, read
    examples/getting_started/structured_output.md
    .
  • If the user needs to add, configure, or load agent skills into the Google Antigravity SDK agent, read
    examples/getting_started/agent_skills.md
    .
  • 如果用户需要实现基础Agent行为、流式响应或暴露内部思考过程,请阅读
    examples/getting_started/hello_world.md
  • 如果用户需要为Agent配备基于Python函数的自定义能力(工具),或在工具执行过程中维护Agent状态,请阅读
    examples/getting_started/custom_tool.md
  • 如果用户需要塑造Agent的角色、定义其系统指令,或动态调整其行为,请阅读
    examples/getting_started/persona_config.md
  • 如果用户需要构建能够处理图像和PDF或生成视觉内容的多模态Agent,请阅读
    examples/getting_started/multimodal.md
  • 如果用户需要实现多Agent委托,允许主Agent生成并编排子Agent以完成复杂任务,请阅读
    examples/getting_started/subagents.md
  • 如果用户需要通过MCP(Stdio或SSE)将Agent连接到外部服务,请阅读
    examples/getting_started/mcp_tools.md
  • 如果用户需要创建能够响应时间事件或文件系统触发器的后台主动Agent,请阅读
    examples/getting_started/periodic_trigger.md
  • 如果用户需要拦截Agent生命周期事件(如对话前后、工具执行、错误)以自定义执行流程,请阅读
    examples/getting_started/hooks.md
  • 如果用户需要实现能够跨会话记住过往交互的持久化Agent,请阅读
    examples/getting_started/persistence.md
  • 如果用户需要覆盖Agent工件、临时文件和媒体存储的默认应用数据目录,请阅读
    examples/getting_started/app_data_dir_override.md
  • 如果用户需要让Agent输出结构化数据(例如匹配Pydantic schema的JSON)以实现可靠集成,请阅读
    examples/getting_started/structured_output.md
  • 如果用户需要向Google Antigravity SDK Agent添加、配置或加载Agent技能,请阅读
    examples/getting_started/agent_skills.md