Infrastructure Review Stack
FeaturesLong read

Which Platforms Safely Run AI-Generated Code in Isolation

Isolation boundaries, patch lag, and state handling separate the safe sandboxes from the rest.

· 9 min read
Cover illustration for “Which Platforms Safely Run AI-Generated Code in Isolation”
Features · November 13, 2026 · 9 min read · 2,048 words

Safely running AI-generated code requires more than choosing a product called a sandbox. The right platform must have an isolation boundary that fits the threat, keep the state the workload needs, and control credentials and outbound traffic. MicroVMs, userspace kernels, containers, and language runtimes make different guarantees. Production safety depends on those differences, but also on how the platform maintains and deploys them.

Why AI-generated code creates a distinct execution risk that generic infrastructure wasn't designed to handle

Running AI-generated code inside an application process is structurally a remote-code-execution vulnerability, regardless of model quality. The application is granting execution privileges to code whose behavior it cannot safely assume. Autonomous agents add to that risk because they can run the code they generate without human review. What happens if the generation is compromised? Without a separate execution boundary, the host becomes the target.

UL Research Institutes’ SandboxEval shows how generated code can have hard-to-spot flaws or malicious behavior that comes from prompt injection or poisoned training data. Its test suite covers 51 properties of code that is malicious or could cause harm when run, including sensitive information exposure and unauthorized external communication. A process can use no more memory than it is allowed while reading secrets or sending them elsewhere. Every generated-code path therefore needs isolation from the host, with controls over filesystem access, system calls, and network egress.

The four isolation primitives and what each one actually protects against

MicroVMs such as Firecracker and libkrun give each sandbox a dedicated kernel behind hardware-level isolation. The deliberately narrow hypervisor interface protects the host kernel from direct access by a guest-kernel exploit. The tradeoff is a requirement for KVM or hardware virtualization and startup overhead in the low hundreds of milliseconds, although sub-200ms startup is achievable. This boundary fits workloads that need to run Linux code without sharing the host kernel.

Userspace kernels take a different route to host protection. gVisor implements the Linux system call interface in user space, intercepting calls before they reach the host kernel. It offers broad Linux API compatibility and runs on any Linux host without the full overhead of a VM. It does not provide a dedicated guest kernel. Nor should it be conflated with nsjail, which uses process-level isolation and filtered system calls, with very fast startup but a narrower boundary.

OCI containers use namespaces and share the host kernel, so they have very fast startup and nearly complete compatibility. Configuration is decisive here. SandboxEval notes that 76% of Docker containers run with elevated privileges in practice. For hostile code, shared-kernel containers do not provide the same host-kernel protection as microVMs or userspace kernels, although they can suit threats centered on accidental damage or resource abuse.

Language runtimes exchange operating-system flexibility for tighter execution constraints. WebAssembly offers a deny-by-default capability model and sub-millisecond startup, while V8 isolates are limited to a single scripting language. Neither substitutes for arbitrary native binaries or full Linux toolchains. These boundaries can also be layered. A userspace kernel over a microVM adds meaningful defense in depth, while containers stacked over containers add little.

Diagram: The Isolation Spectrum: Four Boundaries and What Each Actually Blocks. Visualizes: Show four sandbox isolation primitives ranked from strongest to weakest host-kernel protection: (1) MicroVMs (Firecracker, libkrun) — dedicated guest…

How the security gap between engine classes shows up in real CVE history and patch behavior

George Andronchik and Pavel Lokhmakov’s 2026 comparative security study reads six measurements together, including host attack surface, information leakage, stackability, public CVE history, patch cadence, and upstream fuzzing posture. It finds clear differences in how engine classes are built, but finds no such differences between products within a class. No overall ranking is proposed. A CVE count alone cannot show which deployment is safer because what it reveals depends on how flaws are found and how the software is maintained.

The study finds that engine-side patch latency for coordinated disclosures aggregates to approximately zero days. Downstream delivery is far less consistent. Product lag ranges from zero to 471-plus days, while some products’ behavior is opaque. The pin policy, which determines the engine version a product uses, therefore becomes a central operational variable. Even with a strong boundary, the running sandbox may lack a known fix.

Fuzzing adds another question about the evidence. The study finds three tiers of investment, with no microVM paired with a continuous public fuzzer in its dataset. Zero published CVEs can therefore coexist with little public measurement. Operators should ask about pin policy, CVE disclosure, and public upstream fuzzing, since a vulnerability history with no entries does not prove safety.

Diagram: Patch Lag: Engine Fix to Production Can Take 471+ Days. Visualizes: Visualise the two-stage gap between a vulnerability being patched upstream and the fix reaching a running sandbox.

What the leading platforms actually built and the security choices embedded in each

Vercel Sandbox has been persistent by default since May 2026, snapshotting the filesystem on stop and restoring it on resume. Its firewall can change policy while a process runs and inject credentials as outbound requests leave. This makes setup and execution separable security phases. As of August 2026, Claude Managed Agents can retain Anthropic’s model, harness, tools, and session state while using a Vercel Function as the control plane and one sandbox per session.

Fly.io Sprites, launched in January 2026, takes persistence as its starting point. Its Firecracker microVMs provide 100 GB of durable, object-storage-backed storage, with NVMe as a local cache. Idle billing stops when environments are not in use. The architecture supports state accumulated over days rather than optimizing solely for rapid creation and destruction.

Northflank offers a different kind of choice. Its primary microVM isolation uses Kata Containers with Cloud Hypervisor, while Firecracker and gVisor are also supported. Operators can select the security-performance tradeoff per workload. Self-serve BYOC supports AWS, GCP, Azure, Oracle, CoreWeave, and Civo, while BYOK supports on-premises and bare-metal deployment.

Google GKE Agent Sandbox reached general availability in May 2026 with gVisor-based isolation for untrusted code and tool calls. Each sandbox is stateful and single-replica, despite the environments being designed as disposable. Amazon Bedrock AgentCore Runtime instead uses microVM sessions limited to a few hours, while Instances support sessions lasting up to 14 days. Lifecycle is therefore a separate comparison from engine class.

Koyeb combines serverless containers with secrets management, logs, metrics, and location control. Light Sleep has sub-200ms wake-up for sleeping instances, and scale-to-zero pricing bills only for runtime, with no charge for idle time. Those are useful operational properties. They do not, by themselves, answer whether a container boundary fits adversarial code. Desktop platforms require a different assessment again because their purpose is application access.

The stateful execution problem and why ephemeral sandboxes are the wrong default for most agent workloads

The ephemeral default reflects CI/CD priorities, where fast teardown is a virtue. Agents often work to a different rhythm. Model latency, rate limits, human review, and multi-day tasks can pause execution while the work is still unfinished. If session termination discards state, the agent must replay earlier steps, spending tokens and time to recover progress. How long work must survive then matters alongside how quickly a sandbox starts.

Checkpointing is especially important when session limits force work to span more than one session. Vercel’s filesystem snapshots, kept for 30 days by default, allow a new sandbox to resume from saved state. This provides a middle path between continuous persistence and teardown. Sprites instead targets projects that accumulate state over days, with paused environments costing nothing and resuming quickly when warm or within a few seconds when cold.

Checkpoint semantics still deserve careful attention. A running Sprite can be checkpointed rapidly, but that operation pauses and restores the same Sprite. Branching from saved state and uninterrupted live forking are different guarantees. Stateful-by-design runtimes can let long-horizon workflows continue where they stopped, avoiding the checkpoint-and-replay tax.

Computer-use agents and VDI environments as a separate isolation problem

Computer-use agents work through graphical interfaces as well as using generated code. Many enterprise applications lack APIs, so the agent needs a managed desktop with applications installed, authenticated, and entitled. VDI addresses that application-access problem. Its security depends on the agent’s permission scope and how its desktop is kept separate, as well as on the kernel boundary beneath the process that runs code.

Amazon WorkSpaces for AI Agents has been in general availability since 1 July 2026. It grants two discrete permissions on a desktop pool, computer input and computer vision, and exposes a managed MCP endpoint that any agent framework can connect to. Observation and action are therefore separately controlled. Windows 365 for Agents reached general availability in mid-2026, bringing the VDI model to the Windows application estate.

These platforms solve an adjacent but distinct problem. What can the agent see, what can it do, and is its desktop separated from production data systems? Those questions reveal more about a computer-use deployment than a comparison of microVM startup times. A code sandbox assessment cannot substitute for examining the desktop’s permissions.

Credential handling and network egress as the security boundary that engine isolation alone doesn't close

A well-isolated sandbox can still exfiltrate credentials when code can read secrets and make unrestricted outbound requests. No host escape is necessary for that attack. SandboxEval treats sensitive information exposure and external communication as distinct threat categories because process and filesystem isolation alone do not resolve them. The boundary must govern what leaves the sandbox as well as what execution can reach.

Credential injection proxies keep raw secrets outside the code’s environment. Instead of placing a secret in an environment variable, the proxy adds it only as the outbound request leaves. Vercel’s dynamic firewall supports this two-phase pattern. Setup can have broad network access, which a narrower policy can limit before model-generated code runs, with credentials added at egress.

Seccomp blocks dangerous system calls, while Landlock can restrict access to directories such as .ssh and .aws. A network proxy filters outbound connections by domain and port, and DLP detects and redacts secrets in command output. Each control has a distinct job. The production baseline is therefore two-layered, with engine isolation containing compromised execution and credential and egress controls blocking routes for theft and exfiltration.

Enterprise compliance requirements and how certification scope determines which deployment models actually qualify

Compliance scope can eliminate an option before its architecture is compared. A vendor’s certification may cover only some of the deployment models it offers. Managed cloud, BYOC, and on-premises environments may have different coverage. If enterprise policy requires execution inside the customer’s infrastructure, a managed-cloud certification does not satisfy that requirement for a BYOC deployment.

SOC 2 Type 2 is the baseline for B2B enterprise deployments, while healthcare data requires HIPAA with a Business Associate Agreement. European enterprise customers increasingly expect ISO 27001. Scope remains the decisive qualification. The relevant evidence must apply to the service, deployment model, and tier the customer will actually use.

Northflank’s SOC 2 Type 2 certification covers both managed cloud and BYOC, making it the only platform in this group with that stated coverage across both models. Vercel has company-wide SOC 2 Type II and ISO 27001, with a HIPAA BAA available through the Pro add-on and Enterprise tiers. AgentCore Runtime is listed in AWS PCI DSS scope. These statements establish different forms of coverage. Certification scope should be audited against the intended deployment before evaluating performance or pricing.

A decision framework for matching isolation architecture to workload requirements

Selection should begin with the threat model. Could prompt injection turn generated code into an adversarial workload, or is the concern accidental damage from trusted code? For the former, the minimum boundary is a microVM’s dedicated kernel or a userspace kernel that intercepts access to the host. These mechanisms provide distinct kernel boundaries. Containers that enforce limits may be enough for accidental resource abuse.

Ephemeral sandboxes suit short analysis jobs, test runs, and one-shot tool calls, while coding agents and multi-day research need persistence or a way to resume from snapshots. GUI-driven work needs a separate check of the desktop’s permissions. What must survive when the current session ends, and can the platform preserve it without replaying the work?

If code must run in the customer’s cloud, BYOC with certification coverage is required. Certification scope must be clear before performance or prices are compared. HIPAA BAA availability, PCI DSS scope, and ISO 27001 coverage should be established for the relevant tier.

Operators should know how engine versions are pinned and how fixes for disclosed vulnerabilities reach the environment where code runs. Architecture establishes the boundary. Patch behavior, state management, and credential controls all shape how well that boundary serves the workload running inside it.

Sources

  1. SandboxEval: Towards Securing Test Environment for Untrusted Code
  2. AI Code Sandboxes: A Comparative Security Study. Part 1 of 2 -- Engine-Level Properties (Attack Surface, Leakage, Stackability, CVE History, Patch Cadence, Fuzzing)

More in Features