OpenClaw
Host an OpenClaw agent in a sandbox from the prebuilt openclaw template. Run it headless, or start its gateway and reach the web UI from your browser.
- E2B
- Prebuilt openclaw sandbox template
- e2b
- TypeScript, Python
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Run OpenClaw in an E2B sandbox from this project.
- 1.Install the e2b SDK using the project's package manager.
- 2.The SDK needs the E2B_API_KEY environment variable, and OpenClaw needs a model provider key such as ANTHROPIC_API_KEY. If E2B_API_KEY isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode either key.
- 3.Follow the OpenClaw guide at https://docs.e2b.dev/agents/openclaw: create a sandbox from the openclaw template, pass the provider key in envs, and run openclaw agent --local --message headless. Kill the sandbox when it's done.
- 4.Run one task and show me the output that came from the sandbox.
Or set it up yourself
1. Install the E2B SDK
2. Set your API keys
3. Run OpenClaw headless
4. Launch the gateway
What runs in the sandbox
The OpenClaw agent, its workspace and its gateway all run in the sandbox, not on your machine.
- openclaw agent, reading provider keys from the sandbox environment when you pass --local.
- SOUL.md, HEARTBEAT.md and skills live in the sandbox workspace. Write them in or install skills with clawhub.
- The web UI and chat interface, served on a sandbox port you open with getHost().
- With auto-pause on, the sandbox pauses after its timeout and can be resumed later instead of being killed.
More coding agents
Other coding agents that run in E2B sandboxes.
- Hermes AgentRun Hermes Agent in a sandbox template, or keep it local and execute its terminal tools on E2B.
- Claude CodeRun Claude Code in its own sandbox with a real filesystem, terminal, and git, so it can work unattended.
- PiRun the Pi coding agent in a sandbox, or keep Pi local and send its tool calls to E2B with @e2b/pi.
