Gemini API の Managed Agents で、エージェント antigravity-preview-05-2026 の既定モデルが Gemini 3.6 Flash になった。コード変更は不要で、次の interaction から切り替わる。agent_config.model で Gemini 3.5 Flash や 3.5 Flash-Lite を明示指定もできる。

#environment hooks

環境に .agents/hooks.json を置くと、サンドボックス内の tool 呼び出しの前後でカスタムスクリプトを実行できる。pre_tool_execution / post_tool_execution と正規表現の matcher で対象ツールを絞る。decision: "deny" を返すと呼び出しをスキップし、理由をモデル文脈へ渡す。command のほか http ハンドラもある。

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

#コスト制御と自動化

  • 無料枠プロジェクトでも Managed Agents を試せる
  • agent_config.max_total_tokens で入力・出力・thinking の合計を上限できる。到達時は status: "incomplete" で止まり、環境状態は残るので previous_interaction_id で再開できる
  • スケジュールトリガーでエージェント・環境・プロンプト・cron を束ね、同じサンドボックスを再利用して定期実行できる
  • Environments API でサンドボックスの一覧・参照・削除ができる(既定 TTL は 7 日)
ts
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",
});

#参考文献