Brief IA

Gemini 3.6 Flash Revolutionizes Managed Agents with Advanced Hooks

💻 Code & Dev·Tom Levy·

Gemini 3.6 Flash Revolutionizes Managed Agents with Advanced Hooks

Gemini 3.6 Flash Revolutionizes Managed Agents with Advanced Hooks
Key Takeaways
1Gemini 3.6 Flash becomes the default model for managed agents, facilitating integration without code changes.
2New environment hooks allow for controlling and auditing tool calls in the sandbox, optimizing security and customization.
3OffDeal uses these hooks to automate image verification, improving the quality of business presentations.
💡Why it mattersThese innovations enhance the autonomy and efficiency of managed agents while providing greater control over costs and security.
Le brief IA que lisent les pros

Le brief IA que les pros lisent chaque soir

Les 7 actus IA du jour, décryptées en 5 min. Gratuit.

Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.

Choisis ton rythme

Gratuit · Pas de spam · Désabonnement en 1 clic

📄
Full Analysis

Introduction of Managed Agents with Gemini 3.6 Flash

The latest update to the Gemini API introduces significant advancements for managed agents, which now default to Gemini 3.6 Flash. This evolution comes with the integration of new environment hooks that allow for blocking, verifying, or auditing tool calls within the sandbox. Additionally, features such as budget controls, scheduled triggers, and free access are now available.

Managed agents in the Gemini API benefit from these new capabilities, which complement previous enhancements such as background task execution and integration with a remote MCP server. With the Gemini Interactions API, a simple API call can coordinate various operations like reasoning, code execution, package installation, file management, and web retrieval in a secure cloud sandbox. For those using an AI coding assistant, simply enter the following command in the terminal to access the Interactions API:

npx skills add google-gemini/gemini-skills --skill gemini-interactions-api

For developers using the TypeScript/JavaScript SDK @google/genai, here’s how to proceed. For other languages like Python or cURL, the Antigravity agent documentation is available.

npm install @google/genai

Gemini 3.6 Flash: The Default Model

With the antigravity-preview-05-2026 agent, Gemini 3.6 Flash is now the default model. This transition requires no code changes, and future interactions will automatically adopt it. Users also have the option to explicitly choose models by configuring agent_config.model when creating an interaction or managed agent. For reduced costs, Gemini 3.5 Flash-Lite is available, allowing for a preferred model to be set.

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",
  type: "antigravity",
  model: "gemini-3.5-flash-lite",
});

console.log(interaction.output_text);

Available Models

  • Gemini 3.6 Flash (gemini-3.6-flash, default): Designed for optimal balance between reasoning, coding, and tool usage.
  • Gemini 3.5 Flash (gemini-3.5-flash): An earlier version for general workflows.
  • Gemini 3.5 Flash-Lite (gemini-3.5-flash-lite): Offers the lowest latency and cost among the Gemini 3.5 family.

Environment Hooks: Enhanced Security

Environment hooks introduce the ability to run custom scripts before or after each tool call made by the agent in its sandbox. By adding a .agents/hooks.json file in your environment, the runtime will execute your handlers during the pre_tool_execution or post_tool_execution events.

The matcher field uses regular expressions, allowing you to target multiple tools with | or capture all calls with *:

"security-gate": {
  "pre_tool_execution": [
    {
      "matcher": "code_execution|write_file",
      "type": "command",
      "command": "python3 /.agents/hooks-scripts/gate.py"
    }
  ],
  "post_tool_execution": [
    {
      "type": "command",
      "command": "python3 /.agents/hooks-scripts/auto_lint.py"
    }
  ]
}

In this example:

  • The security-gate group executes gate.py before each code_execution or write_file call. If the script returns {"decision": "deny", "reason": "..."}, the call is aborted, and the reason is communicated in the model's context.
  • The auto-format group executes auto_lint.py after each tool to enforce consistent code style.

Hooks also support HTTP-type handlers that send POST requests to an external endpoint. For complete definitions of HTTP hooks and details on failure management, refer to the hooks documentation.

Companies like the investment bank Offdeal are already leveraging these hooks to create quality validation pipelines in production. For instance, OffDeal uses post_tool_execution hooks to automate image verification in the sandbox.

"OffDeal is an AI-native investment bank, and Archie is the AI analyst that our bankers use every day. A requirement for banker-ready presentations is to have company logos: buyer tables, sponsor columns, tombstone grids, often 30+ logos in a single presentation, each needing to be the right company, the right size and aspect ratio, contain the name, have a transparent background, and high contrast when placed on a white slide. Before agent hooks, we couldn't do this on managed Gemini 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 at the moment Archie writes his list of companies, retrieving candidates, applying pixel-level quality checks, verifying each logo with Gemini's vision, and publishing a manifest of approved files that are the only images allowed in the presentation." - Alston Lin, Founder and CTO of OffDeal

Cost Control and Automation

Free Access

Managed agents are now accessible in free-tier projects, allowing developers to experiment with agent workflows without requiring active billing.

Budget Management

Managed agents, due to their multi-turn autonomous loops, can consume significant token budgets. To prevent uncontrolled spending, it is possible to set max_total_tokens in agent_config to limit total consumption (input + output + reflection). If the agent reaches this limit, execution safely stops, and the interaction returns the status: "incomplete." The environment state is preserved, allowing for a resume from where it left off using previous_interaction_id with a 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.",
  type: "antigravity",
  max_total_tokens: 10000,
  environment: "remote",
});

Task Scheduling

Recurring tasks of agents can be automated through scheduled triggers. A trigger associates an agent, an environment, a prompt, and a cron schedule into a persistent resource that activates without manual intervention. Each execution reuses the same sandbox, ensuring file persistence between executions.

Environment Management

The Environments API allows you to list, inspect, and delete sandbox sessions from code. You can retrieve environment IDs after a disconnection or clean up sandboxes once your pipeline is complete, rather than waiting for their expiration after 7 days.

Conclusion

These updates transform managed agents into autonomous workers, cost-controlled and programmed to operate in real development environments. They enable budget compliance without requiring external orchestration. To explore further custom agent definitions, environment configurations, network rules, and advanced streaming models, check out the overview of the Gemini Interactions API and the quick start guide for managed agents.

Brief IA — L'actualité IA en français

L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.