Antigravity Agent

The Antigravity agent is a general-purpose managed agent on the Gemini API. A single API call gives you an agent that reasons, executes code, manages files, and browses the web inside your own secure Linux sandbox, hosted by Google.

It is powered by Gemini 3.7 Flash and uses the same harness as the Antigravity IDE. You can configure the underlying Gemini model using agent_config. Available through the Interactions API and Google AI Studio.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    environment="remote",
)

print(interaction.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    environment: "remote",
}, { timeout: 300000 });

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    "environment": "remote"
}'

Capabilities

Each call can provision a Linux sandbox and starts a tool-use loop. The agent plans, acts, observes results, and repeats until the task is done.

  • Code execution: Run Bash, Python, and Node.js commands. Install packages, run tests, build apps.
  • File management: Read, write, edit, search, and list files in the sandbox. Files persist across interactions.
  • Web access: Google Search and URL fetching for data.
  • Context compaction: Automatic context compaction (triggered at ~135k tokens) to support long-running, multi-turn sessions without losing context or hitting token limits.

See the Quickstart for multi-turn usage and streaming.

Supported tools

By default, the agent has access to code_execution, google_search, and url_context. Filesystem tools are enabled automatically when you specify the environment parameter. You can also define custom functions to connect the agent to your own APIs and tools. You only need to specify the tools parameter when customizing or restricting the default set, or when adding custom functions.

Tool Type value Description
Code Execution code_execution Run shell commands (bash, Python, Node) with stdout/stderr capture.
Google Search google_search Search the public web.
URL Context url_context Fetch and read web pages.
Filesystem (enabled via environment) Read, write, edit, search, and list files in the sandbox. The system enables these tools automatically when you set the environment.
Custom Functions function Define custom functions that the agent can request to execute. See Function calling.
Remote MCP Server mcp_server Register external Model Context Protocol (MCP) servers as tools. See MCP servers.

You can intercept and validate code_execution and filesystem tool execution right inside the remote sandbox using synchronous Hooks.

To limit the agent to specific tools, pass only the ones you need:

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Search for the latest AI research papers on reasoning and summarize them.",
    environment="remote",
    tools=[
        {"type": "google_search"},
        {"type": "url_context"},
    ],
)

print(interaction.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions