Escaping Lambda Timeout Hell by Giving Each Agent Its Own Persistent VM
Persistent VMs solve the architectural mismatch between stateless functions and long-running agents.

Persistent AI agent infrastructure differs from serverless functions because it preserves a working environment across tasks, rather than treating each invocation as the unit of execution. Lambda’s 15-minute limit exposes that architectural mismatch. For agents that need long-running processes, interactive terminals, and state between turns, the solution is a persistent VM per agent.
Why agents are not functions, and why that distinction has infrastructure consequences
A function processes a discrete call, while an agent maintains a session. Lambda fits event-driven, invocation-scoped work well. An agent, however, behaves more like a developer inside a machine, installing dependencies, editing files, starting services, watching logs, and retrying failed commands. Those actions depend on what was set up earlier in the session as well as the inputs to the latest call.
Agents in the Large: Perception-Centered Architecture for Persistent Agents makes a further distinction between a longer-running task and a persistent agent. The latter organizes conditions and relationships that extend beyond any individual task. Its scope is the long-lived setting itself. AWS documents Lambda’s execution environment around initialization, invocation, and shutdown, with environments potentially frozen after an invocation and reused later. That lifecycle serves discrete calls, but reuse is not the same abstraction as a workspace whose continuity belongs to the agent.
What actually happens when an agent hits the 15-minute ceiling
The failure pattern has acquired a name in 2026 production circles, “the agent that disappears at the timeout.” A 70-person SaaS company encountered it with a research agent that needed well beyond Lambda’s time limit to produce a prospect briefing. Lambda killed the agent mid-run. The resulting briefings arrived half-written, with no way to resume the work that had already consumed execution time.
The company first tried splitting the research into shorter invocations run by a coordinator. When one chunk required more research than its allotted time allowed, the same failure returned at a smaller boundary. The coordinator could restart the chunk from scratch, but it could not resume inside it.
The same pattern applies to a research agent midway through a lengthy synthesis or a migration agent that has moved tens of thousands of records before disappearing. These are common forms of work that takes a long time. They may take longer to finish than a platform allows for an invocation. Each attempted fix added machinery without changing the underlying mismatch between a continuing session and a disposable execution window.
Why the standard workarounds add complexity without fixing the mismatch
Durable execution addresses resumability, but it does not supply the workspace in which an agent works. A coding agent needs project files, package caches, generated artifacts, logs, local databases, and failed attempts it can inspect. A support agent may need a terminal that a human can reattach to.
Inngest limits runs to 1,000 steps per function, so an agent that needs more steps must have its work split across functions. The developer then owns the state transferred between them. This does not make the tool unsuitable for orchestration.
The resulting architecture can accumulate queues, databases, object storage, retry handlers, idempotency keys, cleanup jobs, and coordinator functions. Each component closes a particular gap. Together, however, they can amount to rebuilding a computer around the agent without providing a live machine. Better coordination cannot, by itself, turn invocation-scoped execution into a persistent terminal, filesystem, and process environment.
What a persistent VM actually gives an agent that a function runtime cannot
A persistent VM makes the session the unit of infrastructure. The workspace is created, the agent runs, and the machine remains available while work needs to continue. It can stop to save resources and start later with state preserved. When the session is finished, it can be deleted. Running, stopping, resizing, and forking become operations on the agent’s existing environment, preserving it through each operation.
That environment gives concrete meaning to persistence. An agent can accept SSH sessions and network traffic, while a fork lets it explore alternatives from the same starting state without replaying setup. A project directory remains a normal Linux filesystem containing dependencies, generated artifacts, logs, browser profiles, and local databases. Failed attempts remain available for inspection. Git provides the durable review layer, while the VM provides the live workspace.
The terminal is more than a command endpoint. A persistent PTY supports an interactive shell that survives client disconnects, VM suspends, and VM forks. That fits programs such as package managers that ask questions, REPLs that keep values, debuggers that keep stack state, and development servers that stream logs. Test watchers can wait for file changes in the same environment. If these interactions run as separate function invocations, the application has to keep terminal state outside the machine.
How Firecracker makes per-agent VMs economically and technically practical

Firecracker changes the cost and startup assumptions behind giving every agent a VM. It takes approximately 125ms to boot and has approximately 5MB of memory overhead per microVM. Snapshot restore is faster still. A restore takes roughly 28ms total, including approximately 5ms for process startup, 8ms for mapping the memory snapshot, 10ms for restoring CPU and device state, and 5ms for vsock reconnection.
Density changes the economic comparison as well. An 80GB host can hold approximately 1,778 microVMs at approximately 45MB each, which is about the same density as Docker containers and comes with VM-level isolation.
Snapshot-fork also differs from maintaining a warm pool. The environment boots once, freezes, and can then be restored from that state in tens of milliseconds. Copy-on-write lets an agent branch memory and disk cheaply, making it practical to try five fixes from the same starting state and keep the one that passes.
Each workload has its own kernel running through KVM hardware virtualization. A successful kernel exploit gives an attacker root inside that VM alone, with the host or neighboring workloads still protected by the hypervisor. Reaching those requires a separate hypervisor escape. That additional boundary is central when agents execute untrusted or LLM-generated code.
What AWS’s own Lambda MicroVMs announcement reveals about the direction of the industry
AWS launched Lambda MicroVMs on June 22, 2026, giving each user or session an isolated Firecracker VM with state that persists for hours, snapshot boot in seconds, and no infrastructure to manage. The distinction from a function is architectural. The developer receives an environment for a session rather than merely an invocation within an environment.
The comparison with AgentCore Runtime concerns control inside that boundary. AgentCore Runtime provides a managed container inside a microVM, while Lambda MicroVMs exposes the fuller machine. The latter permits direct /dev/ptmx access, a developer’s own Docker daemon, and low-level network stack manipulation. The isolation technology is the same. The available operations are not.
The product boundaries are not simply “short” versus “long.” Both services share the same maximum duration for their default serverless microVM compute type, while AgentCore Runtime also offers longer-lived Runtime Instances, generally available in August 2026. Both added interactive shell support in June 2026. Their availability differed as of August 2026, with Lambda MicroVMs in a handful of regions and AgentCore Runtime in a substantially larger set, including GovCloud US-West.
The strongest signal is the primitive AWS chose. The company behind Lambda introduced a way to give agents their own VM. That choice recognizes the session as an infrastructure boundary in its own right.
The economics of per-agent VMs, and why idle cost is the number that actually matters
The managed agent-sandbox market has a wide spread of prices for equivalent compute in 2026. An always-on model consumes compute in proportion to the total number of open sessions, even when most agents are waiting. With a hibernate-and-wake model, compute use tracks more closely with the share of agents that are active. Idle time determines how far those cost profiles diverge.
Resource allocation introduces another source of waste. Platforms that size sandboxes for requested resources base their charges on how much capacity an agent is given, even when it uses less. Snapshots and copy-on-write invert that model. Instead of a full independent disk and RAM allocation for every session, the fleet can share a base image and retain the smaller set of divergences each agent creates.
Managed billing can complicate the comparison further. AWS AgentCore Runtime V2, which reached general availability on September 18, 2026, had higher CPU and memory list rates than V1 but a much faster cold start. V2 wins on compute cost only for long sessions with memory spikes, while short chat agents face a rate increase. To compare costs, the workload’s active time, idle fraction, and memory use all need to be weighed, since a faster runtime can still cost more.
What a per-user agent fleet actually requires at the infrastructure layer
Firecracker supplies the isolation primitive. Building directly on it means owning image distribution and caching, networking, orchestration, warm pools, autoscaling, observability, and incident response. Networking includes TAP interfaces, IP tables, and host routing. Firecracker’s design notes treat guest network traffic as untrusted and call for the host to filter it. A VM boundary alone is insufficient when agents can reach the public internet, internal metadata services, or private APIs.
Tenant separation adds another design decision. A silo model gives each tenant a dedicated runtime, separate IAM execution roles, and a dedicated gateway for tool orchestration using MCP. It provides the strongest isolation at the highest overhead. A pool model shares the runtime and gateway while partitioning memory by tenant context. That lowers overhead but requires careful credential scoping.
MCP’s OAuth flow authorizes the agent to the server, while authorization to the underlying API depends on what the server operator built. Multitenant authorization across a customer base is rarely part of the standard setup. At enterprise scale, absent native multitenancy, minimal authentication, and missing cost attribution per agent or tenant become separate infrastructure gaps.
Wake latency is part of the product contract. A per-user agent that takes seconds to wake on the first tool call feels broken, making sub-second snapshot restore a requirement. Managed infrastructure earns its value by taking on this work as well as providing a VM creation endpoint.
Deciding when Lambda is still the right choice and when the VM model is warranted
Lambda remains appropriate when the work naturally fits an invocation. Event-driven triggers, a file landing in a bucket, queue message processing, and scheduled short jobs can all fit that model when they complete comfortably within the timeout. Duration alone is not the entire decision. Choose based on whether the work needs a continuing environment or simply a bounded execution.
A persistent VM is warranted when an agent must run beyond the invocation limit without checkpointing, install dependencies, start services, or maintain processes between turns. The same applies when it needs a terminal a human can reattach to or must fork a known state to explore alternatives without repeating setup. Running untrusted code is another reason to use kernel-level isolation.
Durable execution remains a valid complement to that environment. It handles resumability and exactly-once side effects in orchestration logic, while the VM supplies the filesystem, terminal, kernel, and isolation inside each step. The two abstractions can work together. A warning sign is an architecture that increasingly reconstructs a machine through external state stores, checkpoint logic, and coordinator functions.
The clearest case is a product with one persistent agent per user. Each agent needs continuity while active, economical suspension while idle, and a fast return to its own working environment. For that workload, the persistent VM provides a way around Lambda’s timeout and serves as the product primitive around which the agent fleet is built.


