Most agent sandboxes make you choose. Keep the VM running and pay for idle hours, or stop it and lose everything in memory: the dev server, the half-finished agent session, the shell you left open. Snapshots of the disk are common. Snapshots of the whole machine are rarer.
Every Yurt VM is a Firecracker microVM, and Firecracker can snapshot a running VM: CPU registers, devices, and all of guest RAM. We use that for sleep. On our test box today:
| Step | Time | What survives |
|---|---|---|
yurt sleep | ~3 s | RAM, CPU state, disk |
yurt wake | ~0.04 s | Processes keep running where they stopped |
Sleep: pause, snapshot, stop
Firecracker exposes an HTTP API on a Unix socket. Sleeping a VM is three calls and a systemctl stop:
api() { curl -fsS --unix-socket "$SOCK" -X "$1" "http://localhost$2" \
-H 'Content-Type: application/json' -d "$3"; }
api PATCH /vm '{"state":"Paused"}'
api PUT /snapshot/create '{"snapshot_type":"Full",
"snapshot_path":"'$D'/vmstate.new","mem_file_path":"'$D'/mem.new"}'
systemctl stop "yurtvm-$NAME"
mv "$D/vmstate.new" "$D/vmstate"; mv "$D/mem.new" "$D/mem"
Pausing first matters: the snapshot has to be consistent, so the vCPUs must be stopped while it is written. A Full snapshot writes all of guest memory to mem and the small device and CPU state to vmstate. Most of the 3 seconds is writing RAM to disk, so a bigger VM takes longer to fall asleep.
The bug we hit first
Notice the .new files. Our first version wrote the snapshot straight over the old mem file. That breaks the second sleep: a VM that was woken from a snapshot is still using its old memory file as backing memory. Overwriting a file that a running VM has mapped corrupts it. So we write to new files and swap them only after the process has stopped.
Wake: load the snapshot and resume
ip tuntap add "$TAP" mode tap 2>/dev/null || true # gone after a host reboot
ip addr replace "10.200.$ID.1/24" dev "$TAP"
ip link set "$TAP" up
systemd-run --unit="yurtvm-$NAME" --collect firecracker --api-sock "$SOCK"
api PUT /snapshot/load '{"snapshot_path":"'$D'/vmstate",
"mem_backend":{"backend_type":"File","backend_path":"'$D'/mem"},
"resume_vm":true}'
Why 40 milliseconds and not 3 seconds? With the File memory backend, Firecracker doesn't read the whole memory file back. It maps it. Guest pages are loaded from disk the first time the guest touches them. The VM starts running right away and pulls in memory as it needs it.
The network has to look the same after wake: same tap device name, same host-side address. The snapshot remembers which device the VM was attached to, so we recreate the tap before loading. If the host rebooted while the VM slept, that is the only thing that was lost.
What it feels like
$ yurt ssh me
root@me:~# python crawl.py &
[1] 418
root@me:~# exit
$ yurt sleep me
me sleeping (3.0s)
$ yurt wake me
me awake (0.04s)
$ yurt ssh me
root@me:~# jobs -l
[1]+ 418 Running python crawl.py &
The process never knew. For an agent this means the Claude Code session, its working tree and the dev server it started are still there when the next prompt arrives.
Caveats, honestly
- Time jumps. The guest clock resumes where it stopped, then corrects. Code that measures elapsed time across a sleep will see a jump.
- Outside connections time out. A TCP connection to some other server stays open on our side, but that server gave up long ago. Well-behaved clients reconnect.
- Disk use. A sleeping VM stores its RAM on disk. An 8 GB VM costs up to 8 GB of storage while asleep.
- New VMs still cold boot. Wake is fast. Creating a brand-new VM is not yet. We're fixing that by cloning new VMs from a pre-booted snapshot. More in our post on Firecracker inside a VDS.
Questions
Does a Firecracker snapshot keep running processes?
Yes. A full snapshot saves guest memory, CPU registers and device state. After restore, processes continue from the instruction where they were paused.
Why is restoring a snapshot faster than taking one?
Taking a full snapshot writes all guest RAM to disk. Restoring with the File memory backend maps the memory file instead of reading it, so pages load only when the guest touches them.
Do network connections survive a snapshot?
Connections inside the VM survive. A remote server on the other end may have timed out while the VM slept, so clients should reconnect.
Sources
- Firecracker snapshot support, read 2026-11-29
Give your agent its own computer. Full root, its own IPv6, and it sleeps with its memory when idle. Plans from $20/month, paid back as VM time.
curl -fsSL https://getyurt.dev/install | shKeep reading
Setup
How do you keep Claude Code running when your laptop is closed?
Claude Code stops when your laptop sleeps or SSH drops. Three ways to keep it running: tmux on a server, headless claude -p jobs, and a VM that sleeps with its memory.
Guide
Containers vs microVMs for AI agents
Why we give every AI agent its own kernel instead of a container: isolation, systemd, Docker inside, and whole-machine snapshots. Plus where containers still win.
Build log
Running Firecracker inside a rented VDS
Firecracker needs KVM. Most cloud VPSes don't expose it. Here's how we run microVMs inside a Contabo VDS with nested virtualization, why our first cold boots took 90 seconds, and how we avoid them.