Self-Hosted VM-per-Agent Architecture as the Production Standard for Agent Platforms
Dedicated microVMs with snapshot-restore are production's answer for untrusted agent code.

Persistent AI agent infrastructure and serverless functions differ in what they must keep between invocations. An autonomous agent needs recoverable state, isolated execution, and inexpensive suspension. A microVM per agent, with snapshot-restore and durable storage, is the right default in production for multi-tenant agents that run untrusted code. Self-hosting that foundation makes sense when fleet economics or data residency make it worth running the control plane.
Why do long-running AI agents fail on serverless infrastructure?
A session-bound agent loses its working position when the session ends unless persistence is built outside it. That limitation becomes consequential when an agent writes to a database, sends an email, provisions infrastructure, or files a ticket. Restarting a conversation is inconvenient. Restarting an unattended task from zero can repeat an action that already succeeded, while a session without durable history leaves nothing adequate for later security or compliance review.
Keeping the session alive avoids immediate state loss but introduces an idle-compute bill while the agent waits for a human or an API. Serverless functions such as Lambda do not, by themselves, supply the durable agent lifecycle that connects those waits to later execution. The distinction is between running code and preserving ongoing work. Autonomous and scheduled execution makes that distinction unavoidable because nobody may be watching when failure occurs. These failures share a common architectural root, and fixing them requires rethinking the execution primitive.
What persistent agents actually require from their execution environment
A persistent execution environment must keep files, credentials, browser sessions, and working memory through sleep and restart. It must also contain untrusted code, resume quickly enough for interactive work, and support package installation, subprocesses, and browser execution. Idle resources must stop adding to the compute bill. A shared-kernel container or a serverless function does not fully satisfy these requirements together, even when it handles individual parts well.
The requirements explain why the agent infrastructure market has separated into managed hyperscaler runtimes, framework-native platforms, and sandbox or serverless runtimes. Each addresses a different part of the lifecycle rather than making the underlying requirements disappear. For teams choosing a runtime, the evaluation therefore starts with isolation, durable state, orchestration, observability, deployment model, and security. A platform’s ability to execute a successful request is not evidence that it can recover an interrupted task or preserve tenant boundaries throughout that task.
Why a dedicated kernel is the minimum isolation boundary for multi-tenant agent workloads
An agent can execute code nobody has reviewed, consume unbounded resources, attempt unauthorized file access, or follow instructions introduced through prompt injection. The execution boundary must contain those behaviors. In a Docker container, tenant code shares the host kernel with other containers, so a kernel exploit or resource-exhaustion attack can extend beyond the originating tenant.
A Firecracker microVM instead runs its own guest Linux kernel. Tenant code encounters that guest kernel rather than sharing the host kernel directly with neighboring workloads. Containers still work well for many web workloads, but untrusted, AI-generated code in a multi-tenant platform has a different threat model. Dedicated-kernel isolation establishes the minimum boundary for that model without pretending that virtualization replaces every other security control.
How Firecracker microVMs satisfy the isolation requirement without sacrificing start speed
Firecracker makes dedicated-kernel isolation practical with a virtual machine monitor built for the job, with minimal device emulation and a fast startup path. Each microVM boots its own guest Linux kernel with hardware-enforced isolation. Its per-VM memory overhead is small. Together, these let many isolated environments share a host while keeping the isolation layer itself from taking up most of the memory.
The startup path also supports bursts of microVM creation rather than requiring a slow provisioning cycle for each new agent. AWS uses Firecracker underneath Lambda, demonstrating that the mechanism can support production serverless traffic at hyperscale. This also clarifies the comparison with functions. The limitation of a function-based agent architecture is not necessarily its underlying virtualization technology, but the lifecycle and state model exposed to the application. Even a fast microVM cold boot leaves application setup to address, and repeating that work whenever a mostly idle agent wakes creates a fleet-wide latency and cost problem.
Snapshot-restore as the mechanism that makes idle economics viable at fleet scale
Snapshot-restore makes initial setup reusable across later resumes. A snapshot captures VM memory, CPU registers, and device state so that restoration need not repeat the full cold-start path. Copy-on-write mapping allows restored VMs to share template memory until a guest writes to a page. Shared base images similarly reduce duplicated storage. Each agent’s incremental footprint can then reflect what it changes.
Fast restoration changes the scheduling decision. The economical pattern is to capture state, destroy the idle VM, release host resources, and recreate the environment when work resumes. While an agent waits for human approval, it can use snapshot storage instead of keeping compute reserved, whether the reply comes quickly or much later. Snapshot storage still has a bill, however, and suspended-agent growth makes its management an explicit operating responsibility.
What the managed-platform pricing spread reveals about the real cost of isolation choices
Managed sandbox pricing reflects how platforms implement isolation, pack workloads, and amortize snapshot overhead. KVM appears at both ends of the pricing spread, so the virtualization label alone does not explain the price. Density and lifecycle management help determine what the platform can charge without weakening its isolation boundary.
Agent duty cycles further complicate headline hourly comparisons. An agent runs a command, waits for a model response, then performs another action, making active compute only part of elapsed time. A managed premium can buy fast restoration, pause-with-memory behavior, and a control plane that the customer does not operate. Those are distinct services. A team choosing to build or rent must weigh whether its utilization and fleet size make it worth running those services itself, along with the raw host price.
How production platforms have implemented VM-per-agent in practice
Amazon Bedrock AgentCore gives each session its own microVM and supports extended execution. Microsoft Foundry Agent Service uses per-session VM-isolated sandboxes with files preserved across turns and idle periods. Vercel Sandbox brings Firecracker into the broader developer-tools ecosystem. These implementations converge on dedicated execution boundaries, although a per-session VM still needs durable state outside the session to become a persistent per-user agent.
Control Plane likewise places each sandbox in a dedicated Firecracker microVM, while Universal Cloud Identity supplies short-lived AWS, GCP, and Azure credentials. Google Gemini Enterprise Agent Platform provides a managed runtime with built-in sessions and long-term memory, demonstrating the related demand for lifecycle and state services without establishing the same isolation mechanism from the details given here. The production evidence supports a concrete conclusion. VM isolation is already an implemented baseline for multiple agent platforms.
State persistence beyond the sandbox: the agent memory and storage layer
A microVM provides an execution boundary, while a durable memory system preserves an agent’s work through host failure, VM recreation, or a later session. In production, state includes working memory, the goal stack, tool-use history, and file artifacts. Keeping these in a durable, versioned store gives the runtime a record of where the task stands, what succeeded, and what failed.
Credentials need a different kind of persistence. They must remain managed and rotatable rather than becoming long-lived tokens embedded in an environment. Claude Managed Agents introduced sandboxed execution and extended sessions in its public beta, with credential vaults added in a subsequent update. That progression reflects the broader requirement for persistent access without unmanaged secrets. Infrastructure for the Agentic Web: Gap Analysis and Architecture from the Agentverse Platform identifies the transition from ephemeral storage to an Agent Memory Cloud as a critical infrastructure evolution, placing the deficit at the platform level.
Tool integration and MCP in a per-agent, multi-tenant deployment
MCP connects agents to tools, but a default OAuth authorization does not by itself set the application’s tenant boundary. A shared MCP client can therefore undermine otherwise isolated execution. One tenant’s agent may act with another tenant’s credentials or receive another tenant’s data when the client configuration crosses those identities. The VM cannot repair a misbound external authorization.
The production pattern is to generate a separate MCP URL for each tenant and integration pair, then construct a tenant-specific client inside the request handler. This keeps the tool connection aligned with the identity making the request. Virtual MCP servers can further scope available tools to a particular agent role, limiting access to what that role needs. Smaller tool catalogs also use fewer tokens for tool definitions. Compute isolation, durable state, and tool authorization must all tie each action to the same agent and tenant.
The seven-layer agent cloud stack as the reference architecture for what production requires
The Agentverse paper lays out seven connected infrastructure layers. Agent hosting and compute provide execution, while the agent memory cloud preserves versioned state. Agent discovery supplies a semantic, trust-weighted registry, and agent communication supports multiple protocols, including A2A and MCP. Agent orchestration manages lifecycles at fleet scale. Agent economic primitives provide payment, billing, and metering, while agent security and governance establish identity, access control, and action-level audit.
A secure runtime cannot compensate for cross-tenant tool credentials, just as durable memory cannot compensate for an execution boundary that exposes neighboring agents. The paper’s audit identifies substantial missing capabilities, showing that a mature agent platform can still lack important parts of the stack. The changes it proposes cover storage as well as discovery, communication, orchestration, and economic services. VM-per-agent occupies the first layer, but its isolation guarantees are foundational because failures there propagate into the systems above it.
What self-hosting the VM layer requires and when it makes sense
Self-hosting transfers the control plane from the vendor to the platform team. The team needs a scheduler that creates, snapshots, destroys, and restores microVMs, together with storage management that tracks snapshots and deduplicates shared bases. Host placement must keep workloads isolated while packing them onto bare-metal machines to make good use of the space. Operational ownership includes on-call responsibility when that machinery fails.
The economic crossover depends on sufficient fleet size and utilization. Low microVM overhead and copy-on-write sharing can make dense self-hosted execution cheaper than a managed service, but those advantages do not remove engineering and operating costs. Data residency can independently decide the question when execution and state must remain within a specified perimeter. LangSmith Deployment offers fully self-hosted, managed, and hybrid paths, reflecting the same choice at the framework layer.
Building agent-native products on a VM-per-agent foundation
A persistent per-user agent can keep history, preferences, files, and unfinished tasks even after a conversation closes. It can complete work asynchronously and report back after the user returns. Its continuity is logical. Snapshot-restore and copy-on-write storage let the environment suspend between actions, so an idle user’s agent costs far less than reserved compute.
That foundation also changes how product capabilities can be defined. The application can expose discrete business actions, such as drafting a document or updating a record, through both its human interface and the agent’s tools, with the same action definition serving a button and an autonomous workflow. For teams building this way, the lesson is to make execution, state, and authorization part of the product architecture from the outset. The resulting primitive is an isolated agent whose work outlives the request that began it.


