AI 技术Google AI Blog5/10

Gemini API Managed Agents: 3.6 Flash, hooks, and more

By Mariano Cocirio

Gemini API Managed Agents: 3.6 Flash, hooks, and more
图源:Google AI Blog

AI 摘要

We’re announcing even more new capabilities in Managed Agents in Gemini API so developers can build reliable, production-ready agents.

原文正文

Gemini API Managed Agents: 3.6 Flash, hooks, and more

Managed Agents in Gemini API are getting environment hooks, model selection, and free tier access. These capabilities build on our previous release introducing background tasks and remote MCP server integration.

With managed agents in the Gemini Interactions API, a single API call coordinates, reasoning, code execution, package installation, file management, and web retrieval inside an isolated cloud sandbox.

If 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.

Below are examples using the @google/genai TypeScript/JavaScript SDK. For Python or cURL, check out the Antigravity agent documentation.

npm install @google/genaiGemini 3.6 Flash is now the default

The antigravity-preview-05-2026 agent now runs Gemini 3.6 Flash by default. No code changes are required. Your next interaction picks it up automatically.

You can also explicitly select models by passing agent_config.model when creating an interaction or managed agent. Use Gemini 3.5 Flash-Lite for lower cost, or pin to your model of preference.

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 include:

- Gemini 3.6 Flash (gemini-3.6-flash, default): Balanced model for reasoning, coding, and tool use.

- Gemini 3.5 Flash (gemini-3.5-flash): Previous generation for general agentic workflows.

- Gemini 3.5 Flash-Lite (gemini-3.5-flash-lite): Lowest latency and cost on the Gemini 3.5 family.

Environment hooks: block, lint, and audit tool calls inside the sandbox

Environment hooks let you run your custom scripts before or after every tool call the agent makes inside its sandbox. Add a .agents/hooks.json into your environment and the runtime executes your handlers on pre_tool_execution or post_tool_execution events.

The matcher field supports regular expressions, allowing you to target multiple tools with | or catch everything with *:

{

"security-gate": {

"pre_tool_execution": [

{

"matcher": "code_execution|write_file",

"hooks": [

{

"type": "command",

"command": "python3 /.agents/hooks-scripts/gate.py",

"timeout": 10

}

]

}

]

阅读原文
Gemini API Managed Agents: 3.6 Flash, hooks, and more · AI Daily