Two Ways to Sandbox an Agent
Either sandbox the whole agent, or keep the thinking outside and sandbox the doing: code execution, tool calls, sessions, shells and browsers.
Contents
Use it when Choosing an isolation boundary before letting an agent execute code or touch production systems.
When an agent can only generate text, the worst outcome is a bad answer. When it can execute code, the worst outcome is a deleted production database. Every sandboxing approach comes down to one question: does the thinking sit inside the boundary or outside it?
Mode 1: Sandbox the whole agent. The agent process, its tool calls and its code all run inside one boundary. The agent holds no credentials. Right for developer laptops and CI/CD, where the host holds credentials the agent should never see.
Mode 2: Sandbox the doing. Thinking is separate from doing. The agent loop runs outside and delegates execution to disposable sandboxes you control, with credentials injected at the network boundary. It reaches them through agentic APIs or through a framework’s sandbox abstraction, and the same split covers everything the agent acts with:
- code execution
- tool calls
- sessions
- shells
- browsers
Right for multi-tenant platforms and production.
Same enforcement layer for both. That flexibility is what makes sandboxing a platform capability, not a point solution.