Google updates Managed Agents in the Gemini API with environment hooks, model selection, and availability on the free tier. What does this mean for developers, teams, and entrepreneurs? More control over what an agent does inside a remote sandbox, better cost options, and clear paths to automate recurring tasks without friction.
Main updates
These are the practical improvements that matter:
- Gemini 3.6 Flash is now the default model for the agent "antigravity-preview-05-2026".
- You can pin or explicitly choose models with
agent_config.modelwhen creating an interaction or a managed agent. - Environment hooks let you run scripts before or after each tool call inside the remote sandbox.
- Managed agents are now available on projects in the free tier so you can experiment without an active billing account.
- Budget controls like
max_total_tokens, scheduled execution with triggers, and an Environments API to list/clean sandboxes.
Gemini 3.6 Flash as the default model
The agent antigravity-preview-05-2026 now runs by default with Gemini 3.6 Flash. You don’t need to change your code: the next interaction will pick it up automatically.
Want a different model? Set it in agent_config.model. For example, you might prefer gemini-3.5-flash-lite for lower cost and latency.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Audit all dependencies in package.json, upgrade outdated packages, and verify the build by running npm test.",
environment: "remote",
agent_config: {
type: "antigravity",
model: "gemini-3.5-flash-lite",
},
});
console.log(interaction.output_text);
Supported models:
gemini-3.6-flash(default): balance between reasoning, code and tool use.gemini-3.5-flash: previous-generation generator for general agent flows.gemini-3.5-flash-lite: lower latency and cost in the 3.5 family.
Environment hooks: validation and formatting inside the sandbox
Environment hooks let you run your own scripts before or after each tool call the agent makes inside its sandbox. You define a .agents/hooks.json file in the environment and the runtime runs the handlers on pre_tool_execution or post_tool_execution events.
Example hooks.json:
{
"security-gate": {
"pre_tool_execution": [
{
"matcher": "code_execution|write_file",
"hooks": [
{
"type": "command",
"command": "python3 /.agents/hooks-scripts/gate.py",
"timeout": 10
}
]
}
]
},
"auto-format": {
"post_tool_execution": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 /.agents/hooks-scripts/auto_lint.py",
"timeout": 15
}
]
}
]
}
}
What this configuration does:
- The
security-gategroup runsgate.pybefore calls tocode_executionorwrite_file. If the script returns{ "decision": "deny", "reason": "..." }, the tool call is skipped and the reason is added to the model context. - The
auto-formatgroup runsauto_lint.pyafter each tool to apply formatting and style. - Besides
command, hooks supporthttphandlers that POST to external endpoints.
"OffDeal is an AI-native investment bank, and Archie is the analyst our bankers use every day. Before agent hooks, we couldn’t run our validation inside the remote sandbox. With hooks, a post_tool_execution triggers our pipeline that checks pixel-level quality, validations with Gemini Vision, and publishes a manifest of approved files."
- Alston Lin, Founder & CTO of OffDeal
That example shows why hooks are valuable: they let you build validation and quality-control pipelines that run alongside the agent, without exposing data or moving artifacts out of the sandbox.
Cost control and automation
Managed agents can consume many tokens because they run autonomous loops and multi-step workflows. Google adds tools to avoid surprise bills and to operate in production.
- Free tier access: you can try managed agents with an API key on a project without active billing.
max_total_tokens: set a cap (input + output + thinking) inagent_config. When the agent hits the limit, execution pauses safely and the interaction returnsstatus: "incomplete". The environment state is preserved and you can resume by passingprevious_interaction_idwith new budget.
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Audit all modules in this repo and generate a migration report.",
agent_config: {
type: "antigravity",
max_total_tokens: 10000,
},
environment: "remote",
});
- Scheduled triggers: create a trigger that links agent, environment, prompt and a cron schedule for recurring runs. Each run reuses the same sandbox, so files persist between executions.
- Environments API: list, inspect and delete sandbox sessions from code. Useful to recover IDs after disconnects or to clean sandboxes in pipelines instead of waiting the 7-day TTL.
How to get started today
A quick path to try it out:
- If you use the Interactions API skill in your code assistant, add this from your terminal:
npx skills add google-gemini/gemini-skills --skill gemini-interactions-api
- Install the TypeScript/JavaScript SDK if you’ll use it:
npm install @google/genai
- Check the docs: Gemini Interactions API overview and the managed agents quickstart to see agent definitions, environment configs, network rules and advanced streaming patterns.
Worried about security or cost? Start with simple hooks that validate every write and set a low max_total_tokens until you understand your agent’s behavior for your use case.
These improvements turn managed agents into controllable autonomous workers: they run tasks inside real development environments, keep files, obey validation rules, and integrate with your CI/CD without needing external orchestrators.
