Code sandbox
A throwaway container where the agent's commands can't hurt your machine.
What it is
An isolated container or microVM with the repo checked out, dependencies installed and the network off by default. It's reset per task.
When to use it
- The agent runs commands, tests or installs packages
When to skip it
- Running the agent with your own shell, credentials and network by default
Why (the trade-off)
It limits the blast radius: a bad command breaks a disposable copy, not your laptop or production.
Where it sits
Runtime layer, under the tools.
What it needs first
Nothing: it's a starting point.
What can be added to it
- builds on itEgress allowlistEgress allowlist needs it: it fences the computer or sandbox the agent runs in
- builds on itCode tools (read, search, edit, run)Code tools (read, search, edit, run) needs it: commands run somewhere isolated
- builds on itTest-and-fix loopTest-and-fix loop needs it: tests run in isolation
- builds on itCI gateCI gate needs it: CI runs in a clean environment
Effect of adding it
- cost ↑
- latency —
- reliability ↑
- safety ↑↑
Risks it handles
- A destructive command · partial
Learn first (AI Engineering)
Free and open-source implementations
- OpenHandsMITopen-source coding agent with sandboxed runtimes
Sources
depth 4+1 production note with numbers.