Simon Willison and Prime Radiant describe the external sandbox pattern: the coding agent stays outside while the code it executes runs in a dedicated sandbox. Three implementations share one localhost API, with an optional allow-list proxy and credential replacement.
Key points
- The pattern keeps the agent outside the sandbox while the code it executes runs inside one.
- external-sandbox-v86 is a Node.js server that runs Alpine Linux in WebAssembly through v86.
- external-sandbox-container is a Python web server running Alpine Linux inside an Apple Containers instance.
- external-sandbox-quicksand uses Microsoft's Quicksand library, bundling QEMU and Alpine into one Python package.
- All three expose the same localhost API, so Pi, Claude Code or Codex can send code-execution calls to it.
- An optional HTTP/HTTPS allow-list proxy picks permitted hosts, and credential replacement hides secrets from the agent.
Real-world use
- Trying out a local model without fearing that a mistake or prompt injection damages the host machine
- Pointing Claude Code, Codex or Pi at a remote sandbox instead of letting them execute code on the host
- Restricting agent code to a fixed set of hosts while still making authenticated API calls without sharing secrets
This summary was generated by the agent from the original post on Simon Willison. The full text and all rights belong to its author and publisher. Go to original