The word microVM now shows up wherever people choose a sandbox for an AI coding agent. Anthropic's page on sandbox environments for Claude Code names Firecracker, and Docker builds its agent sandboxes on microVMs. This post explains what the word means, how it differs from a container, and what it still leaves for you to set.
What a microVM is
A virtual machine runs its own operating system kernel on virtual hardware, and the processor's virtualization features keep it apart from the host. A microVM is the same thing with almost everything removed. Firecracker's README describes it as running workloads in "lightweight virtual machines, called microVMs", through a monitor that uses Linux's KVM and leaves out unneeded devices to shrink the memory footprint and the attack surface.
How little is left is the point. Firecracker's design document lists what a guest sees: a network device, a block device, a vsock socket to the host, a serial console and part of a keyboard controller, used to reboot.
Each microVM is one Firecracker process. Anthropic's secure deployment guide says it can boot a VM in under 125 ms with less than 5 MiB of memory overhead.
How it differs from a container
Docker's Engine security page explains that a container is a set of namespaces and control groups: its processes cannot see the host's, but every system call they make goes to the host's own kernel. One kernel bug can then be a way out. The gVisor project says it in five words:
Containers are not a sandbox.gVisor, What is gVisor?
Between the two sits gVisor itself, a kernel written in Go that runs in user space and answers the container's system calls before they reach the host. The four options line up like this:
| Option | Kernel the code talks to | What a way out needs | Examples |
|---|---|---|---|
| Container | The host's | One bug in the host kernel | Docker, Podman |
| User-space kernel | gVisor's, in a normal process | A bug in gVisor, then the narrower host interface behind it | gVisor's runsc |
| MicroVM | Its own guest kernel | A bug in the monitor or its few devices | Firecracker, Kata Containers, libkrun |
| Full VM | Its own guest kernel | A bug in the hypervisor or a larger set of emulated devices | QEMU, a cloud instance |
Anthropic's guide adds a fair warning: VMs are not automatically more secure than gVisor, because a VM's security depends on the hypervisor and its device code. That is why a microVM keeps its device list short.
The line between the two is blurring. Kata Containers runs container images in lightweight VMs that "feel and perform like containers", and can use Firecracker underneath. Apple's Containerization package runs each Linux container in its own lightweight VM on Apple silicon.
You keep your images and commands, and gain a kernel boundary.
Why AI agent sandboxes use them
An AI agent runs code nobody reviewed first: a test script, a package's install step, a command a README suggested. Anthropic's secure deployment guide spells out the case: if prompt injection gets an agent to run malicious code in a container, that code can attempt kernel exploits. The wrong command from the wrong text is the first item in our list of AI agent security risks.
A microVM turns that kernel exploit into a much harder job. Anthropic's sandbox environments page calls a dedicated VM the strongest separation, and recommends it when your policy requires kernel-level separation between the agent and the host.
There is a second reason. Agents often need to build and run containers, and the easy way is to hand them the host's Docker socket.
Docker's own security page says whoever controls the daemon can mount your host's root folder into a container and alter it "without any restriction". Our notes on macOS Seatbelt list the same socket as a hole in that sandbox.
Docker Sandboxes give each agent a microVM with its own Docker daemon instead, so the agent builds images without touching yours.
What a microVM does not decide
A kernel boundary answers one question: can code inside take over the machine. Most of what goes wrong with an agent is a different question, about what you handed it.
Shared folders. A sandbox is only useful if the agent can work on your project, so the project goes in.
Docker's Sandboxes architecture page says a mounted workspace shows your actual host files, with changes instant in both directions. Whatever the agent writes there, a script or a config file included, is on your disk and runs the next time you do.
The same page describes a clone mode: your repository mounted read-only, the agent working in a private clone.
The network. The design document is blunt: Firecracker "does not perform any network traffic filtering", and guest traffic should be filtered on the host. A microVM with an open network can still send your data anywhere.
Docker Sandboxes route all outbound TCP through a proxy on your host that enforces a policy; Anthropic's guide goes further, with a VM that has no network interface at all and talks only through vsock to a proxy that allows named hosts.
Our post on whether Claude Code can access the internet covers why a host list matters more than any single tool rule.
Secrets inside. A token in the environment or a mounted ~/.aws folder is as readable inside a microVM as outside it. Anthropic's sandbox environments page warns that any approach that allows network egress can still leak data the agent can read.
Devices you add. Every shared folder, socket or GPU is a path through the boundary. libkrun's README carries the caution in one line: "The VM boundary does not restrict host resources exposed through devices."
What goes to the model. The agent still sends the files it reads and the output of its commands to its model provider. Our post on whether Claude Code is private covers that part.
"A microVM makes the agent safe."
Revision 1: it makes a kernel escape much harder. What the agent reads, where it sends and what it holds are set somewhere else.MicroVMs you can run today
Firecracker runs on Linux hosts with KVM. Its design document says to start it through its jailer in production, which drops privileges and confines the monitor process itself.
Kata Containers plugs microVMs into container tooling and Kubernetes. It needs hardware virtualization: Intel VT-x, AMD SVM or Arm's hypervisor extensions.
libkrun is a library that starts a minimal VM through KVM on Linux and Hypervisor.framework on Apple silicon Macs. Podman uses it through crun with --runtime=krun.
Apple's container tool runs Linux containers as lightweight VMs on a Mac, built on Containerization. Its README says it needs Apple silicon and is designed for macOS 26 or later.
Docker Sandboxes run AI coding agents in microVMs through the sbx CLI, locally or on Docker's cloud. Docker's docs say the CLI and local sandboxes are free, including for commercial work.
How to choose for your agent
Set the folder, the hosts and the secrets first. A container with a clone of the project, no tokens and a short host list holds more than a microVM with your home folder mounted and an open network. The kernel boundary comes on top of those, never instead of them.
Pick a microVM when the code is untrusted or the machine is shared. An agent that reads issues and pull requests from strangers, as in our post on running Claude Code in GitHub Actions, or many agents on one host, is the case Firecracker was built for: the first feature its design document lists is running workloads from different customers on the same machine.
Keep the host's Docker socket out. Give the agent a daemon of its own inside the boundary, or no daemon.
Test the refusals. Ask the agent to read a file outside the project and to fetch a host you did not allow. Both should fail.
Then decide what agentic AI security means for your team: which directories, which hosts, which keys, and who approves more.
A side note on how we do it
We build Fenzi, which starts the agent in an OpenShell sandbox with a short host list and a placeholder in place of the real key; on a Mac that sandbox runs inside a Linux VM, either the runtime's MicroVM driver or the VM of Docker Desktop or colima, as the platforms table shows. Any of the microVM tools above, given a host list and no secrets, can answer the same question.
So, do you need one?
A microVM gives an AI agent its own kernel at close to the cost of a container, which makes it the strongest boundary that still starts fast, and the right one for untrusted code or shared machines. It is one boundary of several: the folders you share, the hosts it can reach and the secrets inside are still yours to set, and a container that gets those right beats a microVM that does not. Anthropic's secure deployment guide is the best next read: it puts containers, gVisor and microVMs side by side, with the network and credential setup each one needs.