agent_run
Starts a background autonomous agent in a Google-hosted Linux sandbox to write and run code, edit files, and browse while enforcing a required token budget.
Instructions
Start the Antigravity managed agent: an autonomous agent in a Google-hosted Linux sandbox that can write and run code, edit files and browse. Runs in the background; BILLED per token, and the agent may itself call other Gemini APIs with your key - always confirm the budget with the user first.
task: what to do and what to deliver (e.g. "analyze sales.csv, write report.txt and chart.png"). max_total_tokens: REQUIRED hard budget for the run (capped by GEMINI_AGENT_MAX_TOKENS, default 300000). If the budget runs out the status is "incomplete"; resume with previous_interaction_id + environment_id. model: reasoning model for the agent (e.g. gemini-3.8-flash, gemini-4-hydrogen); default is the agent's. files: local files uploaded into the sandbox (<=10 MB total). repository: a repository source to mount, e.g. "github.com/owner/repo". sources: raw source objects ({"type": "gcs"|"inline"|"repository", "source", "target", ...}). network: "disabled" to cut off internet access. environment_id / previous_interaction_id: continue in an existing sandbox / conversation. Then: agent_status(interaction_id) for progress, agent_files(environment_id) for outputs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task": "<task>",
"max_total_tokens": "<max_total_tokens>"
},
"name": "agent_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | ||
| agent | No | ||
| files | No | ||
| model | No | ||
| network | No | ||
| sources | No | ||
| repository | No | ||
| environment_id | No | ||
| max_total_tokens | Yes | ||
| previous_interaction_id | No |