Designing AI Agents

Why Every AI Agent Needs Its Own Kernel and Why Only a Micro-VM Delivers That

Separate kernels isolate untrusted code that containers cannot.

· 8 min read
Cover illustration for “Why Every AI Agent Needs Its Own Kernel and Why Only a Micro-VM Delivers That”
Micro-VM Infrastructure · November 2, 2026 · 8 min read · 1,868 words

Firecracker micro-VM isolation gives each AI agent its own guest Linux kernel behind a hardware virtualization boundary. For agents that run untrusted, model-generated code, that boundary removes direct shared-kernel exposure, which container policy cannot remove. Snapshot-restore makes this separation work for idle-heavy workloads, while network controls and pre-action authorization deal with risks that kernel isolation cannot stop.

Why autonomous agents break the assumptions that containers were built on

Containers feel safe because they have been good enough for familiar microservice workloads. The application was written by a known engineer, passed CI/CD, and was not expected to behave as an adversary. Namespaces and cgroups organize its visibility and resource use within a shared operating system. An autonomous agent changes the premise because the code it executes may not exist until the model generates it.

An agent writes shell commands, installs unvetted packages from PyPI, manipulates file descriptors, and runs generated code without line-by-line human review. Its behavior is not fixed at deployment. Instructions encountered during a task can redirect what it does with source code, credentials, and network access. Consequently, an execution environment must contain behavior that the application developer neither authored nor anticipated. Being good enough for reviewed microservices does not establish that containers are good enough for agents writing their own code.

How the shared kernel becomes the decisive liability

Every Docker/runc container on a host makes system calls straight to the same host kernel. Namespaces partition visibility, while cgroups partition resources. Neither places a separate kernel between container code and the host operating system. A kernel-level vulnerability exploited from one container can therefore expose the host and, through it, other containers on the machine. The shared kernel is an architectural dependency.

Filesystem permissions and mounts control an agent's read access to sensitive files, including.env files and SSH keys. Network access can allow arbitrary outbound calls, and environment variables and /proc can reveal secrets. Namespace isolation also leaves compliance-sensitive multi-tenancy dependent on the shared host kernel remaining secure. These risks do not all originate in a kernel exploit, but direct syscall access gives untrusted code a route to the component enforcing their separation.

Behavioral safeguards cannot replace that separation either. Before the Tool Call: Deterministic Pre-Action Authorization for Autonomous AI Agents identifies a gap between probabilistic model alignment, retrospective evaluation, and deterministic enforcement before an individual tool call. An instruction to avoid dangerous actions is not a kernel boundary, and reviewing an action afterward cannot prevent its execution. For multi-tenant agents running model-generated or user-supplied code, direct shared-kernel exposure is therefore a risk to eliminate architecturally.

What runtime isolation options exist for untrusted AI agents in production

Diagram: Five Isolation Tiers for AI Agents in Production (2026). Visualizes: Visualize a ranked progression of five execution isolation levels for AI agents, moving from weakest to strongest boundary.

The five isolation tiers in production as of 2026 differ in where they place the boundary around execution. Level 1 consists of OS process sandboxes, including Seatbelt on macOS and bubblewrap on Linux. These use kernel permission primitives without virtualization and still share the host kernel. They suit trusted, developer-authored code rather than model-generated code from untrusted sources. Level 2 consists of shared-kernel containers such as Docker/runc, where namespaces and cgroups provide separation without changing which kernel receives system calls.

Level 3 changes that syscall path through a user-space kernel such as gVisor. It intercepts and re-implements system calls so sandboxed code does not call the real host kernel directly. This is a meaningful improvement over runc. For teams already using Kubernetes, it offers stronger isolation without requiring them to manage a VM fleet. Its tradeoff is syscall compatibility, since gaps in the software implementation can break some Linux software.

Level 4 introduces hardware microVMs, including Firecracker and Kata Containers, with a dedicated guest Linux kernel running on KVM hardware virtualization. A compromise of that guest kernel does not itself grant control of the host kernel. Level 5 adds confidential computing with technologies that include AMD SEV-SNP and Intel TDX, which keep memory safe even from the host OS and hypervisor. These technologies were production-ready for general workloads as of early 2026, while multi-agent and confidential GPU integrations remained less mature. The decisive kernel boundary appears at Level 4, where separation moves from software mediation to a guest kernel behind hardware virtualization.

What Firecracker actually does differently at the kernel level

Firecracker runs each microVM with its own guest Linux kernel on KVM. The agent's code makes system calls to that guest kernel. The host kernel does not receive those calls directly as it would from a containerized process. Even if an agent compromises its guest kernel, crossing into the host requires crossing a separate virtualization boundary. Guest-kernel compromise and host-kernel compromise are no longer the same event.

The virtual machine monitor remains part of the security boundary, so its design is consequential. Firecracker is written in Rust and uses a deliberately minimal device model. Its small, memory-safe codebase reduces the VMM attack surface compared with alternatives based on general-purpose machine emulators. The virtualization layer concentrates the boundary in a smaller mechanism that separates agent syscalls from the host kernel.

Firecracker also boots in approximately 125ms with approximately 5MB memory overhead per VM. Those characteristics make dedicated kernels feasible at per-agent granularity rather than only for large, long-lived workloads. AWS built Firecracker for Lambda and Fargate, where isolation is an infrastructure requirement. The distinction from Docker is structural. Docker separates workloads sharing a kernel, while Firecracker separates workloads that each have a kernel of their own.

How snapshot-restore turns per-agent microVMs from expensive to economical

Most agents are idle most of the time, so keeping a VM running for every agent spends compute on inactivity. At scale, that can dominate the bill. Firecracker's snapshot-restore API changes the resource that an idle agent consumes. Instead of occupying a live VM, the agent can remain as stored state until execution is needed again. The economic recommendation for idle-heavy workloads is therefore to snapshot and delete idle instances.

A baked snapshot captures VM state for restoration. Because restoration is fast, the agent can sleep without disrupting its work. On a bare-metal server using snapshot-restore scheduling, only the users active at a given moment need live VMs, while dormant users occupy storage. Capacity planning consequently follows concurrent activity. This makes a bursty fleet much cheaper than keeping the same fleet running all the time.

AWS Lambda MicroVMs, generally available in 2026, illustrate the production economics of running a small VM only during active periods. Docker Sandboxes, generally available in September 2026, brings microVM isolation through Docker's custom VMM to AI coding agents and likewise makes sleep important for free and low-cost tiers. The advantage is workload-dependent. Always-on microVMs lose to containers on cost for continuously active agents, while snapshot scheduling benefits the idle-heavy pattern that characterizes most deployed agents.

Persistent state: why a microVM's kernel boundary also solves the memory and continuity problem

A dedicated kernel also defines a complete execution environment that can be suspended. A microVM snapshot preserves the guest kernel's memory state and running context, while preserved filesystem state retains installed packages and working files. Together, these preserve the environment in which the agent was acting, including open file handles and in-progress work.

That continuity lets an agent pick up where it left off when it hits a rate limit, waits for human approval, times out, or is interrupted mid-task. A stateless function or ephemeral container that discards its state on termination cannot provide the same continuity by itself. Checkpointing preserves completed work and the context needed to continue. AWS Lambda MicroVMs supports state preservation for up to eight hours, retaining installed packages, loaded models, and working filesets on resume. Suspend and resume make interactive use practical without requiring uninterrupted compute.

The workspace also becomes a clearer boundary for reasoning. Removing state the agent does not need and making files easy to inspect gives it a more clearly bounded place to work as well as limiting its ability to escape. Its tools, learned context, and file history can stay with the same user across sessions. The resulting product primitive is one persistent VM per user, waking in under a second with its working environment intact.

Where kernel isolation ends and what must sit alongside it

A microVM contains execution, but it does not decide whether an action serves the user's intent. Prompt injection can still happen inside an isolated guest. If malicious instructions enter the agent's context, the agent can act on them using whatever permissions it already has. The boundary limits the reach of a compromise without preventing the instructions from influencing the model. Treating isolation as protection against prompt injection confuses containment with authorization.

Network access creates another independent exposure path. An agent that is allowed outbound connectivity can use it to send sensitive data without escaping its VM. Network namespace isolation helps separate environments, but egress allowlists remain a separate control. Tool permissions present a similar problem when an agent can transfer funds, query a database, or delegate work. A guest kernel cannot evaluate whether a technically permitted tool call violates business policy.

The OAP paper describes the need to authorize tool calls before execution. Its adversarial testbed found a high rate of successful social engineering under a permissive policy, while a restrictive pre-action policy brought that rate to zero. That result applies only to the policy and setting tested and gives no universal guarantee against prompt injection. The complementary control is synchronous evaluation of each tool call against a declarative policy before execution. Cryptographically signed audit records then make the authorization decision verifiable afterward.

Hardware microVMs contain kernel compromise, egress allowlists constrain network destinations, and pre-action authorization governs tool execution. Combining them introduces real operational work. Firecracker requires a bare-metal Linux host with KVM, plus management of TAP interfaces, IP tables, and host routing, with setup measured in days. Managed platforms take on that work by running the infrastructure behind the agent-facing API.

What "managed microVM infrastructure for agents" actually means for a development team

A managed platform provides an API for Firecracker orchestration, snapshot scheduling, networking, and persistent disk, handling hypervisor configuration for the team. The underlying isolation model must remain explicit. Each agent needs its own VM and real guest kernel, which a container or shared runtime behind a sandbox API does not provide. Persistent disk must survive sleep and redeployment so that files, credentials, and installed packages remain available on wake.

Responsiveness and billing must support the same lifecycle. Sub-second wake latency keeps sleep from degrading an interactive product, while snapshot scheduling lets idle agents pay only for storage. A deployment path from code to a live API endpoint removes manual infrastructure configuration from application delivery. Browser sessions, package installation, and arbitrary code execution must all work within the isolated VM environment for the agent to carry out tasks on its own.

Before committing, a team should check whether each agent gets its own kernel, whether snapshot-restore wakes it in under one second, and whether the cost when agents do little work is close to storage cost. Those checks connect the security claim to the operating model. As of September 2026, major agent products had moved toward one cloud compute environment per agent session. For a per-user product, the useful extension is continuity across sessions, with a dedicated environment that sleeps cheaply between interactions.

Sources

  1. Before the Tool Call: Deterministic Pre-Action Authorization for Autonomous AI Agents

More in Micro-VM Infrastructure