Skip to content

Antigravity agents wrap Google's official google-antigravity Python SDK. They run Antigravity's local harness with built-in file, search, shell, web, and subagent tools, multimodal inputs, native structured output, and policy-driven tool approvals, while exposing AgentPool's toolsets and MCP servers over Streamable HTTP MCP.

Installation

google-antigravity is an optional extra:

uv pip install "agentpool[antigravity]"

Authentication

Antigravity supports three backend modes:

  • Gemini Developer API (default): Set GEMINI_API_KEY in the environment, or pass api_key: ${GEMINI_API_KEY} in YAML.
  • Vertex AI: Set vertex: true (or GOOGLE_GENAI_USE_VERTEXAI=true) with either project + location (Standard Mode via Application Default Credentials) or api_key (Express Mode).
  • Local OpenAI-compatible servers (Ollama, LM Studio, etc.): Set openai_compatible: true, base_url, and model.

How it works

  • Each agent manages a google.antigravity.Agent session backed by the bundled localharness binary.
  • Streaming deltas (thinking and text), tool call lifecycle events (ToolCallStartEvent / ToolCallProgressEvent / ToolCallCompleteEvent), context compaction, and nested subagent activity (SubAgentEvent) are mapped directly into AgentPool's event stream.
  • Tool confirmations (policy_mode: confirm_run_command, safe_defaults, or auto) and interactive questions (behavior: interactive) route through AgentPool's InputProvider.
  • AgentPool tools and toolsets are exposed to Antigravity through an in-process Streamable HTTP MCP bridge (ToolManagerBridge), alongside any configured mcp_servers.
  • Structured output (output_type / to_structured()) uses Antigravity's native response_schema and finish tool.
  • Sessions are persisted under save_dir (defaulting to an AgentPool-managed data directory) so load_session and config option changes can resume existing conversations.

Configuration Reference

Antigravity Agent Configuration

Configuration for Google Antigravity SDK agents.

Wraps Google's google-antigravity Python SDK (optional extra agentpool[antigravity]), running Antigravity's local harness with built-in coding tools, policies, multimodal inputs, structured output, and AgentPool toolsets bridged via MCP.

Example:

agents:
  coder:
    type: antigravity
    model: gemini-4-hydrogen
    thinking_level: high
    api_key: ${GEMINI_API_KEY}
    policy_mode: confirm_run_command
    enable_sandbox: true
    system_prompt: "You are a careful Python engineer."
    tools:
      - type: agent_management

  vertex_coder:
    type: antigravity
    vertex: true
    project: my-gcp-project
    location: global
    model: gemini-4-hydrogen
    policy_mode: allow_all

Antigravity Agent Configuration (YAML)
type: antigravity  # Top-level discriminator for agent type.
model: null  # Model name to use. Defaults to the Antigravity SDK default (gemini-4-hydrogen).
thinking_level: null  # Extended thinking level for Gemini models.
service_tier: null  # Inference service tier for Gemini requests.
max_output_tokens: null  # Maximum output tokens per model response.
api_key: null  # Gemini API key or Vertex AI Express key (${VAR} references are expanded).
vertex: null  # Use Vertex AI backend instead of the Gemini Developer API.
project: null  # Google Cloud project ID for Vertex AI standard mode (default: GOOGLE_CLOUD_PROJECT).
location: null  # Google Cloud location for Vertex AI standard mode (default: GOOGLE_CLOUD_LOCATION).
base_url: null  # Optional custom endpoint base URL (for gateways/proxies or OpenAI-compatible servers).
http_headers: {}  # Optional custom HTTP headers for model API requests (${VAR} references are expanded).
openai_compatible: false  # Use LocalOpenAIAgentConfig for local OpenAI-compatible servers (e.g. Ollama).
system_prompt: null  # System prompt for the agent.
include_builtin_system_prompt: true  # Whether to keep Antigravity's default system instructions.
behavior: autonomous  # Operational execution behavior for the Antigravity harness.
policy_mode: allow_all  # Tool execution approval policy preset.
workspace_only: false  # Restrict built-in file tools to paths inside configured workspaces.
enabled_tools: null  # Explicit allowlist of built-in tools. Mutually exclusive with disabled_tools.
disabled_tools: null  # Explicit denylist of built-in tools. Mutually exclusive with enabled_tools.
enable_subagents: true  # Whether the Antigravity harness may spawn and delegate to subagents.
max_subagent_depth: null  # Maximum subagent recursion depth (defaults to 1 when omitted).
enable_daemons: false  # Allow run_command to spawn long-running background daemon processes.
command_timeout: null  # Maximum execution duration in seconds for run_command.
enable_sandbox: false  # Execute run_command inside Antigravity's OS-level sandbox (exebox) when available.
tool_output_max_tokens: null  # Maximum estimated tokens for a single tool response before truncating (0 disables).
mcp_max_output_bytes: null  # Maximum bytes of an MCP tool output before spilling to disk (SDK default: 4096).
workspaces: []  # Workspace directories exposed to Antigravity (defaults to the agent's env.cwd).
skills_paths: []  # Filesystem directories containing SKILL.md files for Antigravity to load.
save_dir: null  # Directory where Antigravity persists trajectories for session resume.
app_data_dir: null  # Optional absolute path for Antigravity harness app data.
compaction_token_threshold: null  # Token ceiling before Antigravity compacts older conversation history.
budget: null  # Optional session-level token and call count budget caps.
env_vars: {}  # Environment variables to set.
tools: []  # AgentPool tools and toolsets to expose to Antigravity via an in-process MCP bridge.
output_type: null  # Optional structured output type for responses. Can be either a reference to a response defined in ma...
debug: false  # Enable verbose Antigravity SDK logging and server-side tracing.
sdk_options: {}  # Fields of the Antigravity SDK's agent config passed through as they are.
requires_tool_confirmation: per_tool  # How to handle tool confirmation:
hooks:  # Hooks for intercepting and customizing agent behavior at key lifecycle points.
  pre_run: []  # Hooks executed before agent.run() processes a prompt.
  post_run: []  # Hooks executed after agent.run() completes.
  pre_tool_use: []  # Hooks executed before a tool is called. Can block or modify the call.
  post_tool_use: []  # Hooks executed after a tool completes.
environment: null  # Execution environment config for the agent's own toolsets.
name: null  # Identifier for the node. Set from dict key, not from YAML.
display_name: null  # Human-readable display name for the node.
description: null  # Optional description of the agent / team.
triggers: []  # Event sources that activate this agent / team
connections: []  # Targets to forward results to.
mcp_servers: []  # List of MCP server configurations:
input_provider: null  # Provider for human-input-handling.
event_handlers: []  # Event handlers for processing agent stream events.

Basic Usage

agents:
  coder:
    type: antigravity
    model: gemini-4-hydrogen
    thinking_level: high
    api_key: ${GEMINI_API_KEY}
    policy_mode: confirm_run_command
    enable_sandbox: true
    system_prompt: "You are a careful Python engineer."
    tools:
      - type: subagent

  vertex_reviewer:
    type: antigravity
    vertex: true
    project: my-gcp-project
    location: global
    model: gemini-3.1-pro-preview
    policy_mode: safe_defaults
    disabled_tools:
      - generate_image
    budget:
      max_model_calls: 20
      max_total_tokens: 200000

  local_ollama:
    type: antigravity
    openai_compatible: true
    base_url: http://localhost:11434/v1
    model: qwen3:32b
    behavior: minimal

Configuration Notes

  • policy_mode defaults to allow_all for programmatic use; switch to confirm_run_command, safe_defaults, or auto to require interactive approvals through AgentPool's InputProvider.
  • mode (policy preset), thought_level, behavior, and model are exposed as switchable config options and take effect on the next turn (resuming the current conversation when active).
  • Setting behavior: interactive automatically enables Antigravity's ask_question tool (unless enabled_tools is explicitly specified) and bridges questions through InputProvider.get_elicitation().