What Self-Hosted Persistent VMs Own That Serverless Leases and Revokes

Persistent VMs let agents retain installed packages and running processes across requests.

· 8 min read
Cover illustration for “What Self-Hosted Persistent VMs Own That Serverless Leases and Revokes”
Self-Hosting OAF · November 7, 2026 · 8 min read · 1,860 words

Persistent AI agent infrastructure preserves the execution environment that serverless functions treat as disposable. For agents that build on earlier work, the decisive difference is whether installed packages, working files, session memory, and running processes survive between requests. Persistent VMs make that accumulated state part of the agent’s environment rather than an invocation-scoped lease, while snapshot-restore avoids paying for running compute throughout idle periods.

Why serverless was designed for a world without agents

Serverless assumes that invocations are independent, durable state lives elsewhere, and compute can be discarded after completing a task. That contract suits image resizing, webhook validation, and JSON transformation. Each task has a set input and output. Once the result is delivered, the execution environment has no further role in the application’s logic. Discarding it is consistent with the workload.

Agents often operate under a different contract because each step changes the environment that the next step needs. A coding agent installs packages and starts a development server, while an analysis agent loads data and retains intermediate results. AWS Lambda’s 15-minute invocation limit makes some long-running workflows difficult, but duration is only the visible restriction. The deeper mismatch is that an invocation-scoped environment does not promise continuity of local files, process memory, authenticated sessions, or execution position. Even a short agent interaction can cross that boundary when a user returns with a follow-up request.

What actually gets destroyed when a serverless invocation ends

When an execution environment is discarded, filesystem loss includes cloned repositories, installed packages, staged files, and downloaded datasets. Process loss removes development servers, language runtimes, and daemons. Session loss includes locally cached authentication material and established browser sessions, rather than necessarily invalidating credentials at their issuer. Execution continuity is lost when intermediate artifacts and the in-memory workflow position are lost, unless they have been saved elsewhere. Each of these forms of state has a different cost to rebuild.

A coding agent illustrates how those costs accumulate. It clones a large repository, installs dependencies, and boots a development server before answering the first request. If that environment is discarded, a follow-up requires the setup again. A data analysis agent faces the same problem after loading a multi-gigabyte dataset, cleaning it, building a feature pipeline, and rendering a chart. The chart can survive as an output while the environment needed to revise it does not.

The user experiences repetition that stalls useful progress. Caching layers, external state stores, and pre-warming can reduce parts of that repetition, but they introduce more systems to coordinate. The operational burden moves rather than disappears, and reconstruction adds failure paths beyond the agent’s own work.

Why persistent VMs treat agent state as property, not a lease

Ownership is the architectural distinction between those models. A persistent VM gives the agent a disk, memory, and process tree whose lifecycle is not tied to the end of a request. The platform does not discard them merely because an interaction has finished. Ownership here means continuity under an explicit environment lifecycle, subject to failures or deliberate deletion. The agent’s accumulated work remains available for its next step.

That continuity changes what resumption means in practice. A preserved environment resumes from actual execution state instead of reconstructing a representation of that state from an external store. DynamoDB, Redis, and S3 can retain conversation history and simple key-value records. They are not, by themselves, substitutes for a running process, an authenticated browser session, or a build in progress. Saving descriptions and artifacts is different from preserving the environment that is using them.

For workloads dependent on those live resources, persistence is more than a startup optimization. It provides the continuity the workflow requires. It also makes performance more predictable by removing repeated setup from the normal interaction path. Troubleshooting becomes easier because observing an agent’s trajectory as a continuous run replaces assembling it from isolated invocation logs.

How Firecracker micro-VMs make persistent isolation economically viable

Firecracker makes it practical to isolate each agent without the overhead of a full conventional VM for each one. AWS first built the minimal, open-source virtual machine monitor in Rust to run microVMs at scale. AWS Lambda and Fargate establish its production pedigree. Its low per-VM memory overhead makes dense deployment possible. That efficiency changes the economics of assigning an isolated environment to each agent.

Docker containers share the host kernel, so a kernel vulnerability that permits a container escape can expose other workloads on that host. Each Firecracker microVM has a dedicated Linux kernel and its own VMM process, independent of a shared VMM daemon. This separates workloads executing user-supplied prompts or AI-generated code at the VM boundary. Amazon Bedrock AgentCore Runtime applies that model by assigning each session its own Firecracker microVM.

AWS’s June 22, 2026 announcement of Lambda MicroVMs extends the case beyond infrastructure theory. The resource provides dedicated Firecracker-based execution environments with preserved in-session state, dedicated HTTPS endpoints, and direct lifecycle control. The canonical serverless platform is therefore adding explicit environment continuity, acknowledging that invocation-scoped execution alone does not cover agent workloads.

Snapshot-restore as the mechanism that separates idle cost from ownership cost

A persistent environment need not consume running compute while its user is away. A snapshot captures the execution state, allowing the running VM to be removed and its host resources released. The next request restores that state, bypassing a rebuild of the environment from scratch. Idle cost moves from compute to storage, which is orders of magnitude cheaper.

PandaStack documents the startup side of this approach through a self-hosted Firecracker deployment without a warm pool of idle VMs. Every create restores a baked snapshot, with p50 latency of 179ms and approximately 203ms at p99. Those figures describe latency specifically for its baked-snapshot restore path. Keeping unused VMs running is no longer the only route to responsive startup.

Across a fleet, snapshot-and-delete lets compute capacity follow the users who are active while the environments of users who are away stay in storage. Copy-on-write forks extend the same principle to parallel exploration by branching a VM’s memory and disk cheaply. An agent can try five possible fixes from the same starting point without doing the setup five separate times.

Millisecond checkpoint and rollback as an emerging capability for tree-search agents

MCTS and Tree of Thoughts try possible paths, use execution feedback to judge them, and backtrack when they fail. Those operations require frequent checkpoints of complete sandbox state, including files and processes. Saving only the conversation cannot provide that control.

Its central observation is that consecutive checkpoints differ only slightly, making full duplication wasteful. DeltaBox captures changes through DeltaFS for filesystem state and DeltaCR for process state. The former turns filesystem rollback into a layer switch, while the latter accelerates process rollback using a frozen template. The approach targets millisecond-level checkpoint and rollback, replacing repeated full-state reconstruction.

AgentRewind addresses a related coordination problem by restoring agent context and controlled environment state together. Its “rewind memory” lets the restored agent use information from previous attempts, so returning to an earlier checkpoint does not erase what failure taught it. That control has a firm boundary, however. Restoring a sandbox does not undo actions already committed through external APIs, so production designs must account for those effects separately. Stateless functions alone offer no equivalent mechanism for branching or rolling back a live environment.

Per-user agent fleets and the multi-tenant isolation problem serverless cannot solve

Per-user agents turn environment continuity into a tenant-isolation requirement. Each user’s credentials, files, and execution context must remain separate from those of other users. Serverless functions backed by shared external stores do not automatically provide that separation. The application still has to manage credential scope and session boundaries. Persisting records is not the same as isolating the environment that uses them.

The OpenClaw security research shows why boundaries between an agent’s activities also need to be enforced. It finds that heartbeat-driven background execution shares a session with the conversation with the user, so untrusted background content can pollute memory that is later used in foreground responses. This is evidence of inadequate context separation. A dedicated VM separates tenants, but it does not by itself separate every context inside one tenant’s agent. Both boundaries need deliberate treatment.

The Model Context Protocol provides a complementary deployment boundary for tools through JSON-RPC 2.0 over stdio or Streamable HTTP. Independently deployed tool endpoints allow different tenants to receive different tool sets without redeploying the orchestrator or sandbox. That flexibility does not replace execution isolation. For agents running generated code in multi-tenant fleets, dedicated microVM kernels provide the security boundary that session tokens and shared-kernel containers cannot supply on their own.

When should developers choose persistent AI agent infrastructure over serverless functions?

Serverless remains appropriate when each invocation is genuinely independent. Short, stateless tool calls, single external API requests, one-shot scripts, and stateless batch tasks fit that condition when they complete within platform limits. A microVM can add latency and operational complexity to a narrow API call without meaningfully reducing risk. The architecture should match the work being performed. Agent involvement alone is not a reason to require a persistent environment.

The decision rule is to ask whether the second invocation benefits from execution state left by the first. If it needs a cloned repository, a loaded dataset, an authenticated browser session, or a running development server, persistent execution is the right default. Multi-step workflows with intermediate artifacts and tree-search agents with branching and rollback fall on the same side of that boundary. Their unit of work extends beyond one request.

External storage remains useful within either architecture. It can preserve history and records, but cannot on its own reproduce a live process or mid-session browser state. The distinction is between an agent that needs saved information and one that needs its previous environment. Ownership becomes a hard requirement in the latter case, because reconstruction changes the workflow itself as well as moving its data.

What persistent VM infrastructure looks like for developers building agent-native products today

For developers choosing persistent execution, the appropriate primitive is an isolated microVM with a persistent disk, a real kernel, and package installation privileges. That environment gives each agent room to install tools and retain the results. It is not equivalent to attaching a database to a function. The infrastructure must keep execution state and give developers lifecycle control so they can keep work between requests without having to rebuild it above disposable compute.

Snapshot-restore scheduling makes it affordable to give each user an agent environment. Most agents are idle most of the time, so inactive environments should incur only storage costs. A flat-rate offering built this way can make buying it simpler, but how it schedules the work still matters most. Boot and wake latency are product requirements. Sub-second restoration lets the agent respond quickly, while restores that take seconds break up the experience the architecture is meant to keep.

The developer interface should therefore be a CLI, SDK, and MCP wiring that abstracts away cluster configuration. Managed infrastructure can provide these primitives so product teams can use them without running the hosts themselves. Each user then receives a VM-isolated agent with persistent credentials, memory, and execution context, backed by explicit session boundaries.

Sources

  1. DeltaBox: Scaling Stateful AI Agents with Millisecond-Level Sandbox Checkpoint/Rollback
  2. Mind Your HEARTBEAT! Claw Background Execution Inherently Enables Silent Memory Pollution
Filed underSelf-Hosting OAF

More in Self-Hosting OAF