Sandcastle
Sandcastle runs coding agents like Claude Code and Codex on your repo, each in its own E2B sandbox. The agents' commits come back to a branch on your machine.
- Sandcastle
- Built-in E2B sandbox provider
- @ai-hero/sandcastle
- TypeScript
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Add E2B sandboxes to this Sandcastle project.
- 1.Install @ai-hero/sandcastle and e2b using the project's package manager.
- 2.Sandcastle needs the E2B_API_KEY environment variable in my shell. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it, and never put it in .sandcastle/.env.
- 3.Follow the Sandcastle guide at https://docs.e2b.dev/agents/sandcastle and run claudeCode with sandbox: e2b({ template: "claude" }), passing ANTHROPIC_API_KEY in the agent env.
- 4.Run it once from the repo root and show me the commits that came back from the sandbox.
Or set it up yourself
1. Install Sandcastle and E2B
2. Set your API keys
3. Run Claude Code in a sandbox
What runs in the sandbox
Each agent works on a copy of your repo in its own sandbox. Only its commits come back.
- The agent CLI from the template, claude or codex, working on a copy of your repo in $HOME/workspace.
- Commits land on your current branch, or on a separate one with branchStrategy.
- run() creates a sandbox and kills it when the run finishes. At timeoutMs, 30 minutes by default, it's killed, never paused.
- Only keys in .sandcastle/.env and the providers' env reach the sandbox. Keep E2B_API_KEY out of .sandcastle/.env.
More coding agents
Other coding agents that run in E2B sandboxes.
- Claude CodeRun Claude Code in its own sandbox with a real filesystem, terminal, and git, so it can work unattended.
- OpenAI CodexRun OpenAI's Codex CLI headless in a sandbox and collect the diff when it's done.
- OpenCodeRun OpenCode in a sandbox, or keep it local and point its workspaces at E2B with the @e2b/opencode plugin.
