Snapshot and Restore for Idle Browser Agent VMs
Freezing idle agents to disk cuts costs by charging storage instead of always-on compute.

Browser agents spend almost all of their time waiting, not computing. They wait on model responses, tool call results, and human input, and a VM stays alive the whole time, billing for every idle second. Snapshot and restore changes that arithmetic: idle agents freeze to disk and resume in under a second, so a fleet pays for storage instead of idle compute.
Why browser agents spend most of their time doing nothing — and what that costs
A browser agent's active computation is intermittent by nature. It issues a request, sits idle while a model streams tokens back, then sits idle again while a tool executes or a user reads the screen and decides what to type. The waiting periods dominate. Yet the naive lifecycle for any sandbox, create, run, delete, forces a binary choice around exactly this intermittency: keep the VM alive and pay for idle compute, or tear it down and pay a cold-boot penalty on every resumption.
Cold boot on runtimes like libkrun takes on the order of 10 to 30 seconds. That is an eternity for a responsive agent product. A user who issues a command and waits half a minute for the agent to wake sees something closer to a batch process than to an assistant. Always-on operation avoids that restart penalty, but it makes per-user agent economics untenable at fleet scale, because the provider is paying for concurrency equal to total user count rather than active user count.
The deeper problem is that browser agents accumulate state that cannot simply be discarded. Open tabs, authenticated sessions, partially completed tasks, in-memory context: these are the substance of a persistent agent, and a stateless restart loses all of it. They erase the continuity that makes the agent useful in the first place. This tension, that agents need persistent state while continuously running idle VMs is economically unsustainable, is the precise gap that snapshot-restore is designed to close. Platforms with a snapshot-and-restore scheduler, Maritime among them, use it to ensure that a parked agent costs only its storage, charged on a flat monthly rate per agent rather than metered compute, which is what makes per-user agent economics viable at scale.
What a Firecracker snapshot actually captures and why resuming from one is not a reboot
A Firecracker snapshot is a complete frozen moment of a running VM: full guest memory contents, CPU register state, and device state. It is not a boot image and not a container layer. It is a machine paused mid-execution, and the distinction determines everything about how restore behaves. Restoring from a snapshot does not run firmware, does not initialize the kernel, does not start the agent process. It memory-maps the snapshot file, loads CPU state, and resumes execution from exactly where the VM was paused.
That means the restore inherits the warm state of the machine at snapshot time. JIT-compiled hot paths, populated connection pools, loaded module graphs, active browser sessions: all of it comes back as it was, rather than being rebuilt from a cold machine that merely happens to arrive quickly. The speed advantage over cold boot compounds with every expensive warm-up phase the restore skips. Maritime, for instance, deploys each agent in its own Firecracker micro-VM and freezes it to disk when idle, so restore operations inherit the warm state instead of forcing a cold kernel initialization.
Memory is loaded copy-on-write via MAP_PRIVATE. At restore time nothing is copied. Pages are shared until something writes to them, so restoring a large-memory VM costs almost nothing in memory bandwidth until the agent actually diverges from the snapshot baseline. The rootfs is a reflink clone, a metadata-only operation rather than a disk-sized copy, so the storage cost of each restore instance is proportional to what the agent writes, not to the full image size.
A snapshot is not an image, which is instructions for building a machine, and not a container layer, which is a filesystem delta. It is a specific machine from a specific moment, resurrected, and it brings that moment with it: its clock, RNG state, DNS cache, and open socket table. The frozen-moment property is the source of both the speed and the correctness considerations that follow.
How fast snapshot-restore actually is, and what the latency numbers mean for agent UX
Snapshot-restore makes VM resume fast enough to be invisible to the agent's caller. The snapshot-load step itself lands around 49ms. The developer pays that three seconds once to produce the snapshot, then pays roughly 179ms on every subsequent create, which makes the one-time bake cost negligible across any fleet with more than a handful of restores.
For browser agents, the agent-browser daemon starts automatically on first command and persists between commands. The restore path means a browser session with open tabs and authenticated state resumes at the same latency as any other snapshot restore: no re-login, no re-navigation. A session with open tabs and authenticated state wakes at the same speed as any other snapshot restore, which makes the always-persistent agent model responsive enough for real product use.
Sub-second resume is a hard product requirement, not a nice-to-have. An agent that takes 10 to 30 seconds to wake on every tool call cannot be used interactively. The user experience degrades from something that feels like an agent to something that feels like a batch job, and products built on top inherit that brokenness directly.
Snapshot-restore versus keeping a warm pool of idle VMs
A warm pool and snapshot-restore both make sandbox creation appear fast, but they diverge completely on what is paid while nobody is asking and on how each behaves when a burst hits. A warm pool trades continuous idle compute cost for instant handout. Every parked VM holds guest RAM resident and a schedulable vCPU whether or not any request arrives, which is the entire problem: most of the day, most of the pool is paying rent on machines doing nothing.
To absorb a burst, a warm pool must be sized for peak. That means the provisioned capacity sits idle between bursts, and it still solves cold starts only up to its ceiling. A spike that drains the pool faster than the refill loop can boot replacements falls straight through to a cold boot at the worst possible moment, under load, when the user is already waiting. Warm pools do not eliminate cold start. They defer it to the point of exhaustion.
Snapshot-restore on demand keeps no idle VMs at all. Idle cost rounds to zero because the machine is not running. It is a set of files on disk. Bursts are absorbed by restoring more copies of the same snapshot concurrently rather than drawing down a pre-built inventory, so there is no pool ceiling to exhaust. Copy-on-write memory sharing means that many concurrent restores of the same snapshot share unchanged pages, significantly reducing total memory demand across the fleet.
The two approaches are complementary rather than mutually exclusive. Snapshots handle the resume cost of idle agents returning from sleep. For most browser agent fleets, snapshot-restore alone is sufficient, because the restore latency is already inside the acceptable window, and the warm pool adds continuous cost without addressing the persistence requirement that snapshots solve natively.
The economics of paying for storage instead of idle compute
Snapshot-restore restructures the cost of a persistent agent fleet. Instead of paying for compute proportional to user count, the operator pays for compute proportional to concurrency and for storage proportional to snapshot size. A suspended VM costs only its snapshot storage: no vCPU reservation, no guest RAM held resident. The structural insight is that the platform pays for concurrency, not customer count, which is what makes per-user agent deployment economically viable.
The agent-browser daemon's idle timeout makes this automatic in practice. After one hour with no commands or dashboard input, the daemon saves configured restore state, closes the browser, and exits, so integrations that die without calling close do not leak the daemon and its browser session indefinitely. The timeout, configurable through --idle-timeout, is what prevents accidental always-on billing at the source.
Maritime's economic model treats this as first-class. Its snapshot-and-restore scheduler is the mechanism that lets agents pay for storage instead of idle compute, making the flat per-agent pricing work because an idle agent costs storage, not a running VM slot. The flat rate follows from the structural shift: when idle is storage rather than compute, a per-agent price no longer carries the hidden cost of an always-on VM behind every enrolled user.
What goes wrong when snapshot completion fails — and how to fix it
When snapshot completion silently fails, idle agents never sleep. Every automatic sleep attempt failed because the final session snapshot never completed. The agent retried every 10 to 15 minutes, and sessions that should have gone dormant remained live indefinitely.
The root causes were structural rather than incidental. First, the snapshot bundle packed the entire branch history, bloating each capture to hundreds of megabytes and exhausting the available budget, leaving almost no room for other workspace data. Second, the oversized-entry size check ran one Docker exec per tracked file. At thousands of files this took around 10 minutes with no progress report, exceeding the control plane's 2-minute watchdog and triggering a failure that left orphaned storage objects accumulating in R2. Third, failed captures leaked their partial uploads, because the API did not clean up objects from capture generations that could never complete.
Each fix addressed a root cause directly. Bounding the skipped-file manifest kept snapshot request bodies within the JSON size cap. Adding API-side cleanup of uploads from capture generations that can never complete stopped the storage leak retroactively for sessions already on existing nodes. A compare-and-swap in snapshot preparation closed a race condition that could overwrite a just-completed snapshot and delete its objects. Correctness under concurrent sleep attempts is non-trivial, and the incident makes clear that sleep which requires a complete snapshot is a correctness guarantee, not a performance optimization.
Seven correctness issues that every snapshot-restore implementation must address
A restored VM is not a fresh machine that arrived quickly. It is a specific machine from a specific moment, and every piece of state it froze is now potentially stale or duplicated. Correctness is therefore a first-class implementation concern alongside latency, and the issues below are the complete bill.
Clock skew: The guest clock was frozen at snapshot time and resumes believing it is still that moment. TLS certificate validation, token expiry checks, and rate-limit windows all fail or misbehave until the clock is corrected. The fix is to update the guest clock immediately on resume, before any userspace code runs.
RNG uniqueness after clone: A snapshot restored to N concurrent VMs gives all N the same initial RNG state, producing identical "random" values. That is a serious problem for session token generation, cryptographic nonces, and anything relying on entropy. VMGenID is a change-detector the guest can read to detect that it has been cloned and reseed its entropy pool accordingly.
Stale open sockets: TCP connections frozen in the snapshot are dead on resume, because the remote peer has long since closed or timed them out. Code that assumes its connection pool is ready will fail silently until it hits a read or write error. Browser agents are particularly exposed, since a restored Chrome session may hold socket handles to ad networks, CDNs, or API endpoints that are no longer valid. DNS cache staleness: Cached DNS responses frozen at snapshot time may resolve to addresses that have since changed, rotated, or been decommissioned. Configuration lock-in: A Firecracker snapshot captures machine configuration alongside the memory image. vCPU count and RAM size are fixed at bake time and cannot be changed at restore. Resizing requires re-baking the snapshot template. Concurrent restore identity: When the same snapshot is restored to many VMs simultaneously, each instance must be given a unique identity, hostname, machine ID, network address, before any of them announce themselves to external services.
How to structure a browser agent's idle lifecycle around snapshot and restore

A well-structured browser agent idle lifecycle has three distinct phases: active execution, idle-timeout-triggered snapshot, and on-demand restore. Each has defined responsibilities that make the economic and correctness properties hold together. In the active phase, the agent runs in its VM with a live browser session, a persistent filesystem, and open network connections. No special handling is needed. This is the machine doing work. Idle detection then takes over. The snapshot must complete fully before the VM is considered suspended. That guarantee is what separates sleep from a leak.
The suspended state is the economic payoff. Compute billing stops, storage billing begins, and the agent's browser state, filesystem, credentials, and in-progress task context are all preserved. On the next incoming command, the scheduler restores the snapshot. Clock correction happens before userspace resumes, stale sockets are cleared, and RNG is reseeded via VMGenID detection. Each agent also gets its own session namespace, which prevents state bleed between concurrent restores of the same base snapshot in a multi-tenant fleet.
Maritime's architecture makes this lifecycle first-class. Each agent lives in its own Firecracker micro-VM with a persistent disk, and the snapshot-and-restore scheduler is the mechanism that translates the idle-economics insight into a deployable product. Agents wake in under a second, and developers do not manage any of the snapshot logistics themselves.
Scaling the model to a per-user agent fleet
The snapshot-restore lifecycle is not merely an optimization for individual agents. In a multi-tenant fleet, each user's agent lives in its own isolated VM with its own snapshot: its own filesystem, its own browser session history, its own credentials. Copy-on-write memory sharing across concurrent restores of the same base template reduces total memory demand significantly when many agents share a common starting point, such as the same browser profile or task template.
The concurrency insight compounds at fleet scale. That shift is what makes per-user persistent agents a viable product category rather than a cost overrun. Architecturally, that is closer to a personal computer in the cloud than to a shared API endpoint.
Maritime is built around this model. Each agent gets its own Firecracker micro-VM on bare metal, a persistent disk, and a snapshot-restore scheduler that makes the per-user economics work at a flat rate, so developers can deploy one agent per user without the cost structure collapsing under the weight of idle instances. The challenge that opened this piece, that agents need persistent state while idle compute is economically unsustainable, has a resolution: freeze the moment, store it, and wake it in less time than a user notices.


