Why Use a Sandbox
Running coding agents directly on your machine or servers means giving AI-generated code unrestricted access to your environment. E2B sandboxes solve this:- Isolation — agent-generated code runs in a secure sandbox, never touching your production systems or local machine
- Full dev environment — terminal, filesystem, git, and package managers are all available out of the box, so agents work like a developer would
- Pre-built templates — ready-made templates for popular agents get you started fast, and you can build your own for any agent
- Scalability — spin up many sandboxes in parallel, each running its own agent on a separate task
How It Works
- Create a sandbox — use a pre-built template or build your own with any agent installed
- Agent gets a full environment — terminal, filesystem, git access, and any tools installed in the template
- Agent works autonomously — it reads the codebase, writes code, runs tests, and iterates until the task is done
- Extract results — pull out the git diff, structured output, or modified files via the SDK
- Sandbox is cleaned up — once the work is done, the sandbox is destroyed automatically. No lingering state or cleanup needed
Agent Examples
Since each sandbox is a full Linux environment, you can run any coding agent — just install it in a custom template. E2B also provides pre-built templates for popular agents to get you started quickly.Claude Code
Anthropic’s autonomous coding agent with structured output and MCP tool support
Codex
OpenAI’s coding agent with schema-validated output and image input
AMP
Sourcegraph’s coding agent with streaming JSON and thread management
OpenCode
Open-source multi-provider agent with a built-in web UI