The Sandboxed Execution Primitives That Production Agent Platforms Standardize On

Production agent platforms pair microVMs with lifecycle, storage, and egress controls.

· 9 min read
Cover illustration for “The Sandboxed Execution Primitives That Production Agent Platforms Standardize On”
Sandboxed Code Execution · November 17, 2026 · 9 min read · 2,098 words

Persistent AI agent infrastructure must run untrusted generated code and keep work across turns, which sets it apart from serverless functions. Production agent platforms standardize on four primitives to meet that need, namely microVM isolation, per-task lifecycle management, persistent filesystem state, and controlled network egress. Long-running agents fail on stateless infrastructure when execution requirements for task state, suspension, and network policy are handled through application workarounds.

Why agents executing generated code need a different trust model than stateless compute

A stateless web handler runs code that a human has reviewed. A code-executing agent runs output that a model has produced. That output may contain bugs, injected instructions, runaway loops, or unintended network calls, so the model cannot serve as its own security boundary. The boundary has moved to the host environment. Sandboxing is therefore an infrastructure requirement.

The agentic security survey identifies prompt injection as a primary attack surface in the agent loop. An injection can redirect what the agent does within a turn, beyond what an instruction to “behave safely” can reliably prevent. A plain container inside the application’s network can expose credentials and paths into other systems to that generated code. Process separation alone does not deal with the risk of a shared kernel. Retrieval-only agents do not necessarily need the same protection, but the trust model changes once an agent can write files, install packages, or execute shell commands.

Why the isolation layer is not a single choice but a ranked spectrum

Isolation technologies rank by their separation from the host. V8 isolates sit at the lightest end, running JavaScript within the same process. Shared-kernel containers add namespaces, cgroups, and seccomp, but retain one kernel with the host. gVisor places a user-space kernel between the workload and host syscalls, trading some compatibility for a stronger boundary. MicroVMs such as Firecracker and Cloud Hypervisor give each workload its own guest kernel behind a hypervisor.

Those differences determine what a compromise can reach. A kernel exploit from a shared-kernel container can threaten the host and other tenants on the node, while a microVM’s normal guest-kernel paths do not lead into the host. The choice is not merely performance tuning. A read-only report reader can use a lighter container, while the brief’s strong-isolation requirement for generated-code execution calls for a microVM. The workload’s powers set the minimum protection.

Rethinking AI Cloud Infrastructure for Agentic Serving Systems with the Aries Experimentation Framework, presented as Aries at SoCC’26, exposes stateful tool execution through a consistent interface across different sandbox substrates. That approach accommodates mixed isolation tiers.

Why microVMs became the production default for strong isolation with sub-second startup

MicroVMs made the strong end of that spectrum practical for short tasks. Firecracker can boot a Linux kernel and begin accepting API calls in well under a second. Snapshot restore avoids repeating the whole boot process by resuming a prepared environment. This changes the cost of VM-per-task execution. A task can start from an environment with dependencies already installed, avoiding a rebuild each time.

Firecracker memory-maps the snapshot file, loads CPU register state, and resumes execution where it paused. The guest can detect the interruption through VMGenID and virtual clock notifications. Full snapshots preserve complete resumable state, while diff snapshots capture memory dirtied since the preceding snapshot and require merging before restoration. These mechanics let platforms choose between complete checkpoints and smaller incremental ones.

Aries observes long idle periods interrupted by short bursts of sandbox activity. Sleep-and-resume is a better fit for that pattern than keeping every VM warm. Snapshots add more to manage, but compute costs more if it keeps running through those idle periods. Sub-second startup makes strong isolation practical, while how well suspension works sets the cost of running it.

Why long-running AI agents fail on serverless infrastructure without explicit lifecycle management

Aries finds that current snapshot-based state management makes aggressive suspension costly. Strong isolation does not solve that problem. Isolation determines what a sandbox cannot reach, while lifecycle management determines when it exists, what survives between turns, and how it is destroyed. A platform needs both.

An ephemeral lifecycle creates the sandbox at task start and deletes it, including its disk, at completion. That works for one-shot execution when nothing should be kept. A persistent lifecycle instead suspends during idle periods and resumes with memory and filesystem state intact. Coding and multi-turn research workflows need to keep packages and intermediate work between sessions. Repeated cold reboots force setup to happen again and can discard unfinished work.

This is the limitation of a serverless model that offers only disposable execution or always-on compute. Without that middle state, the application has to handle persistence itself. With suspension, charges shift from compute to stored state, while hard deletion gets rid of the task environment. The practical requirement is a policy per agent role that specifies creation, idle suspension, hard deletion, and exactly which state may pass into the next session.

What persistent filesystem state enables and why it is not the same as a persistent VM

A persistent filesystem does not require a continuously running VM. Most long-horizon workflows need installed packages, cloned repositories, intermediate files, session credentials, and earlier tool outputs more than they need preserved CPU state. A persistent volume can attach that work to a fresh microVM. Compute and state can therefore have different lifetimes. Full memory snapshots need not be the default durability mechanism.

Computer Environments Elicit General Agentic Intelligence in LLMs introduces LLM-in-Sandbox and demonstrates capability gains from an environment with resource access, file management, and code execution. The filesystem gives the agent somewhere to accumulate and revisit intermediate work across turns. A repository, a saved calculation, or an earlier tool result remains available without being reconstructed in every model call.

The practical design separates a shared, read-only base image from a per-session read-write volume. Copy-on-write clones provide the reproducible starting environment, while the volume preserves user-generated work. Diff snapshots can retain in-memory working state within a session. Object storage can also hold state, but it needs explicit serialization and deserialization where files and directories can be accessed in the usual way.

Why controlled network egress is a first-class primitive rather than an afterthought firewall rule

A strong VM boundary cannot stop an allowed outbound request. Generated code with unrestricted network access can send out data, get instructions from an attacker, or call paid APIs over and over without ever leaving its sandbox. Isolation alone cannot contain that bill. Network egress is therefore an operational control as well as a security control.

The appropriate starting policy is default-deny outbound access with an operator-managed allowlist. A sandbox can then reach only the endpoints approved for its task. That policy must follow the lifecycle, ending when an ephemeral environment closes and staying in force as long as a persistent environment exists. Applying it only at creation leaves the ongoing session’s network permissions unmanaged.

In practice, this means a per-sandbox network namespace, default-drop iptables or eBPF policy, and egress logs tied to the task ID. A shared cluster firewall cannot express the same task-specific contract. For regulated work, the logs also establish whether data went only to approved destinations. The network boundary must be attributable to the task.

How the four primitives compose into a coherent per-task execution model

Diagram: Four Primitives of Production Agent Infrastructure. Visualizes: Show four ranked/stacked primitives that compose into a coherent per-task execution contract: (1) microVM isolation — each task gets its own guest kernel via Firecracker or…

A one-shot code task needs a fresh guest kernel, an ephemeral lifecycle, no surviving filesystem, and default-deny egress with task-specific exceptions. Completion deletes the environment and wipes its disk. The sandbox limits the task’s blast radius.

A persistent coding agent needs a different contract. It can retain microVM isolation while using suspend-on-idle, snapshot resume, and a persistent working-directory volume. Its allowlist includes approved package registries and external tools. Deleting that working directory after each session would defeat the intended continuity, even if the isolation technology were correct.

An evaluation or RL rollout instead starts from a shared read-only base image with a copy-on-write clone, keeps no state between rollouts, and reaches only approved reward and evaluation services. These architectural examples serve as illustrations, with no claim that Aries prescribes them as a canonical pattern. They show why the same four primitives need different policies for different jobs. Traditional Kubernetes pods without a sandboxed runtime cannot express the whole contract on their own, leaving operators to approximate it through additional mechanisms.

Why token-centric and request-centric metrics fail to surface the real bottlenecks in agent serving

Aries finds that token-centric metrics miss non-inference bottlenecks in agent serving. Tokens per second and time-to-first-token describe model calls, but not the environment surrounding them. A task can take longer because of sandbox startup, suspension, filesystem mounts, or the time it takes to evaluate network policy. A fast model call does not establish a fast task.

The framework reconstructs cross-component agent trajectories using correlated system telemetry. Connecting model-call timestamps to sandbox state transitions shows where wall-clock time goes, including the long idle periods and brief resource bursts that characterize tool execution. Aries also finds diminishing accuracy returns from retaining additional context while serving capacity falls.

The practical implication is to instrument the whole trajectory. Task completion time, sandbox idle fraction, state restoration latency, and egress event counts belong beside per-call latency. Those measurements distinguish model delay from environment delay. Without that distinction, a team can optimize inference while leaving the actual bottleneck untouched.

What running evals and RL rollouts at scale requires from sandbox infrastructure

A training batch can trigger thousands of concurrent sandbox creation requests. Running those environments locally can overwhelm CPU resources and leave GPUs idle. Execution therefore needs to scale separately from training and inference. A service that handles interactive sessions with ease may still struggle when that many sandboxes start at once.

Polar’s 2026 architecture treats agent test-time environments as a first-class part of the RL system. ProRL Agent, published on arXiv in 2026, describes rollout-as-a-service through the asynchronous stages INIT, RUN, and EVAL, with token-in/token-out trajectory communication to avoid re-tokenization drift. Atomic Skills’ 2026 work describes a unified sandbox across Kubernetes on hybrid cloud, with rollout workers separated from training workers and asynchronously sampling a unified skills buffer.

Shared warm snapshots and copy-on-write clones avoid independent environment setup for every rollout. Network policy must also keep up as the number of those environments grows. One misconfigured sandbox can expose training data or call external APIs repeatedly at training-batch frequency. A cluster-wide rule is not a substitute for per-sandbox enforcement.

How these primitives apply to agents automating legacy desktop software in regulated industries

Desktop automation adds a full GUI stack to the execution contract. Agents working through Citrix sessions, EHR screens, and loan origination systems need a persistent, credentialed desktop they can see and operate. By using vision, agents can work with native and platform-specific applications without each system having to offer an API. The desktop itself becomes the tool environment.

That environment may hold PHI, data from loan applicants, or policyholder records. Isolation protects one session from another, while persistent state retains credentials, signed-in browser state, and unfinished work. Recreating the desktop at every resumption forces re-authentication and re-entry. Egress should be limited to the target application and approved storage, excluding unrelated telemetry, ad networks, and model APIs that could receive PHI.

Human takeover is a separate infrastructure requirement. In workflows requiring oversight, an operator must be able to view and control the desktop mid-task without terminating its sandbox. Where HIPAA business associate agreements and data processing agreements apply, they also spell out what the platform is responsible for. For healthcare workloads where the platform is a business associate, data-at-rest encryption, audit logging, and egress controls need demonstrable implementation.

How to evaluate whether a sandbox platform actually implements the primitives or approximates them

The evaluation should test execution behavior. Builders can bring their own model and keys because the sandbox runs the computer. First, check whether each task gets its own guest kernel or shares a host kernel under namespace rules.

The second question asks if lifecycle policy can set creation triggers, idle suspension, and the conditions for hard deletion. A choice between ephemeral and always-on misses the useful middle state. The third is whether the read-only base image and per-session read-write layer are separate, with session state attachable to a fresh VM.

Fourth, check whether outbound access defaults to deny-all with an operator-managed allowlist. Optional restrictions on an allow-all environment start from a different trust assumption. Does billing cover active execution without idle compute charges or minimum reservations, and what stored state remains billable during suspension?

Purpose-built agent infrastructure implements these contracts coherently, while adapted general compute may require the builder to supply missing pieces. Both are legitimate choices.

Sources

  1. Rethinking AI Cloud Infrastructure for Agentic Serving Systems with the Aries Experimentation Framework
  2. Computer Environments Elicit General Agentic Intelligence in LLMs
  3. A Survey on Agentic Security: Applications, Threats and Defenses

More in Sandboxed Code Execution