Guide
What Is a MicroVM? A Guide for AI Agent Builders
A microVM is a virtual machine cut down to the few devices a cloud workload needs, so it boots like a process and isolates like a VM. Here is how it works, who runs them, and what one costs when the agent inside it is doing nothing.
Idle Cost Editors · Updated November 18, 2026
What a microVM is
A microVM is a hardware-virtualized machine with its own guest kernel, run by a deliberately small virtual machine monitor (VMM). On Linux that monitor sits on KVM, the kernel's built-in hypervisor, and emulates only a handful of devices: typically a virtio network card, a virtio block device, a serial console and a socket for talking to the host. There is no emulated graphics card, USB controller or BIOS boot path to walk through.
Cutting the device model down does two things at once. It shrinks the code an attacker inside the guest can reach, and it shrinks the work needed to start a machine. Firecracker, the best-known microVM monitor, publishes the numbers it enforces in its own test suite: for a guest with 1 vCPU and 128 MiB of memory, at most 125 ms from the start call to the guest's /sbin/init, and at most 5 MiB of memory overhead for the monitor's own threads (see its specification for the exact test setup).
"MicroVM" names a class of machine, not a product. Firecracker, Cloud Hypervisor, QEMU's microvm machine type and several others all build them, and services from AWS, Docker, Fly.io and others rent them out.
MicroVM vs container vs full VM vs gVisor
The question most agent teams are really asking is where the isolation boundary sits, and what it costs to keep a sandbox around. The table compares the four common choices on what each one structurally is; boot time and density depend on your image and host, so measure them on your own workload.
| Container | gVisor | MicroVM | Full VM | |
|---|---|---|---|---|
| Isolation boundary | Linux namespaces and cgroups on the shared host kernel | A user-space kernel that intercepts the sandbox's system calls | Hardware virtualization with its own guest kernel | Hardware virtualization with its own guest kernel |
| Kernel the code talks to | The host's | gVisor's, then a narrowed set of host calls | Its own | Its own |
| Emulated hardware | None | None | A few virtio devices | A full PC: firmware, buses, many devices |
| Start-up | Process start | Process start plus the sandbox | Kernel boot in a cut-down machine, or restore from a snapshot | Firmware and full OS boot |
| Can it be snapshotted with memory, then resumed? | Only with extra tooling (for example CRIU) | gVisor has checkpoint and restore | Yes; Firecracker and Cloud Hypervisor both support it | Yes, on most hypervisors |
For code an agent writes and runs on its own, a shared kernel is usually the line teams will not cross, which is why agent sandboxes have converged on microVMs. The tradeoffs between the tiers, with production overhead figures, are in runtime isolation cost tradeoffs for untrusted AI agents.
The microVM monitors you will meet
- Firecracker. Built at AWS for Lambda and Fargate, open-sourced in November 2018 under Apache 2.0, written in Rust. It started from crosvm, ChromeOS's VMM. Linux guests only, a REST API over a Unix socket, a
jailerthat wraps each VM in its own chroot, namespaces and seccomp filters, and full snapshot and restore. firecracker-microvm.github.io - Cloud Hypervisor. An open-source VMM in Rust aimed at modern cloud workloads, with a minimal device model like Firecracker's but more features: CPU, memory and device hotplug, vhost-user device offload, and Windows as well as Linux guests. cloudhypervisor.org
- QEMU `microvm`. A machine type added in QEMU 4.2, inspired by Firecracker and modelled on its machine: originally no PCI and no ACPI, virtio-mmio devices, built for short-lived guests. Pick it when you already run QEMU and want its tooling with a lighter machine. QEMU documentation
- crosvm. Google's VMM for ChromeOS, in Rust, and the codebase Firecracker began from.
- Kata Containers. Not a VMM but a container runtime that starts each pod in a lightweight VM, so Kubernetes and container tooling keep working. It can use QEMU, Cloud Hypervisor, Firecracker, Dragonball or StratoVirt underneath. Kata hypervisor list
- microvm.nix. A Nix flake that builds NixOS guests and runs them on any of eight hypervisors, including QEMU, Cloud Hypervisor, Firecracker, crosvm and kvmtool. This is what most "nixos microvm" searches are after. microvm.nix on GitHub
Managed microVMs for agents
Running a VMM fleet yourself means owning bare-metal or nested-virtualization hosts, kernel and rootfs images, networking, snapshot storage and the scheduler that decides when to sleep a VM. Several services sell that as a product instead:
- AWS Lambda MicroVMs. Firecracker-based environments for one tenant, session or job each, built from a Dockerfile into a snapshot of the running application. A MicroVM can suspend after a configurable idle period, keeping memory and disk state, and AWS states that suspended MicroVMs incur no compute charges. Billing covers compute, snapshot operations and storage, and data transfer: check the Lambda pricing page for rates. Lifecycle and states
- Docker Sandboxes. Runs coding agents such as Claude Code and Codex in microVM environments, locally or on Docker-managed cloud compute, through the
sbxCLI. Docker's architecture write-up - Fly Machines. Fly.io runs application code in Firecracker microVMs that can be started and stopped through its Machines API. Fly.io architecture
- Maritime. Gives each AI agent its own Firecracker micro-VM, billed per second, that sleeps when idle and wakes in about a second. maritime.sh
Prices, idle rules and limits change often. Before you compare providers, read each one's current pricing page for three things: whether a suspended or stopped machine is billed for compute, what snapshot or disk storage costs per GB-month, and how long a suspended machine keeps its state before it is deleted.
What a microVM costs while the agent is idle
Agents spend most of their wall-clock time waiting: on a model response, a user, a webhook, tomorrow's schedule. What that waiting costs depends on which of three states the microVM is parked in.
| State | What is held | What you typically pay for | Back to work in |
|---|---|---|---|
| Running, idle | vCPUs and all guest memory on the host | Full compute rate, whether or not the agent does anything | No delay |
| Paused in memory | Guest memory stays resident on the host; vCPUs stop | Depends on the provider; the host's RAM is still occupied | Effectively instant |
| Snapshotted to storage | A memory file, a small VM state file and the disk, on storage | Storage for those files, plus any per-snapshot or restore fees | A restore: reading back the memory it needs |
The snapshot state is the one that changes the economics. A Firecracker snapshot is a guest memory file, a microVM state file and the disk files you manage yourself. On restore, Firecracker can map the memory file and load pages on demand, so the VM runs before every byte is back, at the cost of keeping that memory file available while the restored VM lives. Diff snapshots, which write only the memory touched since the last snapshot, are still a developer preview in Firecracker, so plan storage around full memory images unless your provider says otherwise.
A rough way to compare the two for one agent:
- Idle hours per month for the agent, from your own logs.
- Running-idle cost: idle hours × the provider's per-hour rate for the vCPU and memory size you run.
- Snapshot cost: (guest memory size + disk size) in GB × the storage rate per GB-month, plus snapshot and restore fees × the number of times the agent sleeps and wakes.
- Wake penalty: restores per month × restore latency, weighed against what a slower first response costs your product.
When snapshot cost is well under running-idle cost and the wake penalty is acceptable, sleep the VM. The deeper treatment, with worked numbers from published prices, is in storage vs compute billing for dormant AI agents and swapping idle compute spend for storage with snapshot-restore scheduling.
When a microVM is the right primitive for an agent
Reach for a microVM when:
- the agent runs code it wrote, or code a user handed it, and you will not share a kernel with that code;
- it needs a real machine: installing packages, a filesystem that outlives one request, background processes, a browser;
- its sessions run past serverless timeout ceilings, or it must pick up mid-task after a pause (see why serverless functions are the wrong primitive for persistent agents);
- it is idle most of the time, so snapshot-to-storage can replace paying for a running machine.
A container is usually enough when the code is your own and trusted, the work is a short stateless request, or you need GPU passthrough that your microVM monitor does not offer (Firecracker has no GPU support, and Kata lists GPU support only under QEMU). A full VM still fits when you need a non-Linux guest on a monitor that cannot run one, or a desktop with a display.
Frequently asked questions
Is a microVM the same as a container?
No. A container is a group of processes on the host's kernel, separated by namespaces and cgroups. A microVM runs its own guest kernel behind hardware virtualization. Tools such as Kata Containers and Docker Sandboxes blur the line by putting a container's workload inside a microVM.
Does AWS Lambda run on microVMs?
Yes. Firecracker was built at AWS to run Lambda and Fargate, and AWS Lambda MicroVMs now exposes Firecracker-based environments directly, with suspend and resume.
Is gVisor a microVM?
No. gVisor is a user-space kernel that intercepts a sandbox's system calls; there is no guest kernel behind hardware virtualization. It is often weighed against microVMs because both put a stronger boundary than a plain container around untrusted code.
Can a microVM run Windows?
It depends on the monitor. Firecracker runs Linux guests only. Cloud Hypervisor supports Windows guests, and QEMU can run Windows on its fuller machine types.
How fast does a microVM start?
Firecracker's own specification enforces at most 125 ms from the start call to the guest's init for a minimal 1 vCPU, 128 MiB guest. Real agent images take longer to boot, which is why agent platforms restore from a snapshot of an already-running machine instead of booting each time.


