项目预览
项目数据
项目介绍
Star 增长趋势
本站每日记录该项目 GitHub 星标变化,观测越久曲线越完整
数据来源:GitHub API 逐日快照 · 收录于 2026-08-09 · 当前星标 ★ 3974
使用教程
环境要求
- Python 环境(可执行 pip 与 python 命令)
- 可访问 PyPI 的网络,用于安装平台对应的 wheel 包
- 一个 GEMINI_API_KEY(Google Gemini API 密钥)
- 如需使用 Vertex/企业平台模式,需准备 api_key 或 ADC 凭证
安装与启动步骤
-
1安装 SDK
从 PyPI 安装官方包,会一并获取平台专用的编译运行时二进制文件。切勿只克隆仓库而不安装。
pip install google-antigravity -
2克隆示例仓库
README 中的示例脚本放在仓库 examples/ 目录下,克隆后才能本地运行这些示例。
git clone https://github.com/google-antigravity/antigravity-sdk-python.git cd antigravity-sdk-python -
3配置 API 密钥
把环境变量 GEMINI_API_KEY 设为你的真实密钥,SDK 与示例脚本会读取它进行鉴权。
export GEMINI_API_KEY="your_api_key_here" -
4运行入门示例
执行 hello_world 示例验证安装与鉴权是否都正常,成功后会打印智能体返回的文本。
python ./examples/getting_started/hello_world.py -
5改用 Vertex 模式
使用 Gemini Enterprise Agent Platform(原 Vertex AI)时,在配置中设置 vertex=True 并传入 api_key。
from google.antigravity import Agent, LocalAgentConfig config = LocalAgentConfig( vertex=True, api_key="your_api_key_here", ) async with Agent(config) as agent: response = await agent.chat("What files are here?") print(await response.text()) -
6高级会话用法
需要自己控制连接生命周期时,用 Conversation 配合 LocalConnectionStrategy 和 ToolRunner。
import asyncio from google.antigravity.connections.local import LocalConnectionStrategy from google.antigravity.conversation.conversation import Conversation from google.antigravity.tools.tool_runner import ToolRunner async def main(): tool_runner = ToolRunner() strategy = LocalConnectionStrategy(tool_runner=tool_runner) async with Conversation.create(strategy) as conversation: response = await conversation.chat("What files are here?") print(await response.text()) print(f"Total steps: {len(conversation.history)}") print(f"Turns: {conversation.turn_count}") asyncio.run(main())
关键配置
| 配置项 | 必填 | 说明 | 示例 |
|---|---|---|---|
GEMINI_API_KEY | 是 | 环境变量,供 SDK 与示例脚本读取的 Gemini API 密钥 | your_api_key_here |
vertex | 否 | LocalAgentConfig 参数,设为 True 使用 Gemini 企业平台模式 | vertex=True |
api_key | 否 | LocalAgentConfig 参数,Express 模式下直接提供的 API Key | your_api_key_here |
如何确认成功
运行 hello_world 示例后能正常打印出智能体返回文本、无报错,即表示安装与鉴权成功。
常见问题
Q:只克隆 GitHub 仓库不安装可以吗?
A:不可以。SDK 依赖已编译的运行时二进制,只包含在 PyPI 发布的平台相关 wheel 中,必须执行 pip install google-antigravity。
Q:不用 Google Cloud 项目能用 Vertex 吗?
A:可以。使用 Express 模式,在 LocalAgentConfig 中设置 vertex=True 并传入 api_key,无需项目、区域配置或 ADC。
Q:需要手动申请密钥吗?
A:需要。README 示例中使用 GEMINI_API_KEY,请替换成你自己的真实密钥后再运行示例。
注意事项
- 安装必须从 PyPI 进行,克隆仓库仅用于获取 examples/ 示例代码,本身不足以运行 SDK。
- API Key 属于敏感信息,不要硬编码进源码或提交到版本库,建议用环境变量方式注入。
- Vertex 模式与 Gemini API Key 模式需要分别按 README 的两种鉴权方式配置。
核心亮点
- 深度整合 Google Antigravity 和 Gemini API,提供开箱即用的智能体能力。
- 内置技能(Skills)系统,支持模块化封装和复用自定义功能。
- 支持 MCP 协议,便于接入外部工具生态,扩展性强。
不足之处
- 依赖 Google 特定平台,可能限制非 Google 生态的迁移性。
- 文档和社区生态尚在成长,部分高级用法示例不足。
适用场景
- 快速构建基于 Gemini 的客服或问答机器人。
- 开发需要调用外部工具的多步骤自动化工作流。
- 在 Python 项目中集成 Antigravity 平台的智能体能力。
替代项目
LangChain、LlamaIndex、AutoGen
上一篇:race-condition
下一篇:Citadel
同类项目推荐
cli-agent-orchestrator
开源
让多个AI编码助手并行协作,复杂任务效率倍增
Multi-agent orchestration for AI coding CLIs — Claude Code, Kiro, Codex, and more, ···
Velocity
开源
开源平替 Cursor/Claude Code,在编辑器里用 AI 改代码
☄️ Opensource equivalent of Google's Antigravity/Claude Code/Cursor
GenAI_Agents
开源
50+实战教程,从聊天机器人到多智能体系统,快速上手 AI 智能体开发。
50+ tutorials and implementations for Generative AI Agent techniques, from basic con···
hermes-rs
开源
用 Rust 重写 AI 智能体核心循环,让工具调用快如闪电。
A fast, self-contained AI agent runtime
agentor
开源
快速构建和部署可靠 AI 智能体,支持 MCP 工具与智能体协作。
Open source version of Claude Managed Agents. Fastest way to build and deploy reliab···
cc-skills
开源
给 Claude Code 装上技能包,开发运维一键加速
Claude Code Skills Marketplace: plugins, skills for ADR-driven development, DevOps a···
streamcore-server
开源
用 Go 打造低延迟实时语音智能体,支持打断和本地部署。
Open-source realtime voice agent server in Go with WebRTC (WHIP), barge-in, streamin···
search-console-mcp
开源
让 AI 直接查搜索与流量数据
Search & analytics data as infrastructure — MCP server for Google Search Console, B···
second-brain-agent
开源
把笔记变成聊天机器人,用对话唤醒你的知识库
Second Brain AI agent
