Five Agent Behaviors That Are Impossible to Ship Reliably on Serverless Infrastructure
Serverless can't hold the state, isolation, or desktop agents need.

Persistent AI agent infrastructure and serverless functions serve different workloads. Serverless functions suit short, independent requests, while agents need execution state that survives pauses, isolated code execution, and sometimes a real desktop. The five behaviors examined here require a persistent, resumable computer.
Why serverless infrastructure was not built for agents
The original serverless contract is simple. A function receives a request, runs briefly, returns a response, and disappears. State lives elsewhere, idle time is free, and each invocation stands on its own. That contract works well for API handlers, event processors, and webhooks because their work can fit inside a short, self-contained execution window.
Agents break that contract in several connected ways. They plan, call tools, read documents, write to systems, and coordinate with other agents over minutes or hours. They also hold state across sessions and take actions with real-world consequences. Those actions still stand when the function restarts. So a cold start is not always a clean retry.
A longer execution window does not preserve a desktop after shutdown, and a database does not turn an in-progress subprocess into something a new invocation can resume. Containers, session-based authentication, and ephemeral execution contexts do not by themselves supply continuity. The underlying requirement has shifted from running a request to maintaining a working environment across time. Each of the following behaviors exposes a different consequence of that shift.
Persistent state: what happens when a long-running agent meets a platform that forgets everything
An agent reaches a step that needs human approval, then waits until its function times out. Without saved state, it must restart from scratch. The agent can lose the last answer it generated. It can also lose the files, running processes, browser session, and in-memory context that made the next action possible. The approval arrives, but the working environment is gone.
Serverless handles state by moving it elsewhere. Before a function exits, it writes data to a database or object store, then reloads that data on the next invocation. That works for a web request, but an agent’s state extends beyond variables. Open file handles, authenticated browser sessions, installed packages, and in-progress subprocesses cannot all be serialized into application records and faithfully rebuilt. Reconstruction adds latency and complexity as the task grows.
On platforms that charge for execution time, an agent waiting for a person or a slow API consumes a running allocation without making progress. An execution limit can still force it to restart later. The choice becomes paying for idle compute or rebuilding the environment after a pause.
VM-level checkpoint and resume changes that choice. Firecracker microVMs can restore saved memory state, but the infrastructure around them must separately save and clone the contents of the block devices that state refers to. A parked agent then incurs storage costs with no running allocation of RAM and vCPU. Restore can take tens-of-milliseconds, though the time it takes depends on the full orchestration path.
Checkpointing still requires careful engineering because rollback can break dependencies behind security-relevant state. It is not a guarantee of correctness. Incremental capture can also reduce the work by saving only what changed between checkpoints, with that work hidden under model inference time. With memory and disk state preserved together, the agent can pause and resume with its files, packages, browser session, and working context intact.
Sandboxing LLM-generated code: why execution-time isolation cannot be faked at parse time
A code-generating agent becomes a security problem when its output can reach internal services, databases, or CI/CD systems. The generated code is not trusted application code. An adversarial prompt can steer a model toward output that bypasses regex checks or parse-time filters. If the execution environment grants that output access to internal infrastructure, rejecting suspicious text earlier is not a dependable boundary.
Filtering and isolation do different jobs. A filter can reject obviously unsafe patterns before execution, but it cannot establish what arbitrary code will do once it runs. That boundary has to hold at runtime. A failure there can lead directly to Remote Code Execution on the host, so the environment must contain the code even when the input checks miss it.
Containers rely on host-level kernel namespaces and share the host kernel. So a container escape vulnerability can let code cross the boundary between tenants. Docker can suit controlled environments where code comes from trusted sources, while Firecracker provides stronger isolation with some additional startup latency.
A microVM gives each sandbox its own kernel. That takes away the shared host-kernel surface that code inside a container can reach, and strict network policies limit which systems the sandbox can reach. Both controls are needed.
The resulting architecture uses parse-time filtering for early rejection and runtime isolation as the actual security boundary. Each task gets a disposable sandbox, deleted with its disk when the task ends. This does not conflict with persistent execution. State survives for as long as the task needs it, but it does not linger afterward as residue for the next task.
Computer-use agents: why GUI automation requires OS-level hooks that serverless functions cannot expose
A computer-use agent needs to see, click, and type on a real desktop. Stateless functions have a capability gap in providing the real desktop a computer-use agent needs. When the required display server, accessibility layer, and persistent process tree are absent, making the function faster cannot make GUI automation work inside it.
These agents operate browsers, desktop applications, and legacy enterprise systems through their interfaces as well as APIs. Their controls can depend on Windows UI Automation, macOS AXUIElement, or Linux AT-SPI. Those are operating system hooks. They expose parts of a live application environment that must remain available between the agent’s observations and actions.
Microsoft’s UFO² Desktop AgentOS illustrates this dependency. It uses Windows UI Automation along with vision-based parsing and native app APIs, so the agent’s control loop depends on a running desktop. A picture-in-picture virtual desktop likewise has to remain live for the task, because a cold restart would destroy its window state mid-session.
The infrastructure requirement follows directly from that dependency. An agent needs an isolated VM with a real display server and an operating system environment suited to the application, including Linux, Windows, or Android. Its session may last minutes or hours. If a person needs to take over, the same desktop must also be live and streamable so that the person can see and interact with the environment the agent was using.
Eval and RL rollouts at scale: the combinatorics that break serverless cold-start economics
Consider a coding-agent reinforcement learning run that needs hundreds of environments forked from the same repository state. Each environment must start from the shared base, run its own episode, and remain isolated from the others. Larger evaluation and training pipelines need thousands of these environments to run at the same time. Startup overhead adds a cost to every experiment, so it is more than a small cost paid once.
The useful pattern is to fork a warm snapshot, run episodes, collect results, and update the policy. Copy-on-write makes this practical. Each environment shares the base and diverges only where its execution writes new state, so memory overhead tracks that divergence rather than a separate full copy for every environment. The fork must also be fast enough to keep setup from taking up most of the work.
Serverless creates two separate obstacles here. Cold-start latency and per-invocation overhead add repeated preparation costs across the rollout fleet. Even when environments start in parallel, each rollout still has to wait for its own environment to be ready. The contrast between a 150ms microVM restore and a 60-second full boot cycle becomes operationally significant when repeated across large numbers of short tasks.
Execution duration creates the second obstacle. A rollout that exceeds a function’s time limit must be split into chained invocations, interrupting the continuous execution context the workload needs. Faster startup does not solve that problem. The rollout needs a persistent worker that can keep running until the episode ends, rather than a succession of functions reconstructing its state.
A heavily optimized microVM stack can provide sub-10ms cold starts, sub-10ms scale-to-zero, and millisecond snapshot and fork operations.
Automating legacy desktop apps in regulated industries: where the serverless gap has direct operational consequences
Scheduling automation in an EHR with no API has to work through the application’s interface. The agent needs a live desktop, a session that survives between actions, and enough continuity to wait when a person must intervene. A function that disappears mid-task cannot supply that combination on its own. Here, losing execution context affects an operational workflow.
The same infrastructure problem occurs in healthcare, lending, insurance, and property management systems built around legacy applications. EHRs, Citrix environments, and loan origination systems combine GUI interaction with persistent state and sensitive access. The requirements arrive together. A platform cannot treat desktop control as one optional feature and continuity or isolation as unrelated additions.
Compliance adds controls across the whole environment. HIPAA requires minimum necessary access and least-privilege execution, including within sandboxes. For the agent, that means a dedicated, isolated session with network access scoped to the systems it is authorized to reach. A sandbox with broad internal access would break that restriction even if the application-facing permissions looked narrow.
The audit trail must cover the actual execution. It needs to establish which screen states the agent observed, which actions it took, and which PHI it touched. Without a persistent, observable, isolated environment, that record is difficult to make authoritative. Infrastructure-level logging and immutable audit trails belong with the desktop session, rather than being treated as a substitute for preserving it.
Human takeover completes the operational requirement. A clinician or compliance officer needs a path into the same desktop when intervention is necessary. Across concurrent patient workflows, the platform must also preserve isolation and continuity at scale. Regulated work is where all five behaviors converge into one demand for persistent state, strong sandboxing, GUI access, concurrent execution, and a full audit trail that stateless functions alone cannot provide in combination.
What the right infrastructure shape looks like across all five behaviors
A suitable agent platform provides a persistent, resumable, strongly isolated computer for the lifetime of a task. VM-level snapshots allow the environment to sleep without losing its working state, while task completion gives the platform a clear point to delete the sandbox and its disk.
The computer must expose the capabilities its workload needs. For GUI work, that means a real operating system, display server, and accessibility APIs. For untrusted code, it means a separate kernel and limits on which systems the code can reach through the network. For fleet-scale evaluation, it means using copy-on-write cloning from warm snapshots so each environment can start without the wait for a full boot. Audit logging and human takeover must follow the session when the work requires them.
Billing must follow that lifecycle as well. A sleeping agent should cost storage, while an active agent should be billed for the seconds it runs. Otherwise, time spent waiting for human approval or slow external systems leads to charges for idle compute. Per-second metering ties the cost to actual work at the per-user or per-task level instead of forcing a choice between keeping state and avoiding idle allocations.
The model should remain separate from the machine. The platform supplies the persistent VM, desktop, accessibility layer, isolation, and audit trail, while the developer brings the model and keys. That keeps the execution environment free to work with more than one model provider. More fundamentally, it lets the model decide what to do while the infrastructure preserves the computer on which the work happens.


