Why Browser Agents Exhaust Serverless Timeouts Before a Single Workflow Completes
Browser sessions need persistent infrastructure, not serverless functions with fixed timeouts.

Browser agents exhaust serverless timeouts because a stateful browser session does not fit a bounded function invocation. Navigation, reasoning, authentication, and waiting consume one execution budget while accumulating state that a retry cannot simply recover. Persistent AI agent infrastructure matches this workload by preserving the browser process across steps and pauses, while serverless functions remain appropriate for short, stateless tasks.
Why a browser session is not a function invocation
A serverless invocation follows a request-response contract. It starts, executes, and terminates, with billing tied to execution time and no guarantee of process memory between calls. That contract fits work whose inputs and outputs make up one complete unit of execution. A browser session has a different boundary. Its unit of work is a running process whose accumulated state must survive until the task is complete.
That state includes cookies, localStorage, authenticated context, an active CDP connection, and DOM scroll position. Each interaction relies on what the earlier ones left in place, and there may be no way to know how many steps are left. The process is part of the task. Treating the process as a series of independent requests changes both the workload and where it runs. A longer timeout leaves that distinction intact.
How the clock runs out phase by phase in a real browser workflow
A browser workflow begins by navigating to a page and waiting for the DOM to become ready. Heavy pages, redirects, and third-party scripts add latency outside the agent's control. Reasoning then consumes more of the same budget. browser-use exposes a default step_timeout and an llm_timeout, whose default of None resolves internally to a model-dependent value. These per-step controls set no time limit for the whole task, because each new navigation and reasoning step takes more time.
Authentication interrupts that sequence with work needed before the agent can proceed. Login flows, MFA prompts, and session expiry can branch into sub-workflows that delay the original task. Approval introduces a less predictable delay still. A human-in-the-loop gate, confirmation dialog, or asynchronous backend response may require seconds, minutes, or hours of waiting. The invocation clock continues to constrain the task even though the agent cannot make progress.
Once the workflow resumes, form completion introduces sequential field interactions, file uploads, and validation loops. None needs to be unusually slow. A document workflow can chain dozens of these interactions, with reasoning and page waits recurring between them. An ordinary task can outlast an invocation budget without containing a single pathological operation.
What the platform limits actually look like against these durations
AWS Lambda imposes a 15-minute hard cap on a single invocation. A browser task that exceeds that duration cannot finish inside one call, regardless of how its individual step timeouts are configured. Cloudflare Workers imposes a per-request CPU time limit on its standard plan, a separate constraint on computation. The distinction is important because waiting time and active processing consume different kinds of budget.
Amazon Bedrock AgentCore has a fixed standard synchronous request timeout, regardless of conversation activity. Continued interaction does not keep the primary WebSocket connection open indefinitely for one unit of work. Long-running tasks need an asynchronous pattern because synchronous execution has a time limit. These limits serve their intended workloads. The mismatch appears when an agent treats a bounded request as the lifetime of its browser session.
Concurrency can expose another constraint before duration does. A browser-use production case involved a FastAPI service handling 8–12 concurrent agent requests with single-threaded workers. It produced no crash logs or exceptions, only silent timeouts and “session closed” warnings as the internal CDP connection limit was exhausted.
What state loss actually means when an invocation expires mid-session
When expiry terminates the browser process, its unsaved state disappears with it. Authenticated cookies, localStorage, the active CDP connection, partially completed forms, scroll position, and intermediate files or context may all be lost. A retry is not a resume operation. If the session state has not been saved, the agent must re-authenticate, navigate back, and repeat the steps it finished before it can reach the step where it stopped.
A fintech refund-dispute agent illustrates how this problem emerges in production. Its initial job was a webhook task that classified a dispute in two seconds. Investigation changed the shape of the work. When the agent needed multi-step state, the team split the workflow into chained functions that saved state after each step. A coherent agent task became manually managed distributed infrastructure because its execution environment could not preserve the session as one unit.
The damage also extends beyond lost progress. Forced restarts repeat per-step LLM calls and incur their inference costs again. The concurrency case also showed how silent timeouts and process leaks can make it hard to find what went wrong under load. The operational burden is therefore twofold, involving recovery of unfinished work and cleanup of resources that failed to terminate correctly.
Why extending timeouts and chaining functions do not solve the structural problem
Extending a timeout gives an invocation more time, but it does not give the browser an independent lifetime. A maximum-duration configuration still has a hard boundary. A human may take hours or days to approve the work. No timeout adjustment turns that pause into a reliably bounded request, and the browser's state still needs somewhere to exist while the task waits.
Chaining functions moves the boundary. Each handoff requires enough state to be serialized and restored for the next invocation to continue. A browser session is not a JSON document. Saving cookies or task variables does not cleanly transfer a live DOM and CDP connection. The application must also track completed chunks and retry the appropriate ones, effectively building a workflow engine around the agent.
Durable execution is a genuine improvement over naive chaining. Checkpoint-per-step and suspend-on-wait frameworks save the workflow's progress so that teams need not write code by hand for every recovery decision. Their unit of persistence is still different. Serializable step state does not natively preserve a live browser process across suspension boundaries. Chained execution can also encounter concurrent-session quotas, including AgentCore's Code Interpreter limit, adding a capacity bottleneck to the original lifetime problem.
The infrastructure primitive that actually matches the session model: the persistent micro-VM
A persistent micro-VM gives the browser a process lifetime that spans the task. Between active steps, the browser can retain its authenticated context and CDP connection without serializing the session into application data. The filesystem persists with the process. Dependencies and intermediate files remain in the same environment throughout the workflow, removing the need to reconstruct that environment at every invocation boundary.
An isolated kernel addresses a separate requirement of multi-tenant agents. The hypervisor boundary separates one agent's browser state, credentials, and filesystem from another agent's environment. Persistence alone would not provide that separation. Together, process continuity, a real filesystem, package installation, and kernel isolation make the micro-VM a contained execution unit for a stateful session. Snapshot-restore scheduling then allows that unit to stop consuming active compute while idle.
DeltaBox's 2026 research at Shanghai Jiao Tong University demonstrates the checkpoint-restore performance frontier. Its DeltaFS and DeltaCR implementation on Firecracker micro-VMs achieves a mean coupled checkpoint of approximately 14ms and a P95 restore of 6ms or under. The reported Docker-based baselines take substantially longer to checkpoint and restore. These results apply to the research setting.
How snapshot-restore scheduling changes the economics of keeping agents alive
In a snapshot-restore model, the scheduler checkpoints an idle micro-VM to disk and charges only storage during the pause. When the micro-VM wakes, it gets its saved execution state back. This replaces two expensive alternatives, which are keeping an idle environment running or discarding it and later repeating the work needed to rebuild the session.
For most agent workloads, waiting occupies much of the agent's lifetime. While waiting for user input, backend responses, or the next task, the process is idle even though its state is still worth keeping. Storage becomes the dominant idle resource. Preserving that state also avoids the repeated LLM calls and navigation imposed by timeout-driven restarts.
With these costs, each user can have one isolated micro-VM that hibernates when idle. The operational pattern combines a persistent session setting with a hard TTL backstop. Active work retains the session, inactivity triggers hibernation, and the TTL limits the lifetime of a hung agent.
When serverless is still the right choice and how to route between the two models
Serverless still costs less and is simpler to use for short, stateless, event-driven agent work. Classification, summarization, short-form extraction, and triggers can fit in one invocation without needing a browser process to stay alive. The refund-dispute agent's classification stage demonstrates that fit. It ran cleanly on serverless for six weeks before investigation introduced a different execution requirement.
Short tasks with no cross-step state belong on serverless, while workflows that navigate multiple pages, retain authentication, wait for approval, or resume after indeterminate pauses belong on persistent session infrastructure. Durable execution also fits work whose progress can be saved as checkpointed steps. These models can coexist in one production system, with the choice made per agent.
Micro-VM orchestration nevertheless introduces real engineering overhead. Snapshot lifecycle management, per-user fleet tooling, and VM provisioning are responsibilities that serverless avoids. The tradeoff is fixed infrastructure work versus retry and re-authentication costs that recur with users and tasks. A team whose workload fits a single stateless invocation has little reason to accept session-management machinery it does not need.
What the right infrastructure stack for a browser agent looks like in practice
For a team deploying stateful browser agents, the implementation should assign a distinct responsibility to each layer. browser-use can provide the agent loop and page interactions, while the host environment provides session persistence. Automation tooling cannot manufacture a persistent process from a stateless invocation. A persistent micro-VM platform is a first-class option for running this work, with each session in its own environment that has an isolated kernel, persistent disk, and package installation rights.
Concurrency control must operate within that execution design. A semaphore gate bounds simultaneous browser work, while context-manager cleanup and explicit teardown in a finally block prevent timeout paths from leaking resources. Persistence does not remove cleanup obligations. The scheduler should checkpoint idle environments and restore them on wake, while user and task metadata support audit and billing. A TTL backstop bounds the lifetime of sessions that no longer make progress.
Model Context Protocol gives LLM-driven agents an interface through which they can use browser actions. That separation lets the reasoning layer and infrastructure layer change on their own while keeping tool access distinct from how long the process lives. The deployment boundary follows the session. Serverless handles bounded, stateless work, durable execution preserves discrete workflow progress, and persistent micro-VMs hold the live browser state that neither an extended timeout nor a chain of calls can preserve on its own.


