Contain the agent, sheet 07 of 13
Isolating what a coding agent can read, write and reach, and guarding the handoff points where your own machine runs what it wrote.
Treat the line between the sandbox and your machine as a checklist: hooks, settings files, the Docker socket, the keychain. Then check the sandbox is actually on. In Claude Code it starts off.
← → move to the next sheet over, Esc zooms out.
A coding agent runs real commands on a real computer. A sandbox decides which files it can read, which it can change, and which parts of the internet it can reach. The operating system enforces it, so it holds even when the agent is confidently wrong.
Think of the valet key. It starts the car and won't open the glovebox or the trunk. Some agents hand you the valet key by default. Others leave it in a drawer and give out the full set, and you have to go get the valet key on purpose.
The clever escape isn't through the engine, either. The agent leaves a note on the dashboard (a git hook, a settings file, a script, a plugin) and the next trusted driver follows it without reading. Most of the work here is guarding those handoff points.
Every link opened on 19 Nov 2026. The numbers match the squares on the map.
Built in
Seatbelt on macOS, bubblewrap on Linux and WSL2, and a proxy that lets shell commands reach only the domains you allow.
The catch. Off by default, and it wraps shell commands only. File tools, MCP servers, hooks and mods run outside it, and ~/.ssh stays readable until you deny it.
Built in
Seatbelt on macOS, bubblewrap on Linux, a native sandbox on Windows. On in the default permissions mode.
The catch. Network access and escalations still come back to an approval. Whoever answers it is your boundary.
Open source
A kernel-level sandbox per agent with phantom tokens, so the agent never holds the real credential, plus signed skills, a tamper-evident audit log and rollback.
The catch. Pre-1.0, so the APIs may still move. Apache-2.0, from the team behind Sigstore.
Product
A microVM per agent, with credentials handled outside the agent and a network policy per sandbox. Runs Claude Code, Codex, Copilot and others.
The catch. A virtual machine per agent is heavier than a process sandbox. Worth it for untrusted work, overkill for a typo fix.
Open source, hosted
An isolated machine for every agent, in E2B's cloud or your own AWS, GCP or Azure account. The SDK is Apache-2.0.
The catch. Your code and data run in somebody else's VM unless you bring your own cloud account.
Hosted
Hosted sandboxes for agent code. Sprites persist and checkpoint, Cloudflare offers Linux VMs or isolated Workers, Modal runs gVisor or VMs.
The catch. Pick by how long the agent's work lives. Throwaway jobs want cheap and disposable. Long sessions want checkpoints.
Open source
Linux containers, each in its own lightweight VM, on Apple silicon.
The catch. macOS 26 only. A good local second machine, not a policy layer.
Open source
The OS-level sandbox under Claude Code, packaged to wrap any process, local MCP servers included. Apache-2.0.
The catch. A research preview. Use it to close the MCP gap in the first row, not as your only wall.
Built in
Your own script, run before a tool call, that can refuse it whatever the model decides. In Claude Code a hook's deny holds even with permissions bypassed.
The catch. Most fail open: a hook that crashes or times out usually lets the call through, and not every harness lets you make it block instead. Codex's own docs call tool hooks a useful guardrail, not a complete enforcement boundary.
Built in
A policy file in a system folder that no user, project or local setting overrides: deny rules, PreToolUse hooks that run ahead of any mod's tool-call hook, and a switch that stops the mods users bring, one Claude wrote mid-session included.
The catch. A developer who is an administrator on the machine can still edit it. On a machine with no managed settings, no managed MCP file and no Team or Enterprise login, a mod can approve a call your own hook blocked.
Reference, Anthropic
Why permission prompts fail: people approve 93% of them. A two-stage classifier replaces most of the prompts.
The catch. By Anthropic's own count it misses 17% of overeager actions, on a sample of 52.
Reference
Private data, untrusted content and a way to send data out. Give one agent all three and an attacker can steal through it.
The catch. No model-level fix exists. Break one leg of the triangle for every agent.
Reference, OWASP
The standard list of what goes wrong when an agent has too much functionality, too many permissions or too much autonomy.
The catch. A list of failure modes, not a control. Map each one to a setting you actually changed.