The Invisible Wall: How sandbox-runtime Hardens the AI Terminal

Anthropic's experimental runtime uses OS-native "Black Arts" to let autonomous agents run wild without breaking the host.

8 min read • View on GitHub • More from anthropic-experimental

A mechanical hand reaching for a door handle, but seeing a ghostly 'Access Denied' blueprint reflected on the palm of its hand, representing the violation feedback loop.
Unlike traditional sandboxes that silently kill processes, srt provides a "violation feedback loop" so agents can self-correct.
Key Takeaways

The Agent That Learns "No"

The agentic escape is the new zero day. The industry is obsessed with building more powerful models, but giving an autonomous agent a terminal is essentially handing a loaded weapon to a toddler. Traditional security boundaries like virtual machines or Docker containers were built for static applications, not self-directed code that needs to explore its environment.

Anthropic's sandbox-runtime (often called srt) introduces a different paradigm. It is an "invisible wall" built specifically for the violation-feedback loop. When a traditional sandbox blocks an action, the process simply dies. When srt blocks an action, it explains why.

"The Sandbox Runtime is a research preview developed for Claude Code to enable safer AI agents. It's being made available as an early open source preview to help the broader ecosystem build more secure agentic systems."

By capturing system logs and seccomp violations, the runtime translates a hard "access denied" into a structured JSON error. The agent reads this error, updates its internal context, and tries a different approach. It learns the shape of its cage without ever breaching it.

Zero-Config Isolation

Docker requires a daemon. MicroVMs require a hypervisor. Both demand a mental shift from the user. srt requires neither. It is a cross-platform process wrapper that leverages the native security primitives already running on your host machine.

On macOS, it programmatically generates Apple's undocumented Seatbelt profiles. This is a scheme-like configuration language used by the sandbox-exec binary. On Linux, it wraps processes in bubblewrap to create unprivileged namespaces, pairing them with custom seccomp filters compiled specifically for the host architecture.

An interactive architecture diagram showing the 'Isolation Engine'. A central 'Sandbox Manager' node receives a user command like 'npm install'. A toggle switch branches the flow to either macOS or Linux. On macOS

The result is a secure-by-default environment that feels completely transparent to the user. Processes start with minimal access and require explicit configuration to read files or open sockets.

Runtime Isolation Depth Boot Time Agent Feedback
Docker Process / Namespace Seconds Low (Silent fails)
E2B (Firecracker) Hardware (MicroVM) Sub-second Medium
sandbox-runtime OS Native (Seatbelt/bwrap) Milliseconds High (Structured JSON)

The Symlink Trap

Sandboxing a filesystem is notoriously difficult because of symlinks. An agent might be restricted to a specific workspace directory, but a clever sequence of commands could create a symlink pointing to the host's SSH keys. If the sandbox only checks the name of the link, the agent escapes.

The sandbox-utils.ts file in the repository tackles this canonicalization problem head-on. It validates symlink boundaries by recursively checking ancestor directories. If a process attempts to rename or move a restricted file into an allowed location, the runtime blocks the parent operation entirely.

"Since v1.0.29, Claude Code ships with native sandboxing — powered by `srt` under the hood. Enable it with the `/sandbox` command."

This explicit handling of path normalization includes forcing lowercase comparisons to prevent case-sensitivity bypasses on macOS and Windows. The runtime treats any symlink pointing outside the designated boundary as an immediate security violation.

Networking via Proxy, Not Firewall

Kernel-level firewalls are excellent at blocking IP addresses, but they struggle with domain names. If an agent is allowed to query github.com but nothing else, resolving that domain to a static IP is brittle and prone to failure.

Instead of wrestling with iptables, srt spins up local HTTP and SOCKS5 proxy servers. It forces the sandboxed process to route all traffic through these proxies. The proxies perform domain-based filtering before a single byte leaves the host machine.

A Victorian-style clerk sitting at a small desk in front of a massive pipe. He holds a ledger and a stamp. Every drop of water passing through the pipe must be individually stamped by the clerk.
Local proxies act as gatekeepers, inspecting network requests at the domain level rather than relying on brittle IP firewalls.

"By sandboxing it, we give can selectively give permission for only the things that want to (both on filesystem and network connection level)"

— Ashik Nesin, Anthropic Sandbox Runtime

This proxy architecture prevents users from accidentally creating leaky sandboxes. The configuration schema explicitly rejects overly broad wildcards like *.com. The network boundary is deny-by-default, ensuring that autonomous agents only talk to the endpoints they are explicitly authorized to reach.


Sources