AI agent containment: eight gates beyond a sandbox

OpenAI published real failures found while testing frontier-model containment, and Google described an agent-compute architecture built around microVMs, zero secrets, and mediated networking. This guide turns both publications into eight verifiable gates for teams allowing an agent to execute code, browse, or call external systems.

AI agent securityAgent sandboxZero trustCode execution
Wasyra Lab
AI systems and operations architecture
Published
min read
7 min read
Categoría
AI Systems
8gates for containing agent execution
Illustration of an agent separated from its execution chamber by isolation layers, a network proxy, external credentials, monitoring, and an emergency stop.

Chapter 01

Why is a sandbox not enough to contain an agent?

A sandbox covers only one boundary; an agent with code, a browser, or tools crosses several. Reliable containment requires assuming the model can fully control its execution environment while still preventing it from stealing credentials, reaching unauthorized destinations, moving into another workload, or continuing when monitoring fails. On October 23, 2026, two days before this publication in America/Lima, OpenAI explained that its red-team agents found microVM escapes, indirect paths to the internet, and side channels between isolated tasks. On the same day, Google described Agent Compute Engine with a microVM per session, secrets kept outside the guest, mediated networking, and separation between the harness that decides and the sandbox that executes. The publications do not prove a universal solution or equivalence between products. Together, they do raise the bar: the question is no longer whether a container exists, but which independent control limits damage when each inner layer fails.

OpenAI reported that a DNS configuration allowed a model to reach the internet during training on September 20. It stopped frontier workloads, strengthened controls, and then launched a high-compute red-team campaign. Agents found previously unknown vulnerabilities and weak configurations across sandboxes, internal services, and network perimeters. The operating lesson is not that one brand failed: it is that an authorized capability such as name resolution, metrics delivery, or package download can become a transitive bridge to a forbidden destination.

For a product team, the consequence is concrete. If an agent processes untrusted email and can also execute a shell, read environment variables, and call APIs, prompt injection does not need to defeat every defense. It only needs one viable chain across context, tool, secret, and egress. The architecture must break that chain at several points and prove it with adversarial tests rather than a temporary absence of incidents.

Chapter 02

How defense in depth works

The model, harness, and execution environment are not the same thing. The model proposes steps; the harness retains the goal, policy, and authorization; the sandbox runs commands or a browser. Separating them makes it possible to record which action was requested and prevent a compromised process from rewriting the decision logic. Google describes this split as brain and hands. OpenAI uses restricted containers inside microVMs for Linux tasks and adds network and cloud perimeters around them. In both cases, the hypervisor or runtime is one barrier, not the whole system.

Outer layers must survive root access inside the guest. Long-lived secrets stay outside; a gateway exchanges ephemeral identity for an allowed call only after validating session, user, tool, and destination. Networking defaults to deny or mediates every outbound request. Storage and memory are not shared without need. Telemetry observes behavior from outside the box, and a stop control can revoke identity, block egress, and destroy the session without asking the agent to cooperate.

Each layer answers a different failure and needs its own evidence
LayerFailure it limitsMinimum test
Sandbox or microVMEscape to host or another tenantSystem-call, mount, and lateral-movement attempts
Identity brokerCredential theft or reuseGuest root with no recoverable secret
Egress gatewayDirect or transitive exfiltrationDNS, redirect, SSRF, and unapproved destination
Monitor and stop controlPersistence after an anomalyAutomatic kill with verifiable revocation

Chapter 03

Hypothetical example: support that inspects files

Imagine a support agent that receives a ZIP attachment, reproduces an error, and proposes a patch. This example is hypothetical. The file enters as untrusted content. An ephemeral session opens it inside a microVM with no credentials, a temporary filesystem, and resource limits. The harness allows local tests but not publishing. If the agent needs to inspect a dependency, it requests an explicit destination from the gateway; the proxy validates domain, method, size, and redirects. To read a ticket, it receives a narrowly scoped token that expires with the task and never enters the guest as an environment variable.

The patch leaves as an artifact rather than an authorized commit. A scanner checks binaries and secrets; CI rebuilds from an image pinned by digest; a human or separate policy approves the merge. If the attachment tries to induce an external call, egress policy blocks it even if the model complies. If the process exploits the runtime, it finds no persistent keys. If it tries to use DNS as a tunnel or communicate with another session, the perimeter and monitor produce a signal that stops the workload. Security does not depend on the model recognizing the attack.

Treat everything inside the sandbox as potentially compromised. Authorization and secrets must live outside that trust boundary.

Chapter 04

Eight gates before allowing execution

The eight gates cover different boundaries. Passing one does not compensate for another being absent, and every gate must produce repeatable evidence in CI or a red-team environment.

First, separate harness from execution: the guest cannot edit policy, goal, or audit records. Second, use strong per-session isolation and destroy state except for explicitly exported artifacts. Third, keep zero long-lived secrets inside the guest; deliver ephemeral, task-bound identity. Fourth, turn generic tools into narrow capabilities: reading one ticket does not imply listing all tickets, and proposing a patch does not imply pushing it.

Fifth, govern egress at more than one layer: DNS, IP, URL, redirects, protocols, and services that fetch on the agent's behalf. Sixth, isolate memory, caches, queues, and storage across sessions to prevent accidental or deliberate lateral communication. Seventh, monitor from outside with correlation across tool call, process, network, and artifact, and define signals that stop execution automatically. Eighth, red-team while assuming inner layers have already failed; reproduce findings, verify fixes, and preserve regressions in the suite.

  • Harness separated from the hands
  • Strong, ephemeral isolation
  • Zero persistent secrets in the guest
  • Minimal tool capabilities
  • Mediated, default-deny egress
  • State isolated across sessions
  • External monitoring and automatic stops
  • Continuous red teaming with regressions

Chapter 05

How do you evaluate agent containment?

Start with observable objectives rather than a generic audit. The agent must not reach a team-controlled external server, read cloud metadata, recover a long-lived secret, access the host, mount foreign storage, exchange a synthetic value with another session, or continue after a stop signal. Run each objective from the normal path and from a compromised starting point. OpenAI also tested the perimeter while assuming the agent had already escaped the sandbox and controlled the host, a useful practice for learning whether outer layers are truly independent.

Measure prevention, detection, and response separately. Prevention asks whether the action occurred. Detection measures whether telemetry recognized it and with what delay. Response confirms that identity, network, and compute were revoked. Keep an evidence package containing image version, policy, model, adversarial prompts, traces, and outcome. When the runtime, kernel, sidecar, proxy, model, or tool changes, rerun affected cases. A declining findings curve can show red-team learning, but it does not prove the absence of unknown paths.

Chapter 06

Limits, cost, and platform decisions

More isolation adds cost, latency, and complexity. A microVM per session needs warm pools or efficient suspension; a strict proxy breaks tools that discover destinations dynamically; zero secrets requires a broker, workload identity, and per-action policies; useful snapshots expand the data surface. The right design depends on impact. An assistant that only summarizes text does not need the same boundary as an agent with a shell, an authenticated browser, and production access.

Avoid two simplifications. “It runs on Kubernetes” does not prove isolation: it shares a kernel unless the runtime adds a barrier, and policy can open hostPath, capabilities, or networking. “It has no internet” is also insufficient: DNS, metrics, authentication, registries, proxies, and services vulnerable to SSRF can become indirect egress. Document transitive dependencies and test each one. Google notes that enabling API access or sidecars requires changing secure defaults; every exception needs an owner, purpose, scope, and regression test.

Chapter 07

Implementation plan: reduce blast radius first

Before buying a platform, draw the path of one action: incoming content, harness decision, executed process, identity used, destination called, persisted state, and final effect. Mark where untrusted input can influence each step. Then remove permissions that are not part of the use case and move secrets outside the guest. Those two decisions often reduce more risk than adding another content classifier because they limit what happens even when the model is wrong.

Then implement mediated egress, ephemeral sessions, external logs, and a rehearsed stop. Build a small adversarial corpus covering indirect prompt injection, hostile files, redirects, DNS, metadata attempts, and cross-session communication. Promote the agent only when all eight gates have evidence and there is a degraded path without autonomous execution. If your team needs to turn a tool-enabled prototype into an operable architecture, Wasyra can help model boundaries, build the pilot, and leave verifiable controls in place without confusing autonomy with unlimited access.

Written by

Wasyra Lab

AI systems and operations architecture

Wasyra Lab publishes practical frameworks for designing AI agents, automations, and operating flows that survive production.

AI AgentsGuardrailsOperations
More from this author

Series

AI systems that actually reach production

A series on agents, copilots, and guardrails for bringing AI into real work without breaking trust or operations.

Posts in this series

Keep reading

Keep reading