πŸ€– AI Tools
Β· 7 min read

Antigravity SDK Guide: Build Custom AI Agents with Google's Managed Agent API (2026)


The Antigravity SDK is Google’s programmatic interface for building custom AI agents that run as managed services on the Gemini API. Announced at Google I/O 2026, the SDK is the third surface of the Antigravity 2.0 platform β€” alongside the Desktop app and the agy CLI β€” giving developers full control over agent creation, customization, and deployment through code.

If you’ve been looking for a way to spin up AI agents that can reason, write and execute code, manage files, and browse the web β€” all without managing infrastructure β€” the Antigravity SDK and its Managed Agents API is exactly that.

What Are Managed Agents on the Gemini API?

Managed agents are a new primitive on the Gemini API. Instead of stitching together a model call, a code interpreter, a file system, and a browser tool yourself, a single API call gives you a fully operational agent running inside a secure Linux sandbox hosted by Google.

The concept is straightforward: you describe what you want the agent to do, and Google handles the orchestration layer β€” the reasoning loop, tool dispatch, sandbox lifecycle, and state management. You focus on the what, not the how.

This is fundamentally different from traditional agent frameworks where you’re responsible for the execution environment, tool integration, and loop management. With managed agents on the Gemini API, all of that is abstracted away.

How the Antigravity SDK Works

At its core, the Antigravity SDK exposes the Managed Agents API through a clean client library. Here’s what happens when you create an agent:

  1. You make a single API call with your agent configuration (instructions, skills, data)
  2. Google provisions a secure Linux sandbox β€” an isolated environment with code execution, file system access, and web browsing capabilities
  3. The agent reasons and acts within that sandbox, using Gemini 3.5 Flash (or other supported models) as its backbone
  4. Results stream back via the API β€” structured output, generated files, execution logs

The sandbox supports:

  • Code execution β€” Python, Node.js, shell scripts, and more
  • File management β€” read, write, create, and organize files within the sandbox
  • Web browsing β€” fetch pages, extract data, interact with web content
  • Search β€” grounded web search for real-time information
  • Function calling β€” invoke your own tools and APIs
  • Structured output β€” get typed, parseable responses

Inline vs Saved Agents

The Antigravity SDK supports two modes for working with managed agents:

Inline Agents

Inline agents are customized at interaction time. You pass instructions, skills, and data directly in the API call. This is ideal for dynamic use cases where the agent’s behavior changes based on context β€” think per-request customization in a CI/CD pipeline or a user-facing application.

Saved Agents

Saved agents are persisted configurations that you invoke by ID. You define the agent once β€” its instructions, skills, available tools β€” and then call it repeatedly without re-specifying the configuration. This is the pattern for production workloads: define once, invoke many times.

Saved agents integrate directly with the Agent Platform on Google Cloud, making them suitable for production deployments with monitoring, versioning, and access control.

Code Example: Creating a Custom Agent

Here’s how to create an inline managed agent with the Antigravity SDK:

from antigravity import AntigravityClient

client = AntigravityClient(api_key="YOUR_GEMINI_API_KEY")

# Create an inline agent with custom instructions
response = client.agents.create_and_run(
    model="gemini-3.5-flash",
    instructions="""You are a code review agent. Analyze the provided code for:
    - Security vulnerabilities
    - Performance issues
    - Code style violations
    Return a structured report with severity levels.""",
    skills=["code_execution", "file_management"],
    input="Review the Python files in the uploaded project.",
    files=["./src/main.py", "./src/utils.py"],
    output_format="json"
)

print(response.output)

And here’s how to create and invoke a saved agent:

# Create a saved agent (one-time setup)
agent = client.agents.create(
    name="code-reviewer",
    model="gemini-3.5-flash",
    instructions="You are a senior code reviewer...",
    skills=["code_execution", "file_management", "search"],
    tools=[{
        "type": "function",
        "function": {
            "name": "post_review_comment",
            "description": "Posts a review comment to the PR",
            "parameters": { ... }
        }
    }]
)

# Invoke by ID (repeated use)
result = client.agents.run(
    agent_id=agent.id,
    input="Review PR #142 for security issues",
    files=["./diff.patch"]
)

Adding Skills and Instructions

Skills define what capabilities your agent has access to. The Antigravity SDK provides built-in skills and lets you define custom ones:

Built-in skills:

  • code_execution β€” run code in the sandbox
  • file_management β€” CRUD operations on files
  • web_browsing β€” navigate and extract from web pages
  • search β€” grounded Google Search
  • structured_output β€” enforce output schemas

Custom instructions shape how the agent reasons and behaves. Best practices:

instructions = """
Role: You are a deployment automation agent.
Context: You operate in a CI/CD pipeline for a Node.js application.
Constraints:
- Never modify production databases directly
- Always run tests before deploying
- Report failures immediately via the notify_team function
Output: Provide a deployment summary in JSON format.
"""

The combination of skills + instructions + data (files, context) gives you fine-grained control over agent behavior without writing orchestration code.

MCP Integration

The Antigravity SDK supports extending agents with MCP (Model Context Protocol) servers. This means your managed agents can connect to external tools, databases, and services through the standardized MCP interface.

agent = client.agents.create_and_run(
    model="gemini-3.5-flash",
    instructions="You are a database migration agent.",
    skills=["code_execution"],
    mcp_servers=[
        {
            "name": "postgres-mcp",
            "url": "https://your-mcp-server.com/postgres",
            "auth": {"type": "bearer", "token": "..."}
        }
    ],
    input="Generate and apply migration for adding a 'status' column to the orders table."
)

MCP integration turns managed agents into connectors for your entire infrastructure β€” they can interact with any system that exposes an MCP server.

Use Cases

The Antigravity SDK shines in scenarios where you need autonomous AI agents that operate on code, data, or infrastructure:

CI/CD Automation

Spin up an agent per pull request that reviews code, runs tests, checks for security issues, and posts comments. The agent lives for the duration of the pipeline run and has full access to the codebase in its sandbox.

Custom Coding Pipelines

Build agents that generate code from specs, refactor existing codebases, or migrate between frameworks. The codelabs released alongside the SDK include spec-driven ADK agent development and autonomous developer pipelines.

Research Agents

Create agents that browse the web, synthesize information, and produce structured reports. Combine search + web_browsing + file_management skills for end-to-end research workflows.

Deployment Agents

Agents that manage your deployment process β€” running health checks, rolling back on failure, and notifying your team. Pair with MCP servers connected to your cloud infrastructure.

Pricing and Access

The Antigravity SDK and Managed Agents API are available through the Gemini API at ai.google.dev. Pricing follows the standard Gemini API model:

  • Model usage β€” billed per input/output token (same rates as Gemini 3.5 Flash or whichever model you select)
  • Sandbox compute β€” billed per second of sandbox runtime
  • Storage β€” for saved agents and persistent files

Free tier access is available for experimentation. For production workloads, the Agent Platform on Google Cloud provides enterprise features including SLAs, VPC integration, and audit logging.

FAQ

What is the Antigravity SDK?

The Antigravity SDK is Google’s programmatic interface for creating and managing AI agents on the Gemini API. It’s part of the Antigravity 2.0 platform announced at Google I/O 2026, alongside the Desktop app and the agy CLI.

How do managed agents on the Gemini API differ from regular model calls?

Regular model calls return text completions. Managed agents are autonomous entities that can reason across multiple steps, execute code, manage files, browse the web, and use tools β€” all within a secure sandbox managed by Google. You get an agent that acts, not just a model that responds.

Do I need to manage infrastructure for managed agents?

No. The entire execution environment β€” the Linux sandbox, code runtime, file system, and browser β€” is hosted and managed by Google. You interact purely through the API.

Can I use the Antigravity SDK with existing agent frameworks?

Yes. The SDK can be used standalone or integrated into existing agent frameworks. You can also extend managed agents with MCP servers to connect them to your existing tooling.

What models does the Managed Agents API support?

At launch, the API supports Gemini 3.5 Flash and other models in the Gemini family. Model selection is specified per agent creation call.

Is the Antigravity SDK free to use?

There’s a free tier for experimentation and development. Production usage is billed based on token consumption, sandbox compute time, and storage. Check ai.google.dev for current pricing.