|
| 1 | +""" |
| 2 | +Agent with Antigravity tools |
| 3 | +
|
| 4 | +This example shows how to use Agno's integration with Google's Gemini Agents API |
| 5 | +(Antigravity) as a tool. The Agno agent's brain (Gemini, here) decides when to |
| 6 | +delegate a sub-task to a managed Antigravity sandbox, which runs an autonomous |
| 7 | +loop with web search, code execution, and file I/O built in. |
| 8 | +
|
| 9 | +The sandbox persists across calls within the same Agno session, so subsequent |
| 10 | +calls can build on prior files and state. |
| 11 | +
|
| 12 | +1. Get a Gemini API key enrolled in the Agents API EAP. |
| 13 | +2. Set the API key as an environment variable: |
| 14 | + export GEMINI_API_KEY=<your_api_key> |
| 15 | +3. Install the dependencies: |
| 16 | + uv pip install agno google-genai |
| 17 | +""" |
| 18 | + |
| 19 | +from agno.agent import Agent |
| 20 | +from agno.models.google import Gemini |
| 21 | +from agno.tools.antigravity import AntigravityTools |
| 22 | + |
| 23 | +# --------------------------------------------------------------------------- |
| 24 | +# Create Agent |
| 25 | +# --------------------------------------------------------------------------- |
| 26 | + |
| 27 | +agent = Agent( |
| 28 | + name="Research Assistant with Antigravity tools", |
| 29 | + model=Gemini(id="gemini-2.5-pro"), |
| 30 | + tools=[AntigravityTools()], |
| 31 | + markdown=True, |
| 32 | + instructions=[ |
| 33 | + "You have access to a managed Antigravity sandbox with web search, code execution, and file I/O.", |
| 34 | + "When the user asks for something that benefits from those capabilities — multi-step research, " |
| 35 | + "analysing a repo, generating files, or running code you cannot run locally — delegate the work " |
| 36 | + "to the sandbox via the run_antigravity_task tool.", |
| 37 | + "Otherwise, answer directly without invoking the tool.", |
| 38 | + "The sandbox persists across calls in the same session, so follow-up tasks can build on prior state.", |
| 39 | + ], |
| 40 | +) |
| 41 | + |
| 42 | +# --------------------------------------------------------------------------- |
| 43 | +# Run Agent |
| 44 | +# --------------------------------------------------------------------------- |
| 45 | +if __name__ == "__main__": |
| 46 | + agent.print_response( |
| 47 | + "Use the Antigravity sandbox to find the latest stable Python release " |
| 48 | + "and summarize what changed in it." |
| 49 | + ) |
0 commit comments