Robots Atlas>ROBOTS ATLAS
Safety

External sandbox

ActivePublished: 19 November 2026Updated: 19 November 2026Published
Key innovation
Moving an agent's code and command execution into an isolated environment controlled by the user or organization, outside the model provider's infrastructure, to contain the impact of erroneous or malicious actions.
Category
Safety
Abstraction level
Pattern
Operation level
Agent runtimeToolingDeployment
Use cases
Secure code execution by coding agentsIsolating shell command execution in CLI agentsContaining the impact of indirect prompt injectionRunning untrusted code in CI/CDMulti-tenant agent execution environmentsReproducible developer environments for agents

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

Isolation boundaryEnforcing isolation via the OS or hypervisor

The mechanism separating the agent's processes from the host — a container, micro-VM, VM or userspace application kernel sandbox.

Official

Network policyLimiting data exfiltration and access to external hosts

Rules governing network access: no network, a proxy with an allowlist of domains, or a separate network namespace.

Official

Filesystem policyProtecting host files and local secrets

The scope of read and write permissions — typically writes limited to the working directory and temporary directories.

Official

Lifecycle managerProviding a clean, reproducible execution state

Creation and teardown of the environment — often ephemeral, recreated per task.

Official

Implementation

Implementation pitfalls
Confusing an external sandbox with the provider's internal oneMedium

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.

Fix:Explicitly run code execution in your own, controlled external environment.
Over-broad read permissions leaking secretsHigh

Broad default read permissions can give the environment access to local secrets such as ~/.ssh or cloud credentials.

Fix:Restrict reads to the working directory and explicitly block credential paths.
Sandbox escapeCritical

Misconfigured or privileged isolation can be bypassed, especially with weaker container boundaries.

Fix:Use stronger isolation (micro-VM/VM), least privilege, and up-to-date environments.
Container isolation too weak compared to a VMHigh

Containers share the host kernel, so they provide a weaker boundary than a virtual machine; for untrusted code this may be insufficient.

Fix:For untrusted code prefer micro-VM/VM or a userspace application kernel sandbox.

Evolution

2013
Docker popularizes containerization
Inflection point

Containerization based on Linux kernel namespaces and cgroups becomes a standard way to isolate application processes.

2018
gVisor — userspace application kernel sandbox

Google releases gVisor, which handles system calls in a separate kernel per sandbox, reducing the risk of container escape.

2018
Firecracker — micro virtual machines
Inflection point

AWS releases Firecracker, KVM-based lightweight virtualization for secure, multi-tenant workloads, powering services such as AWS Lambda.

2023
Coding agents adopt external sandboxes

As code-executing agents proliferate, external, user-controlled sandboxes become a standard execution safeguard.

2025
Dedicated agent sandbox tooling

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)

Isolation strengthCritical

The choice of isolation technology sets the strength of the boundary — from a kernel-sharing container to a full virtual machine.

Kontener (namespaces/cgroups, Docker)Weaker isolation, shared host kernel.
Piaskownica jądra w przestrzeni użytkownika (gVisor)Intercepts system calls, reduces container escape.
MikroVM (Firecracker, KVM)Strong isolation with low overhead.
Lekka/pełna VM (QEMU, Apple container)Strongest isolation, higher overhead.
Network policyHigh

The level of network access granted to the sandbox environment.

Brak sieciSafest default.
Proxy z listą dozwolonych domenControlled access to selected hosts.
Pełny dostępHighest exfiltration risk.
Filesystem scopeHigh

Which paths the environment may read and write.

Tylko odczytNo filesystem modification.
Zapis do katalogu roboczegoTypical mode for coding agents.
Pełny dostępRisk of overwriting host files.
EphemeralityMedium

Whether the environment is destroyed after a task or kept between runs.

Efemeryczne (na zadanie)Clean, reproducible state.
TrwałeFaster, but accumulates state and risk.

Hardware requirements

Primary

It is a software isolation pattern independent of accelerators; micro-VM/VM variants only require CPU virtualization support (e.g. KVM).