> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Antigravity Directory Tools

> Use a local Antigravity agent directory through AntigravityTools.

```python antigravity_directory_tools.py theme={null}
"""
Use a local Antigravity agent directory through AntigravityTools.

Pass `agent_directory=` to the toolkit constructor and it will:
  1. Parse `agent.yaml`, `AGENTS.md`, `workspace/`, and `skills/`.
  2. Register the agent definition via POST /v1beta/agents (idempotent).
  3. Route all subsequent `run_antigravity_task` calls at the named custom agent.

Lets a regular Agno agent (any model) delegate sub-tasks to a folder-defined
Antigravity agent without having to wire up `/agents` calls yourself.

Re-uses the example folder from
`cookbook/frameworks/antigravity/example_agent/`.

Requirements:
    export GEMINI_API_KEY=...
    uv pip install agno google-genai pyyaml

Usage:
    .venvs/demo/bin/python cookbook/91_tools/antigravity/antigravity_directory_tools.py
"""

from pathlib import Path

from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.antigravity import AntigravityTools

AGENT_DIR = (
    Path(__file__).parent.parent.parent / "frameworks" / "antigravity" / "example_agent"
)

agent = Agent(
    name="Haiku Requester",
    model=Gemini(id="gemini-2.5-pro"),
    # Register the folder once at construction; subsequent run_antigravity_task
    # calls invoke the named agent (`agno-haiku-bot-from-dir`).
    tools=[AntigravityTools(agent_directory=str(AGENT_DIR))],
    markdown=True,
    instructions=[
        "When the user asks for a haiku, delegate to the Antigravity sandbox via run_antigravity_task.",
        "Pass the topic through as-is; the sandbox agent enforces house style.",
    ],
)

if __name__ == "__main__":
    agent.print_response("Write a haiku about autumn maples.")
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno google-genai
```

**2. Export your API keys**

```bash Mac/Linux theme={null}
export GEMINI_API_KEY="your_gemini_api_key_here"
export GOOGLE_API_KEY="your_google_api_key_here"
```

```bash Windows theme={null}
$Env:GEMINI_API_KEY="your_gemini_api_key_here"
$Env:GOOGLE_API_KEY="your_google_api_key_here"
```

**3. Clone Agno**

Clone the pinned Agno source and run the remaining commands from its root:

```bash theme={null}
git clone https://github.com/agno-agi/agno.git
cd agno
git checkout v3.0.4
```

**4. Run the example**

Run the example from the repository root:

```bash theme={null}
python cookbook/91_tools/antigravity/antigravity_directory_tools.py
```

Full source: [cookbook/91\_tools/antigravity/antigravity\_directory\_tools.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/91_tools/antigravity/antigravity_directory_tools.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.