VM Sandboxes vs Container Sandboxes for Autonomous Agents
Containers share the host kernel, and microVMs don't, which matters for agents.

For autonomous agents executing untrusted, AI-generated code, VM sandboxes versus container sandboxes is a question about the kernel boundary before it is a question about speed. Containers limit what workloads can do while they share a host kernel. MicroVMs give workloads separate guest kernels. Shared and separate kernels contain different threats, while startup latency, state persistence, and operational controls affect protection in production.
Why the kernel boundary is the right frame for evaluating agent sandboxes
An autonomous agent can run model-generated code, call APIs, read files, and manage workflows across infrastructure. Demonstrated attack patterns include tool poisoning through malicious MCP tools, prompt injection leading to filesystem access, credential theft through MCP, and lateral movement across internal networks. Security therefore depends on both whether a script behaves correctly and what a redirected agent can reach.
Agent processes inherit ambient authority through database credentials, network access, and filesystem permissions from their environment, whether or not a particular operation needs them. Traditional RBAC cannot tell a legitimate request from a confused-deputy attack when both come through the same authorized role. What remains if that authorized process turns against its environment? Namespaces, cgroups, seccomp, and policy rules restrict its behavior, but a shared kernel remains reachable through kernel-level vulnerabilities. A guest-kernel boundary enforced by hardware changes where such a compromise can spread.
What containers actually isolate and where their boundary ends
Containers use Linux namespaces to limit what a process can see of the filesystem, network, and process table, while cgroups cap the resources it can use. Neither of these gives the workload its own operating-system kernel. These controls can restrict filesystem access and network egress under normal conditions, but the container’s syscall surface still belongs to the host kernel. That is the boundary’s structural limit. An exploitable kernel vulnerability can provide a path beyond the restrictions imposed on the process.
Hardening lowers the risk, but workloads still depend on the same kernel. This distinction becomes sharper when an agent needs to spawn child containers through Docker-in-Docker. Docker’s 2026 sandboxing comparison acknowledges that the pattern requires a privileged outer container, dramatically weakening isolation. Secret exposure through environment variables or /proc and cross-tenant data leakage introduce further concerns beyond the container’s visible filesystem. For low-risk workloads, a hardened shared-kernel environment can be appropriate. For mutually untrusted tenants, however, the question is whether they should share the component whose compromise can defeat their separation.
What LLM agents can actually do when they find themselves inside a container
SANDBOXESCAPEBENCH, published at ICML 2026 by researchers from the University of Oxford and the UK AI Security Institute, evaluates whether LLMs can discover and exploit container escape paths autonomously. It uses a nested sandbox architecture to measure that capability safely. Its tasks span orchestration weaknesses, runtime flaws, and kernel-level exploits, including RBAC misconfiguration, dirty cow, and BPF privilege escalation. The benchmark starts with shell access inside a container. In agent deployments, that access is often granted by design.
The benchmark finds that LLMs can identify and exploit vulnerabilities when those vulnerabilities are present. Claude Mythos Preview saturates the public benchmark, prompting revised findings in the paper. An agent must be treated as capable of using an available escape path. The authors address a gap between the well-documented catalogue of container vulnerabilities and systematic evaluation of whether agents can exploit them.
Capability alone does not establish intent, but indirect prompt injection can supply motivation by redirecting an otherwise aligned agent toward unsafe tool use. System cards also document opportunistic infrastructure exploration and exploitation of production misconfigurations. Consequently, a shared-kernel deployment cannot rest on the assumption that its agent will never attempt escape.
How microVMs close the kernel gap that containers leave open
A microVM gives each workload its own guest kernel rather than exposing the host kernel directly to the workload’s system calls. A successful compromise of the guest therefore does not directly compromise the host or neighboring virtual machines. Where a container restricts access within a shared kernel, a microVM inserts a separate kernel behind a hardware-enforced boundary.
Docker’s comparison describes how a microVM reduces the machinery associated with a full VM. Minimal virtual hardware, without USB or PCI buses, and a boot path that bypasses BIOS/UEFI reduce device-emulation overhead and startup latency. This preserves the separate guest kernel while making the environment more practical for short execution steps.
Vercel Sandbox provides a production example through Firecracker-based environments for AI-generated code on Vercel’s Hive infrastructure, now part of the unified Fluid compute platform. The benchmark’s authors also describe inference providers that use microVMs or userspace kernels, while much of the open-source agent ecosystem keeps standard containers for their performance and compatibility. Those alternatives are not interchangeable. Firecracker, gVisor, and full VMs occupy different positions on the isolation spectrum, and gVisor is not itself a microVM.
Where gVisor sits between the container and microVM tiers
gVisor interposes a user-space application kernel between container processes and the host kernel. It implements a substantial portion of the Linux kernel API, intercepting and handling system calls before they reach the host. That leaves less of the host kernel’s attack surface exposed without the need for a full guest kernel. It is a distinct architectural tier. Google Cloud Run’s first-generation execution environment uses gVisor sandboxes.
Because gVisor does not implement every Linux syscall, agents that rely on system packages or low-level operating-system operations can run into gaps. It fits bounded, multi-tenant container workloads where shared-kernel risk is unacceptable but microVM overhead is too high. Its separation is stronger than a standard container’s without providing a microVM’s guest-kernel boundary. The tiers can also be combined, with gVisor intercepting syscalls inside a microVM for defense in depth.
Why startup latency determines whether strong isolation is actually used in production
Architectural strength is only useful if the execution loop can afford it. An agent generates a tool call, executes it, observes the result, and generates the next call. Provisioning that takes tens of seconds can overwhelm the time budget of an individual step. In the past, these delays have pushed teams away from full VMs toward containers or running code without isolation. Slow protection creates pressure to bypass it.
MicroVM design addresses that pressure by reducing boot and device-emulation work. Firecracker targets sub-second boot times, while Blaxel reports sandbox resume in under 25ms with filesystem, memory, and running processes intact. These describe different operations, so a boot target and a resume figure are not interchangeable measurements. Both nevertheless address the same operational constraint. Can the sandbox become available quickly enough that developers leave it in the execution path?
How stateful execution changes the isolation calculus for long-running agents
For agents that run for hours or days, availability includes keeping their work between steps. The runtime must provide state persistence, checkpoint recovery, and cross-step resource management so that each tool call is part of the ongoing work. Losing state creates its own security pressure. Teams may move intermediate context into shared external storage or rerun work outside the sandbox, reintroducing exposure that the execution boundary was intended to contain.
Firecracker’s snapshot-restore mechanism preserves memory and device state so that a paused sandbox can resume in milliseconds. Blaxel implements perpetual standby on higher quota tiers, with only snapshot-storage billing during standby. Starter tiers instead enforce deletion after a set time limit. Resume restores the filesystem, memory, and running processes intact, keeping accumulated execution context within the sandbox.
The broader runtime still needs a harness, a session record, a sandbox, a checkpoint, and a trace. State persistence connects those primitives across the execution horizon. It is therefore part of the isolation design.
How computer-use agents raise the isolation stakes beyond code execution
Computer-use agents bring the same risks to running applications as to running scripts. An OS-level desktop agent can interact with native clients, file dialogs, terminals, and a browser, while a browser-level agent stays within a narrower context. Their potential reach is different. For the desktop agent, direct execution places the user’s broader application environment within the consequences of a mistake or compromise.
Anthropic’s Claude Cowork runs sessions in the cloud by default and previously used a local virtual machine, with access to designated folders on the user’s machine. That architecture separates agent execution from direct operation on the everyday PC. Browserbase’s documentation describes a dedicated virtual machine for each browser session.
Sandboxing limits the consequences of successful prompt injection. It does not prevent the injection itself. For that reason, input validation, tool-call allowlists, and output auditing must accompany the kernel boundary. The two defenses address different failures, one governing what the agent is induced to do and the other restricting where its actions can spread.
What the layered approach looks like and when each isolation tier is the right match
The practical decision framework begins with the workload’s threat model. OS process sandboxes such as Seatbelt on macOS and bubblewrap on Linux fit local filesystem restrictions for a trusted agent producing code. Their scope is narrower than the whole toolchain. They do not sandbox MCP servers, file tools, or hooks, so their presence does not establish that every route to execution is constrained.
Hardened containers fit developer-authored code, low tenant counts, and environments where kernel exploits are outside the threat model. gVisor fits bounded multi-tenant workloads where kernel escapes are within the threat model, microVM overhead is unacceptable, and syscall compatibility gaps are tolerable. Neither choice should be assessed in isolation from those conditions. The same runtime can be suitable for one workload and insufficient for another.
For multi-tenant execution of untrusted AI-generated code, cross-tenant leakage concerns, or agents with network egress, the stronger match is a microVM. The strongest practical pattern then places restricted containers inside it. The microVM supplies the kernel boundary, while the container scopes capabilities and resources within the guest. This also requires attention to both the agent process and the code it launches. Limiting the agent while giving the code it generates full authority moves the risk to where that code runs.
Enterprise compliance requirements that the kernel boundary directly enables
Enterprise compliance also requires tenants to be kept separate, activity to be open to audit, and data boundaries to be controlled. A microVM provides a structural foundation for that separation, but an infrastructure boundary is not a complete compliance program. SOC 2 Type II establishes that a vendor’s internal controls were independently audited and operated over a defined period. It does not show whether agent actions leave a regulatory audit trail that meets the rules or how a model provider keeps data. The buyer remains responsible for its use of the service.
Other obligations operate above the execution boundary. EU AI Act Article 50 became enforceable on 2 August 2026 and requires disclosure for systems interacting directly with people unless their AI nature is obvious from the circumstances. HIPAA Safe Harbor also depends on how data is handled. A clinical dataset with full ZIP codes and dates of birth is still PHI under that method, even if it is described as deidentified. Guest isolation can limit host exposure, but it cannot make such data safe to disclose.
For most teams, purpose-built, compliance-certified sandboxes are more practical than custom compliance infrastructure unless AI infrastructure is a core product. Access controls, audit logging, and output review remain necessary. SOC 2, HIPAA, and GDPR obligations therefore cannot be discharged by choosing a runtime alone. When the required separation calls for independent guest kernels, however, container hardening cannot provide them. Compliance controls must show that the intended boundary was enforced, and that boundary gives the controls a clear separation to govern.


