Keeping Agent Tasks Alive Across Hours Without Serverless Timeout Anxiety
Durable execution or persistent machines: which one fits your agent.

Long-running AI agents need infrastructure that preserves progress. Durable execution works for tasks that can save state between short steps. Persistent machines fit agents whose state lives in a running browser, desktop, or process, especially when they must pause for people and resume hours later.
Why agents that run for hours break on serverless infrastructure
A fintech refund-dispute agent worked for six weeks when its job was a two-second classification step. Then the workflow grew to include investigation, and it failed halfway through the work. The classification step fit a short invocation. The investigation exceeded the scope of a short invocation, exposing a mismatch between the task and its runtime.
Serverless platforms make short-lived invocations economical by sharing capacity across many requests. Stateless execution, runtime limits, and cold starts follow from that design. But an investigation has no dependable finishing time. How long it takes depends on the model’s tool calls, provider latency, unexpected subagent branches, and whether someone has to approve the next action.
With those unknowns, the time budget the team can use is smaller than the advertised limit. It is whatever the team trusts will finish with enough margin on a bad day, which is hard to establish for an open-ended agent. A job can die at 1:58 while the model provider is slow, halfway through writing to three external systems.
What actually breaks when a long run dies mid-task
An interrupted run can lose four different things. The first is its reasoning trace, including the plan, retrieved documents, intermediate conclusions, and scratchpad built over dozens of steps. The second is the compute already spent generating that trace. A run that takes hours and builds up a large context costs a lot to repeat. The third is elapsed time, including the time of the person waiting for an answer.
The fourth loss is more dangerous than wasted work. It is the record of which side effects already happened. Steps 1 through 40 may have sent emails, written rows, called payment APIs, or opened tickets. If that record existed only in process memory, a restart can repeat those actions. An agent that dies at step 41 may already have charged the customer.
A timeout is only one way to reach that point. Deploys, provider rate limits, scheduler evictions, spot reclaim, and out-of-memory kills can also interrupt a long run. More time exposes the task to more opportunities for interruption, so avoiding one deadline does not establish reliable completion. What infrastructure shape lets a failure at a late step avoid redoing all the steps before it?
Why raising the timeout is the wrong response
AWS Lambda’s execution limits have grown from a few minutes at launch to longer windows available through Lambda Managed Instances. That gives individual invocations more room, but it does not preserve their progress after a crash, redeploy, or transient error. A later deadline is still a deadline. AWS also warns that longer-running functions widen the window for retries and duplicate deliveries, making idempotency essential for payments and database writes that must not happen twice.
Teams can assemble their own recovery system from a queue, a checkpoint database, a cron poller, and retry-with-backoff logic. But that system is no longer just a function with a changed setting. It is a separate layer built to remember progress and coordinate recovery. Statelessness is still useful for request-and-response work. Statelessness cannot safely support a session whose state must persist.
The two architectural responses: durable execution and persistent machines
Durable execution records progress at step boundaries. When a step fails, the runtime retries that step. Developers still own idempotency for side-effecting operations. A workflow can also suspend while waiting for an approval or event, with no compute running during the wait. But each step must still finish before the host’s timeout or run on a long-lived worker.
Persistent machines preserve a different unit of work. They give the agent a process, container, or micro-VM that remains available across the session, keeping its in-memory state and file system between steps. This fits rich in-memory loops and running desktops. The tradeoff is paying for reserved compute while the agent waits.
The decision belongs to each agent. Discrete, event-driven tasks can use serverless or durable execution while stateful sessions use persistent machines. Most production teams mix these approaches. Sleep and resume narrow the cost difference when a persistent machine can stop consuming billed compute while idle and wake in about a second. That turns persistence into something other than a permanently running server.
How Firecracker micro-VM snapshots make sleep and resume practical
Firecracker snapshots preserve a micro-VM’s execution state so it can resume. During restoration, Firecracker memory-maps the snapshot file, loads the CPU state, and continues execution from the saved point. It does not boot a kernel, run init, or reinitialize the agent. The distinction is small in wording but large in behavior.
A cold pod schedule takes seconds and produces a new process. A Firecracker resume can take sub-second time while restoring the machine’s memory and disk state, including its variables and file handles. This is the mechanism behind practical sleep and wake. The runtime can stop active execution without requiring the agent to rebuild its working environment.
DigitalOcean’s Managed Agents public preview in 2026 aims to complete a full warm-path restore in well under a second, measured from resume to ready. AWS’s AgentCore documentation says its micro-VM compute is ephemeral by default and requires session storage for files to persist across stop and resume. The label “micro-VM” alone does not promise persistent state.
What persistent machines unlock that checkpointing alone cannot
Computer-use agents hold state outside a normal workflow’s saved inputs and outputs. A browser or desktop session has a rendered screen, a cursor position, a DOM, and open application windows. A step checkpoint does not preserve that running environment. Microsoft’s UFO³ coordinates GUI agents across Windows, Linux, and Android by splitting the work into dynamic task graphs and running steps that do not depend on each other in parallel. Each device agent still needs the environment in which its interaction takes place.
Healthcare, lending, insurance, and property management workflows can depend on EHR systems, loan origination software, document management systems, and Citrix/VDI sessions that cannot be driven through an API. OpenAdapt automates interface-only work across browsers and desktop environments by turning a user demonstration into a verifiable workflow. Here, dependable and attributable execution takes priority over free improvisation. Reconstructing a desktop between actions is not the same as preserving it.
Sensitive data adds a separate constraint. HIPAA’s minimum necessary standard, 45 CFR 164.502(b), requires PHI access to be limited to what a specific task needs. The Security Rule also requires audit-control mechanisms that record access and make it examinable. A machine for each agent session gives that work a clear boundary, though isolation alone does not meet those obligations. To meet those obligations, healthcare agents need graduated autonomy, from retrieval and summarization they do on their own to drafting under supervision and clinical or patient-facing actions that a human must approve.
AWS Step Functions Standard Workflows can run for up to one year and wait on a callback task token without compute running. That preserves workflow progress. A sleeping machine can instead preserve the agent’s signed-in browser, open files, and application state. Because that desktop remains a real environment, a human can also see it and take over when the agent needs help.
Running many agents in parallel: swarms, evals, and RL rollouts
The Holistic Agent Leaderboard at ICLR 2026 validated its harness with tens of thousands of agent rollouts across coding, web navigation, science, and customer service. Each rollout needs an isolated environment for a valid result. Persistent micro-VMs provide a way to keep each run’s state separate while allowing thousands of sandboxes to operate in parallel.
Training workloads can use the same shape. MarsRL runs different stages of different rollouts concurrently, reducing the cost of subagents sitting idle. Machines that sleep between stages and wake quickly fit that pattern. The Kimi K2.5 technical report from January/February 2026 describes a trainable orchestrator spawning specialized subagents in parallel while those subagents remain frozen during training. Each worker can have its own stateful environment without forcing the entire swarm into one shared process.
Scale also makes weak spending controls dangerous. A documented two-agent loop spent a large sum over many days even with dashboards running. Spending limits need to stop a call before it is sent. With per-second metering and sleep behavior, it is easier to work out each agent’s compute costs, while tenant-level concurrency controls and provider-matched throttles keep fan-out within the capacity available. Without shared flow control, agents back off and retry independently, turning a provider limit into a bottleneck for the swarm.
How to decide which infrastructure shape a given agent task needs

Three properties organize the choice, namely duration, state, and wait type. Duration is how long each piece of execution takes and whether it fits an invocation. State is what must be saved to keep a faithful record of progress at step boundaries. Wait type depends on whether the task needs only a future event or a live environment kept until someone returns. Total elapsed time alone is not enough.
For short, bursty, event-driven work, serverless remains a good fit. The fintech classification step is the archetype because it finishes quickly and has no desktop to retain. Durable execution helps when retries or waits need to be coordinated across several such steps. There is no reason to reserve a persistent machine merely because an agent is involved.
For multi-step loops with serializable state, durable execution solves the majority of step-based work. The workflow can outlast any individual invocation because no invocation holds the whole job. Human approval waits do not incur compute charges. Every executing step must remain within its host’s allowed window.
For rich in-memory sessions, computer use, legacy GUIs, or tool calls that exceed a step’s window, a persistent machine fits better. A persistent machine also fits when a human needs to take over. Sleep and resume can keep that environment while it is idle without charging for active compute the whole time.
The orchestration layer needs careful selection while models, prompts, frameworks, and sandbox providers remain swappable. That layer coordinates work across runtimes and is harder to replace. Seeing every agent and stopping misbehavior requires unified observability rather than separate views of the orchestrator and the sandbox.
What the persistent-machine model changes about how agent products are built
A persistent-machine model lets a product treat the agent’s environment as part of the task. An agent can wake on a schedule, do work, and sleep until its next trigger while retaining applications, browser sessions, and accumulated context. With per-second metering and no idle charge during sleep, the cost tracks the time spent on active work.
This lets the agent session outlast one function’s execution window while recovery and side-effect safety remain necessary. Durable execution is still the right foundation when saved steps hold everything needed to go on. A persistent machine serves the work whose environment is itself part of the state.
For products handling healthcare, lending, or insurance data, that environment can also become a per-user or per-task isolation boundary. A dedicated micro-VM without a shared kernel separates one session from other tenants and gives auditing a clearer scope. An operator can observe, correct, and hand the desktop back, making supervised autonomy a natural part of how the product works.


