Designing AI Agents

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.

Containers, microVMs and traditional VMs compared
ContainerMicroVMTraditional VM
KernelShares the host kernelIts own guest kernelIts own guest kernel
Isolation boundaryLinux namespaces, cgroups, seccompHardware virtualization (KVM), plus whatever sandboxing wraps the VMM processHardware virtualization
Emulated hardwareNoneA few virtio devicesA full virtual PC: firmware, PCI, many device types
BootStarts a process; no bootDirect kernel boot, or resume from a snapshotFirmware, bootloader, full OS boot
Guest operating systemsSame kernel as the hostUsually Linux only; depends on the VMMLinux, Windows and others
PackagingOCI imagesA kernel plus a root filesystem image, often built from an OCI imageDisk images
Typical useYour own services and trusted codeUntrusted or multi-tenant code: functions, sandboxes, one VM per tenantLong-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:

MicroVM monitors, runtimes and services
OptionWhat it isGuestsFits
FirecrackerOpen-source VMM in Rust, built by AWS for Lambda and Fargate; started from crosvm. Apache 2.0Linux (and OSv)Building your own microVM platform for many short-lived or per-tenant VMs
Cloud HypervisorOpen-source VMM in Rust, built on the rust-vmm crates; more devices than Firecracker, including CPU, memory and PCI hotplug64-bit Linux and WindowsMicroVM-style VMs that need more hardware support, or Windows guests
QEMU microvmA minimal machine type in QEMU, modelled on Firecracker; originally without PCI or ACPI, using virtio-mmio devicesLinuxTeams already on QEMU and libvirt who want a lighter machine model
crosvmGoogle's VMM in Rust, written for ChromeOSLinuxThe project Firecracker grew from; mostly used inside ChromeOS and Android
Kata ContainersA container runtime that runs each container or pod inside a lightweight VM, using QEMU, Cloud Hypervisor or Firecracker underneathLinuxKeeping Docker or Kubernetes workflows while giving each pod its own kernel
AWS Lambda MicroVMsAWS's managed service on Firecracker: isolated, stateful compute environments with suspend and resume, aimed at AI agents and developer platformsLinuxPer-tenant VMs without running hosts yourself; check AWS's docs for current limits and pricing
Docker SandboxesDocker's sbx CLI for running coding agents in microVMs, locally or on Docker-managed cloudLinuxRunning a coding agent unattended on a developer's machine
microvm.nixA Nix flake that builds NixOS guests and runs them on a choice of hypervisors, including QEMU, Cloud Hypervisor, Firecracker, crosvm and kvmtoolNixOSNixOS 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:

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.

Sources

  1. Firecracker
  2. Cloud Hypervisor
  3. QEMU 'microvm' virtual platform
  4. Kata Containers
  5. AWS Lambda MicroVMs
  6. Docker Sandboxes
  7. microvm.nix

Read next