{"slug": "gemini-api-managed-agents-3-6-flash-hooks-and-more", "title": "Gemini API Managed Agents: 3.6 Flash, hooks, and more", "summary": "Google's Gemini API Managed Agents now default to Gemini 3.6 Flash, introduce environment hooks for custom pre- and post-tool execution scripts, and offer free tier access, enabling a single API call to coordinate reasoning, code execution, and web retrieval in an isolated cloud sandbox.", "body_md": "# Gemini API Managed Agents: 3.6 Flash, hooks, and more\n\n[Managed Agents in Gemini API](https://ai.google.dev/gemini-api/docs/agents) are getting [environment hooks](https://ai.google.dev/gemini-api/docs/agent-hooks), [model selection](https://ai.google.dev/gemini-api/docs/antigravity-agent#model-selection), and [free tier access](https://ai.google.dev/gemini-api/docs/pricing#pricing-for-agents). These capabilities build on our previous release introducing [background tasks and remote MCP server integration](https://blog.google/innovation-and-ai/technology/developers-tools/expanding-managed-agents-gemini-api/).\n\nWith managed agents in the [Gemini Interactions API](https://ai.google.dev/gemini-api/docs/interactions-overview), a single API call coordinates, reasoning, code execution, package installation, file management, and web retrieval inside an isolated cloud sandbox.\n\nIf you're using an AI coding assistant, drop this in your terminal to give it access to the Interactions API skill: `npx skills add google-gemini/gemini-skills --skill gemini-interactions-api.`\n\nBelow are examples using the `@google/genai`\n\nTypeScript/JavaScript SDK. For Python or cURL, check out the [Antigravity agent documentation](https://ai.google.dev/gemini-api/docs/antigravity-agent).\n\n```\nnpm install @google/genai\n```\n\n## Gemini 3.6 Flash is now the default\n\nThe `antigravity-preview-05-2026`\n\nagent now runs [Gemini 3.6 Flash](https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-3-6-flash-3-5-flash-lite-3-5-flash-cyber/) by default. No code changes are required. Your next interaction picks it up automatically.\n\nYou can also explicitly select models by passing `agent_config.model`\n\nwhen creating an interaction or managed agent. Use Gemini 3.5 Flash-Lite for lower cost, or pin to your model of preference.\n\n``` js\nimport { GoogleGenAI } from \"@google/genai\";\n\nconst client = new GoogleGenAI({});\n\nconst interaction = await client.interactions.create({\n  agent: \"antigravity-preview-05-2026\",\n  input: \"Audit all dependencies in package.json, upgrade outdated packages, and verify the build by running npm test.\",\n  environment: \"remote\",\n  agent_config: {\n    type: \"antigravity\",\n    model: \"gemini-3.5-flash-lite\",\n  },\n});\n\nconsole.log(interaction.output_text);\n```\n\nSupported models include:\n\n**Gemini 3.6 Flash**(`gemini-3.6-flash`\n\n, default): Balanced model for reasoning, coding, and tool use.**Gemini 3.5 Flash**(`gemini-3.5-flash`\n\n): Previous generation for general agentic workflows.**Gemini 3.5 Flash-Lite**(`gemini-3.5-flash-lite`\n\n): Lowest latency and cost on the Gemini 3.5 family.\n\n## Environment hooks: block, lint, and audit tool calls inside the sandbox\n\n[Environment hooks](https://ai.google.dev/gemini-api/docs/agent-hooks) let you run your custom scripts before or after every tool call the agent makes inside its sandbox. Add a .`agents/hooks.json`\n\ninto your environment and the runtime executes your handlers on `pre_tool_execution or post_tool_execution`\n\nevents.\n\nThe `matcher`\n\nfield supports regular expressions, allowing you to target multiple tools with `|`\n\nor catch everything with `*`\n\n:\n\n```\n{\n  \"security-gate\": {\n    \"pre_tool_execution\": [\n      {\n        \"matcher\": \"code_execution|write_file\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"python3 /.agents/hooks-scripts/gate.py\",\n            \"timeout\": 10\n          }\n        ]\n      }\n    ]\n  },\n  \"auto-format\": {\n    \"post_tool_execution\": [\n      {\n        \"matcher\": \"*\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"python3 /.agents/hooks-scripts/auto_lint.py\",\n            \"timeout\": 15\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\nIn this configuration:\n\n- The\n`security-gate`\n\ngroup runs`gate.py`\n\nbefore every`code_execution`\n\nor`write_file`\n\ncall. If the script returns`{\"decision\": \"deny\", \"reason\": \"...\"}`\n\n, the tool call is skipped and the rejection reason is passed into the model’s context. - The\n`auto-format`\n\ngroup runs`auto_lint.py`\n\nafter every tool finishes to enforce code styling. - Hooks also support\n`http`\n\ntype handlers that POST directly to an external endpoint.\n\nFor complete HTTP hook definitions and failure handling semantics, refer to the [hooks documentation](https://ai.google.dev/gemini-api/docs/agent-hooks).\n\nTeams are already using hooks to build production-grade validation pipelines. For example, AI-native investment bank Offdeal uses `post_tool_execution`\n\nhooks to run automated image verification inside the remote sandbox.\n\n*\"OffDeal is an AI-native investment bank, and Archie is the AI analyst our bankers use every day. A requirement for banker-ready decks is company logos: buyer tables, sponsor columns, tombstone grids, often 30+ logos in a single deck, every one of which must be the right company, the appropriate size and aspect ratio, contain the name, have a transparent background, and have a high contrast when placed on a white slide.*\n\n*Before agent hooks, we couldn’t do this on Gemini’s managed agents: the sandbox is remote, so our validation code had nowhere to run. With hooks, a post_tool_execution hook triggers our pipeline inside the sandbox the moment Archie writes its company list, fetching candidates, enforcing pixel-level quality checks, verifying each logo with Gemini vision, and publishing a manifest of approved files that are the only images allowed into the deck.\"*\n\n- Alston Lin, Founder & CTO of OffDeal\n\n## Cost control and automation features\n\n### Free tier availability\n\nManaged agents are now available on [free tier projects](https://ai.google.dev/gemini-api/docs/pricing#pricing-for-agents). Developers can experiment with agentic workflows using an [API key from a project without active billing](https://ai.google.dev/gemini-api/docs/api-key).\n\n### Budget controls\n\nBecause managed agents execute multi-turn autonomous loops, complex tasks can consume significant token budgets. To prevent runaway tasks, you can pass `max_total_tokens`\n\ninside `agent_config`\n\nto cap total consumption (input + output + thinking).\n\nWhen the agent reaches the limit, execution safely pauses and the interaction returns `status: \"incomplete\"`\n\n. The environment state is preserved, enabling you to [continue where it stopped](https://ai.google.dev/gemini-api/docs/antigravity-agent#continuing-incomplete-interaction) by passing `previous_interaction_id`\n\nwith a fresh budget.\n\n``` js\nconst interaction = await client.interactions.create({\n  agent: \"antigravity-preview-05-2026\",\n  input: \"Audit all modules in this repo and generate a migration report.\",\n  agent_config: {\n    type: \"antigravity\",\n    max_total_tokens: 10000,\n  },\n  environment: \"remote\",\n});\n```\n\n### Scheduled execution with triggers\n\nAutomate recurring agent tasks with [scheduled triggers](https://ai.google.dev/gemini-api/docs/antigravity-agent#triggers). A trigger binds an agent, environment, prompt, and cron schedule into a persistent resource that fires without manual intervention. Each run reuses the same sandbox, so files persist across executions.\n\n### Environments API\n\nThe [Environments API](https://ai.google.dev/gemini-api/docs/agent-environment#environments-api) lets you list, inspect, and delete sandbox sessions from code. Recover environment IDs after a disconnect, or clean up sandboxes when your pipeline finishes instead of waiting for the 7-day TTL.\n\n## Get started with managed agents\n\nThese updates turn managed agents into cost-controlled, scheduled workers that operate autonomously inside real development environments without breaking your budget or requiring external orchestration.\n\nCheck out the [Gemini Interactions API overview](https://ai.google.dev/gemini-api/docs/interactions-overview) and the [managed agents quickstart](https://ai.google.dev/gemini-api/docs/managed-agents-quickstart) to explore custom agent definitions, environment configurations, network rules, and advanced streaming patterns.", "url": "https://wpnews.pro/news/gemini-api-managed-agents-3-6-flash-hooks-and-more", "canonical_source": "https://blog.google/innovation-and-ai/technology/developers-tools/expanding-managed-agents-gemini-api-3-6-flash-hooks/", "published_at": "2026-07-28 16:00:00+00:00", "updated_at": "2026-07-28 16:28:19.290379+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "developer-tools"], "entities": ["Google", "Gemini API", "Gemini 3.6 Flash", "Gemini 3.5 Flash", "Gemini 3.5 Flash-Lite", "Gemini Interactions API", "TypeScript", "JavaScript"], "alternates": {"html": "https://wpnews.pro/news/gemini-api-managed-agents-3-6-flash-hooks-and-more", "markdown": "https://wpnews.pro/news/gemini-api-managed-agents-3-6-flash-hooks-and-more.md", "text": "https://wpnews.pro/news/gemini-api-managed-agents-3-6-flash-hooks-and-more.txt", "jsonld": "https://wpnews.pro/news/gemini-api-managed-agents-3-6-flash-hooks-and-more.jsonld"}}