AntigravityAgent wraps Managed Agents in the Gemini API so a Google-managed,
sandboxed agent can be served through AgentOS. A single API call spins up a secure Linux environment where the agent
plans, executes code, searches the web, and reads/writes files. AgentOS handles sessions, streaming, and the UI.
Install
Parameters
Concepts
Sessions and environment persistence
Each interaction provisions a managed Linux sandbox and returns anenvironment_id. When a db is configured,
AntigravityAgent persists that id (and the previous interaction id) in the session, so subsequent turns with the
same session_id reuse the same sandbox. Files, installed packages, and state carry over.
Without a db, every turn provisions a fresh sandbox (no cross-turn reuse).
Seeding the environment with sources
Passsources to preload files into the sandbox before the agent runs. Three source types are supported:
inline content, Google Cloud Storage, and Git repositories.
Custom agents
Register a reusable named agent (instructions + sources stored server-side), then invoke it by name. Registration is explicit and idempotent (an already-existing agent is reused).Defining an agent from a directory
from_agent_directory builds an agent from a local folder following the Managed Agents layout:
agent.yaml (id, base_agent, description, system_instruction), AGENTS.md (overrides
system_instruction), workspace/ (mounted at the sandbox root), and skills/ (mounted under
/.agents/skills/). It registers the agent with the API before returning (register=True default).
Downloading an environment snapshot
Pull the sandbox filesystem (after a run modified it) as a tar archive.Examples
AgentOS deployment
Serve an Antigravity agent through AgentOS with persisted sessions.
Standalone usage
Call the agent directly with
.run() and .print_response().Sessions
Reuse the sandbox across turns with
session_id.Environment sources
Preload files into the sandbox from inline / GCS / repo sources.
Custom agents
Register and invoke a named custom agent.
Agent from a directory
Define an agent from
agent.yaml + AGENTS.md + workspace/ + skills/.Environment snapshot
Download the sandbox filesystem as a tar archive.