Legal AI infrastructure for firms
AI RFP discovery and response drafting
Automatic.coBusiness process automation
Secure AI virtual data rooms
Inside the Sandbox That Keeps Your AI Agent From Wrecking Production
A Docker container is not a sandbox. With the default seccomp profile left in place, an agent process still reaches most of the kernel's 300-plus syscalls, which is how runc container escapes like the November 2025 runc flaw (CVSS 7.8) keep working against production clusters.
What follows is the runtime isolation stack an AI agent needs before you let it run arbitrary shell, Python, or Playwright actions.
The pieces are Firecracker microVMs, gVisor's user-space kernel, nsjail-style namespace jails, and the ephemeral browser containers wrapping Playwright and CDP. Each covers a different slice of the kernel attack surface, and the useful question is where each one stops being enough on its own.
What an Agent Sandbox Draws a Line Around
A sandbox is not about preventing the agent from being wrong. It is about containing an attacker who has already achieved prompt injection or tool poisoning inside the agent loop. The OWASP Agentic AI Top 10, released December 9, 2025 after review from NIST and the Alan Turing Institute, puts tool misuse and privileged-action abuse near the top for exactly this reason. Once the loop is holding malicious instructions, the kernel becomes the perimeter.
That perimeter sees more traffic than it should. Independent scans of MCP tool servers report command injection and path traversal in a majority of tested implementations, which is what any agent sandbox is budgeting against. Approvals and RBAC on the agent's tool graph narrow what can be called; the sandbox decides what happens when it is called anyway.
| Scan (sample) | Path traversal | Command injection | SSRF | Critical vulns | Tool poisoning | Any finding | |
|---|---|---|---|---|---|---|---|
| Endor Labs (2,614) | 82 | 0 | 0 | 0 | 0 | 0 | |
| Equixly | 0 | 43 | 30 | 0 | 0 | 0 | |
| BlueRock (7,000+) | 0 | 0 | 36.7 | 0 | 0 | 0 | |
| Enkrypt AI (1,000) | 0 | 0 | 0 | 33 | 0 | 0 | |
| Hasan et al. (1,899) | 0 | 0 | 0 | 0 | 5.5 | 0 | |
| AgentSeal (1,808) | 0 | 0 | 0 | 0 | 0 | 66 |
Firecracker, gVisor, and nsjail Are Not Interchangeable
Three Linux isolation layers show up in agent platforms. Firecracker is a KVM microVM runtime that boots a minimal guest kernel in roughly 125 ms with under 5 MiB of memory overhead per instance, so the agent and its tools run inside a real hardware-virtualization boundary. gVisor replaces the host kernel for the sandboxed process with a user-space reimplementation called the Sentry and interprets syscalls there, exposing only a small, fixed set to the host. nsjail is a thin wrapper around Linux namespaces, cgroups, and seccomp-bpf, with no additional kernel and no hypervisor, just stricter defaults than a container.
The attack surface each exposes is measurable. Firecracker reduces it to the KVM interface. nsjail reduces it to whatever seccomp allows, which still routes real syscalls to the host kernel. gVisor sits in between: no syscall from the sandboxed app is passed through verbatim.
Performance is why most platforms mix them. gVisor pays what fly.io describes as a syscall tax on I/O-heavy workloads, which hurts code-execution agents that spawn many short processes. Firecracker avoids that cost but needs its own orchestration layer. nsjail is cheap and slots into a Kubernetes pod, but it inherits every kernel CVE your host runs. For anything resembling production AI development at scale, a common pattern is nsjail inside a Firecracker microVM: namespace jail for policy, microVM for the real blast-radius boundary.

Egress Rules Do More Work Than Any Isolation Layer
The common failure mode is not a kernel escape. It is the sandbox doing exactly what an injected prompt asked, including reaching outbound. The Brave team's August 2025 disclosure against Perplexity's Comet browser agent chained a Reddit spoiler tag into a full account takeover: the agent read the victim's email address, triggered a one-time passcode, read it from the inbox, and posted both back as a comment. No container escape required. The sandbox was happy to drive the browser.
The runtime answer is not to trust the agent's intended destination. Every outbound connection goes through an egress proxy that enforces an allowlist by hostname, port, and method, with DNS resolution done inside the proxy rather than in the sandbox. Block the cloud metadata endpoint at 169.254.169.254 and the IPv6 equivalent, plus any RFC1918 range the agent has no reason to reach. Treat git clone, pip install, and headless-browser fetches as separate egress identities with separate allowlists. This is the same logic as the network edge in a zero trust hybrid cloud design, applied to a process whose lifespan is measured in seconds.
Browser Automation Needs Its Own Isolation Stack
Playwright and CDP add two problems a code sandbox does not solve. The browser renders untrusted HTML and executes untrusted JavaScript on the agent's behalf, and it carries session cookies for whatever the agent is logged into. A compromised page can read those cookies, drive the DOM, and emit outbound requests inside the browser's origin.
The workable pattern is one browser process per task, inside its own container or microVM, with no persistent profile, no saved credentials, and no network beyond the egress proxy. Credentials get injected as short-lived tokens when needed and revoked when the task ends. Downloaded files land in a scratch mount that is destroyed with the container. For agents that must log in, delegate authentication to a broker service that holds the session and exposes only a scoped token, so the browser container never sees the real cookie. This is operationally similar to what agents touching ERP and CRM already do for API calls.
Filesystem, Resource Ceilings, and the 24-Hour Question
Long-running agent sessions are now routine. Public sandbox platforms report runtime durations up more than tenfold year over year as agents moved from one-shot code execution to multi-hour browsing and research runs. That changes what the sandbox has to survive, because a malicious payload has longer to escalate and more sessions to piggyback on.
Filesystem policy is where most leaks start. Mount tool-specific directories read-only, mount a per-task scratch volume read-write, and keep credentials in a separate mount that unmounts before the agent process is ever exec'd. Resource ceilings on CPU shares, memory, pids, and wall-clock time keep a wedged or malicious tool from pinning a host. The NVIDIA sandboxing guidance recommends fresh user confirmation for genuinely dangerous actions and treating VM-based sandboxes as disposable on a weekly cadence; teams running agents in production usually shorten that to per-task. Budget for the per-session cost of that disposal when you size an agent build.
Choosing Where to Put the Boundary
Pick Firecracker if the workload is adversarial — multi-tenant code execution, untrusted repos, public MCP tools — and you can afford a microVM orchestration layer. Pick gVisor if the workloads are moderately risky, mostly compute-bound, and have to fit inside an existing container platform; accept the syscall tax. Pick nsjail only as a hardening layer inside something stronger, not as the perimeter. For browser agents, run an ephemeral container per task behind an egress proxy regardless of what wraps the code tools, because the browser's threat model is different from the shell's.
If none of those shapes fit the use case, narrow the agent's tool graph until one does. A smaller surface behind a strict broker beats a permissive sandbox every time.
