External sandbox
How it works
Instead of executing commands directly on the host machine or inside the provider's internal environment, the agent routes them to a separate execution environment. That environment is built on one of several isolation technologies: containers sharing the host kernel (Docker), a userspace application kernel that intercepts system calls (gVisor), KVM-based micro virtual machines (Firecracker), full or lightweight virtual machines (QEMU, Apple container), or an embedded WebAssembly runtime. The boundary is enforced by the operating system or hypervisor, so it holds regardless of what the model chooses to run. It is typically combined with a network policy (no network, a proxy with an allowlist of domains, or a separate network namespace), write access restricted to the working directory, and an ephemeral lifecycle that tears the environment down after the task. Implementations such as the @anthropic-ai/sandbox-runtime package in Claude Code or the local sandbox modes in OpenAI Codex wrap shell commands in such a boundary on the user's machine.
Problem solved
Coding agents execute arbitrary code and shell commands, creating risks of system damage, data exfiltration and abuse. A provider's internal sandbox stays outside the user's control and does not protect local developer resources, while direct execution on the host machine is unsafe. An external sandbox gives the organization a controlled, OS-enforced execution boundary.
Components
The mechanism separating the agent's processes from the host — a container, micro-VM, VM or userspace application kernel sandbox.
Official
Rules governing network access: no network, a proxy with an allowlist of domains, or a separate network namespace.
Official
The scope of read and write permissions — typically writes limited to the working directory and temporary directories.
Official
Creation and teardown of the environment — often ephemeral, recreated per task.
Official
Implementation
Assuming the provider's internal sandbox protects local user resources; it is outside the organization's control and does not isolate the developer's machine.
Broad default read permissions can give the environment access to local secrets such as ~/.ssh or cloud credentials.
Misconfigured or privileged isolation can be bypassed, especially with weaker container boundaries.
Containers share the host kernel, so they provide a weaker boundary than a virtual machine; for untrusted code this may be insufficient.
Evolution
Containerization based on Linux kernel namespaces and cgroups becomes a standard way to isolate application processes.
Google releases gVisor, which handles system calls in a separate kernel per sandbox, reducing the risk of container escape.
AWS releases Firecracker, KVM-based lightweight virtualization for secure, multi-tenant workloads, powering services such as AWS Lambda.
As code-executing agents proliferate, external, user-controlled sandboxes become a standard execution safeguard.
Dedicated tooling emerges, including the @anthropic-ai/sandbox-runtime package in Claude Code and Apple container, which runs Linux containers as lightweight VMs on Apple silicon (macOS 26+).
Hyperparameters (configurable axes)
The choice of isolation technology sets the strength of the boundary — from a kernel-sharing container to a full virtual machine.
The level of network access granted to the sandbox environment.
Which paths the environment may read and write.
Whether the environment is destroyed after a task or kept between runs.
Hardware requirements
It is a software isolation pattern independent of accelerators; micro-VM/VM variants only require CPU virtualization support (e.g. KVM).