Choose who owns the agent sandbox

Choose the orchestration owner before choosing the model

The important decision for a code-executing Gemini agent is not simply “which model endpoint?” It is “who owns the execution sandbox and tool lifecycle?” Treat those as separate architecture decisions.

Google’s description of Managed Agents in the Gemini Interactions API puts several responsibilities behind one call: reasoning, code execution, package installation, file management, and web retrieval inside an isolated cloud sandbox. That is a useful fit when the managed environment’s boundaries and controls match the job. It also means the agent’s execution context is part of the managed-agent contract, not just a model choice.

An application-owned loop is the safer default when your system must own tool authorization, persistent state, scheduling, audit records, retries, or side-effect handling. In that design, the client invokes the model, validates each proposed tool call, runs approved work in a sandbox you control, and feeds the result back. Make the boundary explicit: model output is untrusted input to the tool runner, and a failed or partially completed tool call must have a defined stop or resume policy.

A unified route to Gemini 3.6 Flash can simplify the model invocation, but model access does not prove access to the managed sandbox. Do not infer hooks, scheduled triggers, package installation, file persistence, or identical tool semantics from the model name or an OpenAI-compatible interface. Verify each required capability with a small integration test before moving a workload.

A practical choice procedure:

  1. List the required controls: filesystem isolation, network policy, package installation, tool approval, scheduling, state retention, and auditability.
  2. Assign each control to either the managed environment or your application. If ownership is ambiguous, stop the migration.
  3. Test the exact model route with a harmless tool and a deliberate failure. Check request mapping, returned events, cancellation, and error handling—not just text quality.
  4. Keep a client-owned fallback or controlled failure for workloads whose side effects cannot be safely replayed.

The result is a reversible decision: select managed orchestration for the capabilities it demonstrably supplies, or keep the client loop when your application needs stronger ownership. Evaluate Gemini 3.6 Flash as a model within that boundary, rather than treating its availability as evidence that the boundary comes with it.

The stop/resume rule is the part I would make operational before choosing either architecture. For every tool call, record a durable attempt ID, the approval decision, the sandbox execution result, and whether the side effect is known to have committed. Then classify failures explicitly:

  • If the call is read-only and the result is absent, retry only with a bounded backoff and the same attempt ID.
  • If it can mutate external state, do not blindly replay a timeout. Reconcile using an idempotency key or a provider-side status query; if neither exists, stop and escalate for manual reconciliation.
  • Alert on rising unknown-outcome counts, repeated cancellation during tool execution, and divergence between the client audit log and the sandbox event stream.

This is also a useful managed-vs-client test: select the managed sandbox only if it exposes enough event and cancellation detail to implement those states. Otherwise, keep the execution loop in the application even if the model endpoint is identical. The model’s name or API compatibility does not establish recoverable side-effect semantics.