Simon Willison, in collaboration with Prime Radiant, introduces the external sandbox pattern for safely executing code generated by AI agents, isolating the execution environment from the host machine to mitigate risks from prompt injection or agent errors. The pattern decouples the agent, which remains outside the sandbox, from a dedicated sandbox server exposing a standardized localhost API compatible with tools like Pi, Claude Code, and Codex. Three reference implementations demonstrate the approach: external-sandbox-v86 runs Alpine Linux via v86 WebAssembly in a Node.js server; external-sandbox-container uses Apple Containers to run Alpine Linux via a Python server; and external-sandbox-quicksand leverages Microsoft's Quicksand library, bundling QEMU and Alpine Linux in a Python package. All implementations feature an optional HTTP/HTTPS allow-list proxy to restrict outbound network connections and a credential replacement mechanism enabling authenticated API calls without exposing secrets to the agent. The proxy configuration can be adjusted dynamically via a UI while the sandbox runs. This architecture allows developers to experiment with diverse virtualization technologies—WebAssembly, macOS-native containers, and QEMU—while maintaining a consistent security boundary and integration interface for coding agents.
Read original
simonwillison