Gemini API Managed Agents gains hooks, budget controls, and free tier access
blog.google

Gemini API Managed Agents gains hooks, budget controls, and free tier access

Tech News
4 min read

Published by AINave Editorial • Reviewed by Ramit

TL;DRGoogle's Gemini API Managed Agents now default to Gemini 3.6 Flash, with new environment hooks, token budgeting, scheduled triggers, and free tier access. Build autonomous, cost-controlled AI workers inside isolated sandboxes.

Google has updated its Gemini API Managed Agents with a new default model, environment hooks for sandboxed validation, explicit token budgeting, and free tier access. These changes let AI builders run autonomous, cost-controlled agents inside isolated cloud sandboxes without external orchestration.

What happened

Managed Agents in the Gemini Interactions API now run Gemini 3.6 Flash by default. No code changes are needed; existing interactions pick up the new model automatically. You can also explicitly pin models by passing agent_config.model: use Gemini 3.5 Flash-Lite for lower cost or stick with 3.6 Flash.

The most significant addition is environment hooks. By adding a .agents/hooks.json file into your sandbox, you can define pretoolexecution and posttoolexecution handlers. These scripts run before or after every tool call the agent makes, giving you the ability to block, lint, or audit tool outputs. The matcher field supports regular expressions, so you can target specific tools or catch all.

For example, AI-native investment bank OffDeal uses a posttoolexecution hook to run automated logo verification inside the sandbox. The hook fetches candidate logos, enforces pixel-level quality checks, verifies each logo with Gemini vision, and publishes a manifest of approved files. The other images are blocked from the final deck.

Token budgeting is now available via maxtotaltokens inside agentconfig. This caps the total input, output, and thinking tokens. When the limit is reached, execution pauses safely, the interaction returns status: "incomplete", and the environment state is preserved. You can resume by passing previousinteraction_id with a fresh budget.

Scheduled triggers let you automate recurring tasks. 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.

The Environments API lets you list, inspect, and delete sandbox sessions from code. This helps recover environment IDs after a disconnect or clean up sandboxes before the 7-day TTL.

Managed agents are now available on free tier projects, allowing experimentation without active billing.

Why AI builders should care

These updates turn managed agents into production-ready autonomous workers. The key value is that you can run custom validation code inside the remote sandbox, something that was previously impossible because the sandbox is isolated. Environment hooks close that gap, letting you enforce quality gates, compliance checks, or data transformations without leaving the Gemini ecosystem.

Token budgeting with pause/resume gives you cost control for long-running multi-turn agents. Instead of killing a task that goes over budget, you can pause it and resume later with a fresh allocation. This is useful for complex data processing, document generation, or research loops that take many steps.

Scheduled triggers with persistent sandboxes are ideal for recurring tasks like daily report generation, monitoring, or data ingestion. Files written in one run are available in the next, so you can build incremental pipelines without external storage.

Free tier access lowers the barrier for prototyping. Builders can test agentic workflows without committing to a paid plan.

Practical implications

For teams building AI agents that need to interact with files, run code, or call external APIs, Gemini Managed Agents now provide a more complete runtime. The model selection lets you balance cost and performance per task. The hooks pattern is particularly powerful: you can implement a validation pipeline that runs inside the sandbox, making it auditable and self-contained.

The agent's ability to pause and resume execution means you can implement checkpointing without building your own state management. The scheduled trigger pattern eliminates the need for cron jobs or external schedulers for simple recurring tasks.

Caveats

The managed agents rely on a remote sandbox with a 7-day TTL. While the Environments API helps manage sessions, you cannot run agents on your own infrastructure. The hooks are limited to pretoolexecution and posttoolexecution events; there is no support for custom middleware or interceptors outside these hooks.

The maxtotaltokens budget is a single cap per interaction, not per step. For very long workflows, you may need to manage resume logic manually. The free tier has usage limits (not specified in the source), so heavy experimentation may require upgrading to a paid plan.

Only one source was available for this article, so some details (exact supported models, pricing, rate limits) are not independently verified. Google may update these features with future releases.

FAQs

Gemini API Managed Agents coordinate reasoning, code execution, package installation, file management, and web retrieval inside an isolated cloud sandbox using the Gemini Interactions API. A single API call launches a multi-turn autonomous loop that can use tools, run scripts, and manage files. Budget controls like maxtotaltokens prevent runaway costs, and environment persistence allows resuming paused tasks.

Sources

Latest Tech News