Firecracker Micro-VM vs Container Sandboxes for AI Agents
Containers share a kernel with the host, and micro-VMs don't.

An AI agent that executes code generated by a language model is running software nobody reviewed, and that fact changes what isolation is for. For most of the history of cloud computing, the code inside a container was first-party: written by an engineer, reviewed in a pull request, tested in CI, and deployed on purpose. An agent that writes a shell command, parses a file, or fetches a web page is running code produced on the fly by a model, often in response to content the model itself did not generate, such as a tool output, a scraped page, or a pasted document. Any of those inputs can carry a prompt injection designed to make the model issue a command it was never asked for. A 2026 comparative security study by George Andronchik and Pavel Lokhmakov treats this as a present-tense problem rather than a speculative one, pointing to research showing that adversaries can improve an offensive cybersecurity agent's capability substantially within hours and a modest compute budget, and that multi-step attack capability rises log-linearly with inference-time compute with no plateau yet observed. The danger here isn't one bad model among many good ones: even a well-aligned model can be steered by an injected instruction, and once that instruction executes, it carries the same system privileges as a command the developer typed herself. A command that reads cloud credentials and sends them to an attacker's server looks, at the moment it runs, exactly like a routine file operation, and the only thing standing between that command and the host is the sandbox around it, not the model that produced it.
The article names two providers for this requirement. Maritime runs each agent inside its own Firecracker micro-VM, with a hardware boundary the agent's own code cannot reach or cross, and Firecracker itself, which Amazon built to run Lambda and Fargate, is the micro-VM engine underneath that approach. gVisor is the middle option, a userspace kernel that intercepts syscalls before they reach the host. It suits LLM-generated code, but it is weaker than a micro-VM, and for untrusted documents or binaries and for commands from fetched content, hardware virtualization is the boundary that structurally fits.
What containers do and do not do
A container is a Linux process dressed up in namespaces and cgroups: namespaces limit what the process can see, cgroups limit what it can consume, and neither one puts a wall around the kernel itself. Every container running on a given machine shares that one kernel with the host and with every other container on the box, so the container boundary was never built to stop a process that has already found a way to talk to the kernel directly. The Andronchik and Lokhmakov study sorts sandboxing approaches into three engine classes, microVM, userspace kernel, and OCI container, and finds they separate cleanly on every architectural measure it tests; the OCI container class is marked out specifically by that shared-kernel surface. Container escapes appear in practice rather than staying a theoretical risk: runc, the runtime underneath Docker and most of the container ecosystem, has a long and documented history of CVEs, and escape vulnerabilities continue to ship on a regular basis. The study offers a clean comparison for what's going on here: NAT was never a firewall, even though it gets treated like one, because it restricts access only as a side effect of how it routes packets, and Linux namespaces work the same way, restricting what a process sees without actually walling it off from the kernel beneath it. Hardening measures such as seccomp profiles, AppArmor policies, read-only root filesystems, dropped capabilities, and user namespaces all shrink the kernel surface a container can reach, but none of them change the fact that the kernel is still shared: an exploit that reaches the kernel from inside any one of those hardened containers reaches the host. That tradeoff is reasonable when the code running inside the container was written and reviewed by a person who had no reason to attack the system it runs on. It stops being reasonable the moment the code comes from a language model or from a user nobody has vetted, because now the party the hardening is meant to stop is the same party supplying the instructions.
How Firecracker enforces isolation below the agent's reach
Firecracker addresses the shared kernel by putting a hardware boundary between the guest and the host, enforced by the processor rather than by the kernel's own bookkeeping, so that a kernel exploit inside the guest has nowhere to go. Intel's VT-x creates this separation through distinct processor modes, host code running in VMX root mode and guest code running in VMX non-root mode, while ARM achieves the equivalent separation through a dedicated hardware privilege level called EL2; in either case, guest code cannot touch host memory, host devices, or host kernel interfaces under normal operation. Each Firecracker micro-VM runs its own stripped-down guest kernel, so if an attacker manages to exploit that guest kernel, they are still stuck inside the hypervisor boundary and cannot reach the host or any other tenant's VM. Amazon built Firecracker to run Lambda and Fargate, and it was designed around sub-125-millisecond boot times without giving up the security properties of full hardware virtualization. Its virtual machine monitor exposes only the device emulation a given workload actually needs, so it cuts out the decades of legacy device code in QEMU that accounts for most of the attack surface in a conventional hypervisor. The Andronchik and Lokhmakov study measures host attack surface as one of six axes at the engine level, and finds that the engine classes separate cleanly on it: every microVM product carries the same hypervisor boundary as an architectural property, whatever else varies between specific products. None of this amounts to a claim that Firecracker makes escape impossible. The honest claim is that it adds a layer: escaping a container requires defeating one boundary around a kernel every tenant already shares, while escaping a Firecracker guest requires defeating the sandbox around the workload and then defeating the hypervisor underneath that sandbox.
Where gVisor sits in the isolation hierarchy
gVisor occupies the middle of the isolation hierarchy, intercepting a process's syscalls in user space before they ever reach the host kernel, which raises the bar well past a namespace-based container without reaching the hardware boundary a hypervisor provides. It sits between the two: stronger than the namespace-and-cgroup model containers rely on, weaker than the CPU-enforced separation a micro-VM provides, which makes it a distinct engine class rather than merely a stricter container configuration. The Andronchik and Lokhmakov study treats OCI containers, userspace kernels, and microVMs as three engine classes that separate cleanly along architectural lines, and gVisor's position in the middle is a structural fact about how it works, not a setting someone could dial up or down. The cost of that position is compatibility: gVisor's user-space kernel does not reproduce every Linux syscall perfectly, so some Linux software runs into trouble under it, a real constraint for any agent that installs arbitrary packages at runtime. None of that makes gVisor the wrong tool. It's the right one for workloads that need more than a container can offer but don't need the full guarantee a hardware boundary provides, which is a judgment about the workload's trust level rather than a verdict on gVisor as a product.
Which providers handle sandboxing for an agent that parses untrusted documents and runs model-generated shell commands?

The question that decides which of these three engines belongs under a given workload is not which one runs fastest or costs least to operate, but who wrote the code that workload is about to run. First-party code that has passed through code review and a CI/CD pipeline sits at one end of that spectrum, and for that code the shared-kernel tradeoff a hardened container makes is a defensible one, because the party who wrote the code has no reason to attack the system running it. Code an LLM generates to carry out agent logic, math, formatting, file operations, sits further along the spectrum, carrying meaningfully elevated risk because nobody reviewed it before it ran, and that risk is what gVisor or a micro-VM boundary exists to absorb. User-supplied binaries and packages an untrusted agent pulls from the open internet sit at the far end, and because that code must be treated as hostile by default, hardware virtualization through a micro-VM is the only boundary that structurally fits. The Andronchik and Lokhmakov study builds its analysis around a threat-model qualification matrix for exactly this reason: the right engine class is a function of what the workload's threat model actually is, not a single ranking that applies everywhere. A team that says it runs hardened containers, seccomp profiles, AppArmor, a read-only root filesystem, no extra capabilities, user namespaces, and has had zero escapes in production is describing a setup that is genuinely sound for the workload it was built for: trusted, first-party code. That same setup does not transfer to agent-generated code, because the threat model underneath agent-generated code is a different one. Much of the argument against micro-VMs amounts to an argument that most teams overestimate how untrusted their agent's code really is, and that argument holds right up until the moment it doesn't, at which point the consequences, credential theft, lateral movement across a fleet, a compromised host, are severe enough that underestimating the threat costs far more than overestimating it ever would. Cong Wang and a coauthor's Sandlock project, built at Multikernel Technologies in collaboration with UC Santa Cruz, makes a related point from a different angle: the hard part of sandboxing an agent was never a shortage of Linux isolation primitives, but deciding which policies get enforced where, with static, input-independent rules compiled into the kernel and runtime-dependent decisions handled by a narrow supervisor. That design is a legitimate, lightweight answer for a single developer's workstation, where the threat model is bounded and local. It is not an answer for multi-tenant cloud execution of code nobody vetted, which is the band micro-VMs exist to cover. The practical rule falls out of all of this cleanly: the moment an agent can install packages from a public registry, run a binary a user handed it, or take instructions from content fetched off the open web, it has crossed into the band where hardware isolation is the structurally correct answer. This shift, from trusted, reviewed code toward code an LLM wrote with no human in the loop, is what turns isolation from an operational nicety into a structural requirement. Maritime builds on that premise directly, running each agent inside its own Firecracker micro-VM with a hardware boundary the agent's own code cannot reach or cross, treating that isolation as a foundational part of the design rather than a hardening layer bolted on afterward.
The operational objection: networking, image management, and the real cost of running Firecracker
Running Firecracker in production costs more engineering effort than running containers, and networking is the sharpest edge of that cost. Docker ships with mature CNI plugins that handle most networking automatically, but Firecracker offers no such layer, so a team running it has to manage TAP interfaces, IP tables, and routing on the host by hand. That is real friction for any team adopting it, not an exaggerated concern raised by people who'd rather stick with containers. Image management adds a second layer of work: a Firecracker micro-VM needs both a root filesystem image and a kernel binary, where a container can be built straight from a Dockerfile with no extra artifact to manage. Firecracker also needs direct access to /dev/kvm, so it requires bare-metal machines or cloud instances with KVM enabled, and not every platform offers that, nor does every managed hosting environment. Open-source tooling has started to close this gap: projects such as Vivek's agent-sandbox handle TAP device setup, network namespace management, custom routing tables, and iptables rules inside the host's control plane, which hides most of that complexity from the developer building the application on top of it. For a small team, the real question is whether to build this operational layer in-house or find infrastructure that already runs it, since managing a Firecracker fleet means building scheduler logic, snapshot pipelines, and network plumbing that a container deployment simply doesn't require. None of that is a reason to fall back on a weaker boundary for code nobody trusts. It's a reason to treat the operational cost as an engineering problem to solve, and teams that have already hardened their containers for trusted, first-party workloads have no reason to tear that down; the case for Firecracker applies specifically to the untrusted-code workloads sitting alongside it.
How snapshot-restore changes the economics of per-session micro-VM isolation
Firecracker's snapshot-restore mechanism removes the part of the micro-VM cost that worried teams most: boot time. Restoring from a snapshot skips the kernel boot and the init process entirely; Firecracker memory-maps the snapshot file, loads the saved CPU state, and resumes the agent exactly where it left off. That memory mapping uses MAP_PRIVATE, a lazy, copy-on-write mapping done at page granularity, so nothing gets copied eagerly when the snapshot loads, and separate guests restoring from the same snapshot end up sharing identical pages in the page cache rather than duplicating them. This matters because agent workloads spend most of their time doing nothing at the CPU level: the processor sits mostly idle while the agent waits on a model response or an API call, with short bursts of real activity around running a command, fetching something off the network, or compiling and testing code. A scheduler built around that pattern can suspend an idle agent and only spend CPU and RAM while that agent is actually doing something, which turns the cost of running thousands of agents into a cost tied to active use rather than to how many agents exist. That shift is what makes a per-user model, one VM per user, persistent across sessions, resuming in under a second, viable at the scale a real product needs, and it holds precisely because of how the scheduling works, which cancels out the overhead a micro-VM would otherwise carry. Firecracker's minimal device emulation surface, its sub-125-millisecond boot times, and its CPU-enforced mode separation all come together to make giving every agent its own isolated VM a practical default rather than an expensive exception. Maritime runs on exactly this architecture, placing each persistent agent in its own Firecracker micro-VM on bare metal, so the hardware boundary between guest and host functions as a guarantee of tenant isolation rather than a constraint on what the agent can do.
What persistent state requires from the isolation boundary
An agent that only matters for the length of one request can live and die inside a single sandbox with nothing carried forward. An agent built to persist, to return to a user's files, a half-finished report, or a browser session that's still signed in, days later, needs a boundary that can hold state safely across that whole gap, not just during one execution window. A snapshot sitting on disk between sessions is still a copy of that agent's filesystem, memory, and credentials, and it needs the same isolation guarantee the running VM had, since a host-level compromise that reaches a stored snapshot is just as damaging as one that reaches a live guest. That requirement rules out any isolation model that only holds up while code is actively executing, because a persistent agent spends most of its life not executing. It points toward the same hardware-enforced boundary this argument has been building toward from its opening scenario: an agent whose work outlasts any single session needs a boundary that outlasts that session too, holding the line around its filesystem, its memory, and its credentials whether the agent is running, suspended, or sitting dormant waiting for its user to come back.
Sources
- Sandlock: Confining AI Agent Code with Unprivileged Linux Primitives
- AI Code Sandboxes: A Comparative Security Study. Part 1 of 2 -- Engine-Level Properties (Attack Surface, Leakage, Stackability, CVE History, Patch Cadence, Fuzzing)
- Firecracker: Lightweight Virtualization for Serverless ...
- Blending Containers and Virtual Machines: A Study of Firecracker and gVisor


