MicroVMs explained: what they are, how they differ from containers, and when to use one
What a microVM is, how it compares with containers and ordinary VMs, the main options (Firecracker, Cloud Hypervisor, QEMU microvm, Kata Containers, AWS Lambda MicroVMs, Docker Sandboxes) and what it takes to run them for AI agents.
By Designing AI Agents Editors · Updated
A microVM is a virtual machine with almost everything a general-purpose VM carries stripped out. It still boots its own guest kernel on hardware virtualization, so the code inside it is separated from the host the way a full VM is, but it emulates only a handful of devices, skips the legacy PC hardware and firmware, and is started and stopped through an API. The result is a VM light enough to create per task, per user or per function, which is the job containers are usually given.
This guide explains what makes a VM "micro", how microVMs compare with containers and ordinary VMs, the projects and services people mean when they say microVM, and what it takes to run them. It is written for teams deciding how to isolate AI agents and other untrusted code, but the basics apply to any multi-tenant workload. For the wider choice of sandbox, see the AI agent sandbox guide.
What makes a VM "micro"
There is no formal standard for the word. In practice a microVM is a VM run by a small virtual machine monitor (VMM) that makes a few deliberate cuts:
- A minimal device model. Instead of emulating a whole PC (graphics, USB, sound, PCI buses, legacy controllers), the VMM offers a few paravirtualized devices, typically virtio network, block storage and vsock plus a serial console. Firecracker's FAQ lists exactly five emulated devices. Less emulated hardware means less code an attacker inside the guest can reach.
- Direct kernel boot. The VMM loads a Linux kernel and root filesystem straight into the guest rather than going through BIOS or UEFI firmware and a bootloader, which is a large part of why microVMs start quickly.
- Hardware virtualization through KVM. The VMM is an ordinary user-space process on a Linux host that asks the kernel's KVM module to run the guest. The guest has its own kernel, so a kernel exploit inside it hits the guest kernel, not the host's.
- An API instead of a console. VMs are configured, booted, paused and snapshotted by API calls, so a scheduler or your own product can manage thousands of them programmatically.
- Snapshots. Most microVM monitors can save a running VM's memory and device state to disk and restore it later, so a VM can be paused while idle and resumed where it left off, or many VMs can be started from one prepared snapshot.
MicroVM vs container vs traditional VM
The question most people are really asking is where a microVM sits between a container and a full VM. The short answer: it keeps the isolation boundary of a VM and gives up most of its weight, while a container keeps the speed and gives up the boundary.
| Container | MicroVM | Traditional VM | |
|---|---|---|---|
| Kernel | Shares the host kernel | Its own guest kernel | Its own guest kernel |
| Isolation boundary | Linux namespaces, cgroups, seccomp | Hardware virtualization (KVM), plus whatever sandboxing wraps the VMM process | Hardware virtualization |
| Emulated hardware | None | A few virtio devices | A full virtual PC: firmware, PCI, many device types |
| Boot | Starts a process; no boot | Direct kernel boot, or resume from a snapshot | Firmware, bootloader, full OS boot |
| Guest operating systems | Same kernel as the host | Usually Linux only; depends on the VMM | Linux, Windows and others |
| Packaging | OCI images | A kernel plus a root filesystem image, often built from an OCI image | Disk images |
| Typical use | Your own services and trusted code | Untrusted or multi-tenant code: functions, sandboxes, one VM per tenant | Long-lived servers and desktops that need full hardware support |
Start time and memory overhead are where projects publish their headline numbers. Treat those as the vendor's figures under the vendor's conditions; boot and resume times depend on the guest kernel, image size, host and storage, so measure them on your own hardware before you design around them.
A microVM is not automatically safer than a container in every respect: it still needs a hardened host, network rules and limits on what the guest can reach. What it changes is the boundary between tenants. Why every AI agent needs its own kernel goes deeper on why that boundary matters for agents.
The main microVM options
"MicroVM" can mean a VMM you run yourself, a runtime that wraps one for containers, or a managed service built on one. These are the ones people most often mean:
| Option | What it is | Guests | Fits |
|---|---|---|---|
| Firecracker | Open-source VMM in Rust, built by AWS for Lambda and Fargate; started from crosvm. Apache 2.0 | Linux (and OSv) | Building your own microVM platform for many short-lived or per-tenant VMs |
| Cloud Hypervisor | Open-source VMM in Rust, built on the rust-vmm crates; more devices than Firecracker, including CPU, memory and PCI hotplug | 64-bit Linux and Windows | MicroVM-style VMs that need more hardware support, or Windows guests |
| QEMU microvm | A minimal machine type in QEMU, modelled on Firecracker; originally without PCI or ACPI, using virtio-mmio devices | Linux | Teams already on QEMU and libvirt who want a lighter machine model |
| crosvm | Google's VMM in Rust, written for ChromeOS | Linux | The project Firecracker grew from; mostly used inside ChromeOS and Android |
| Kata Containers | A container runtime that runs each container or pod inside a lightweight VM, using QEMU, Cloud Hypervisor or Firecracker underneath | Linux | Keeping Docker or Kubernetes workflows while giving each pod its own kernel |
| AWS Lambda MicroVMs | AWS's managed service on Firecracker: isolated, stateful compute environments with suspend and resume, aimed at AI agents and developer platforms | Linux | Per-tenant VMs without running hosts yourself; check AWS's docs for current limits and pricing |
| Docker Sandboxes | Docker's sbx CLI for running coding agents in microVMs, locally or on Docker-managed cloud | Linux | Running a coding agent unattended on a developer's machine |
| microvm.nix | A Nix flake that builds NixOS guests and runs them on a choice of hypervisors, including QEMU, Cloud Hypervisor, Firecracker, crosvm and kvmtool | NixOS | NixOS users who want VMs declared like packages, as a more isolated alternative to nixos-container |
Many hosted agent sandboxes and app platforms are also built on Firecracker or Cloud Hypervisor; Firecracker's own FAQ lists several. When a provider says it uses microVMs, ask which VMM, whether each tenant gets its own VM, and whether it supports memory snapshots.
What it takes to run microVMs yourself
Booting one Firecracker VM from the getting-started guide takes minutes. Running thousands for real users is a platform. Plan for each of these:
- Hardware virtualization on the host. MicroVMs need KVM, so the host must be bare metal or a cloud instance type that supports nested virtualization. Check your provider's documentation for which instance types qualify.
- Guest images. A kernel built for the VMM and a root filesystem. Teams usually convert OCI images into block-device images so developers can keep building with Dockerfiles.
- Networking. A tap device and IP per VM, routing or NAT, and per-tenant egress rules. An agent VM that can reach any address can leak whatever it can read.
- Storage and snapshots. Where root disks, writable volumes and memory snapshots live, how they are copied between hosts, and how long you keep them. This decides whether a sleeping VM can resume on a different machine.
- Defence in depth around the VMM. Run each VMM process unprivileged, in its own namespaces and cgroup with a seccomp filter. Firecracker ships a companion program, the jailer, for exactly this.
- Scheduling and lifecycle. Placing VMs on hosts, pausing idle ones, waking them on demand, draining hosts for kernel updates, and cleaning up VMs whose tenant is gone. firecracker-containerd and Kata Containers on Kubernetes cover part of this; the per-tenant logic is yours. Agent fleet management across thousands of tenants covers the operational side.
- Secrets. Keep long-lived credentials outside the guest and inject or proxy them, so a compromised VM never holds the real key. See credential and secret isolation in per-user agent VMs.
When an AI agent needs a microVM
Agents are the clearest current case for microVMs, because they run code nobody reviewed: commands the model wrote, packages it chose to install, pages its browser opened. A microVM fits when:
- The agent runs model-written code for more than one customer. Sharing a host kernel across tenants is the risk microVMs remove. Why multi-tenant agent platforms allocate a dedicated VM per tenant explains the pattern.
- The agent needs a real computer. Root inside the guest, system packages, background processes and a full browser all work in a microVM without loosening the host's security. See package installation and runtime customization in agent VMs.
- Each user's agent keeps state. A persistent microVM per user can be snapshotted when idle and resumed with its files, processes and sessions intact. The persistent VM pattern and agent state persistence across sleep and redeploys cover how.
- Tasks run for hours. A VM has no request timeout, unlike most serverless functions; see why serverless execution boundaries break multi-step agent workflows.
A container or OS-level sandbox is often enough when the code is your own, runs for one trusted team, or never touches another tenant's data. Between the two sits gVisor, a user-space kernel that keeps the container workflow and needs no KVM; gVisor explained compares it with microVMs. And if the agent only needs to evaluate small self-contained snippets, a WebAssembly runtime may be lighter still. Whatever you choose, cost depends on how many VMs exist and what an idle one costs; unit economics of one agent per user lists what to measure.
Common questions
Is a microVM the same as a container?
No. A container is a group of processes sharing the host's kernel, separated by namespaces and cgroups. A microVM boots its own kernel on hardware virtualization. Runtimes such as Kata Containers blur the line by running containers inside microVMs, so you keep container images and tooling with a VM boundary.
Does Docker use microVMs?
Ordinary Docker containers do not; they share the host kernel. Docker Sandboxes, Docker's tool for running coding agents, does run each sandbox in a microVM. On macOS and Windows, Docker Desktop also runs its Linux engine inside a VM, but that one VM is shared by all your containers.
What is an AWS microVM?
Usually one of two things: a Firecracker microVM, the VMM AWS built for Lambda and Fargate and open-sourced, or AWS Lambda MicroVMs, the managed service that runs isolated, stateful Firecracker-based environments for you. For the service's limits, regions and pricing, read the AWS Lambda MicroVMs documentation and pricing page on the day you compare.
Can a microVM run Windows?
It depends on the VMM. Firecracker supports Linux (and OSv) guests only. Cloud Hypervisor supports Windows guests, including recent Windows Server and Windows 11 releases, according to its documentation.
What is the QEMU microvm machine type?
A minimal machine type in QEMU, added in version 4.2 and modelled on Firecracker. It was designed for short-lived guests, without PCI or ACPI and with virtio-mmio devices, so teams already using QEMU can get a lighter, faster-booting VM without switching VMM.
Do I need bare-metal servers to run microVMs?
You need KVM on the host. That means bare metal or a cloud instance type that supports nested virtualization, which varies by provider and instance family. A managed service such as AWS Lambda MicroVMs or a hosted agent sandbox avoids the question.



