Use this file to discover all available pages before exploring further.
For a complete guide on running Claude Code in E2B sandboxes — including working with repositories, streaming output, and connecting MCP tools — see the Agents in Sandbox: Claude Code guide.
// template.tsimport { Template } from 'e2b'export const template = Template() .fromNodeImage('24') .aptInstall(['curl', 'git', 'ripgrep']) // Claude Code will be available globally as "claude" .npmInstall('@anthropic-ai/claude-code@latest', { g: true })
// build.tsimport { Template, defaultBuildLogger } from 'e2b'import { template as claudeCodeTemplate } from './template'Template.build(claudeCodeTemplate, 'claude-code', { cpuCount: 1, memoryMB: 1024, onBuildLogs: defaultBuildLogger(),})
// sandbox.tsimport { Sandbox } from 'e2b'const sbx = await Sandbox.create('claude-code', { envs: { ANTHROPIC_API_KEY: '<your api key>', },})console.log('Sandbox created', sbx.sandboxId)// Print help for Claude Code// const result = await sbx.commands.run('claude --help')// console.log(result.stdout)// Run a prompt with Claude Codeconst result = await sbx.commands.run( `claude --dangerously-skip-permissions -p 'Create a hello world index.html'`, { timeoutMs: 0 })console.log(result.stdout)sbx.kill()