Skip to main content
Claude Code is Anthropic’s agentic coding tool. E2B provides a pre-built claude template with Claude Code already installed.

CLI

Create a sandbox with the E2B CLI.
Once inside the sandbox, start Claude Code.

Run headless

Use -p for non-interactive mode and --dangerously-skip-permissions to auto-approve all tool calls. The sandbox isolates the agent from your host machine, but sandboxes can reach the open internet by default — restrict outbound traffic with network rules if the agent processes untrusted input or handles secrets.
Auto-approving tool calls is contained by the sandbox: the agent cannot touch your host machine, local files, or credentials. It can still make outbound network requests — internet access is enabled by default. To limit where an auto-approved agent can connect, configure outbound network rules (allowInternetAccess, plus allow/deny lists by CIDR or hostname). Hostname rules apply to HTTP(S) traffic only; use CIDR rules for other protocols.

Example: work on a cloned repository

Structured output

Use --output-format json to get machine-readable responses — useful for building pipelines or extracting specific results.

Streaming output

Use --output-format stream-json to get a real-time JSONL event stream — including tool calls, token usage, and result metadata.

Resume a session

Claude Code persists conversations that can be resumed with follow-up tasks using --resume.

Custom system prompt

Write a CLAUDE.md file into the sandbox for project context or use --system-prompt to provide task-specific instructions.

Connect MCP tools

Claude Code has built-in support for MCP. E2B provides an MCP gateway that gives Claude access to 200+ tools from the Docker MCP Catalog.

Build a custom template

If you need to customize the environment (e.g. pre-install dependencies, add config files), build your own template on top of the pre-built claude template.
Run the build script to create the template.

MCP tools

Connect Claude Code to 200+ MCP tools

Sandbox persistence

Auto-pause, resume, and manage sandbox lifecycle

Git integration

Clone repos, manage branches, and push changes