OpenHands
Run OpenHands Agent Canvas in an E2B sandbox and open its web UI from your browser. The agent's shell commands, file edits and browsing stay in the sandbox.
- E2B
- Prebuilt openhands template
- openhands
- TypeScript, Python
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Run OpenHands in an E2B sandbox from this project.
- 1.Install the e2b package using the project's package manager.
- 2.The SDK needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it. Generate a separate AGENT_CANVAS_API_KEY for the sandbox and never print it.
- 3.Follow the OpenHands guide at https://docs.e2b.dev/agents/openhands: create a sandbox from the openhands template that pauses on timeout, start agent-canvas --public in the background and wait for /health on port 8000.
- 4.Run it once and show me the Agent Canvas URL the sandbox returned.
Or set it up yourself
1. Install the E2B SDK
2. Set your keys
3. Start Agent Canvas in a sandbox
4. Open the web UI
What runs in the sandbox
Agent Canvas and everything the agent does run in the sandbox, away from your machine.
- Agent Canvas, the OpenHands Agent Server and Chromium, preinstalled. The agent runs shell commands, edits files and browses the web there.
- Conversations, settings and workspaces live under /home/user/.openhands in the sandbox. Logs go to /tmp/agent-canvas.log.
- With onTimeout: 'pause' and autoResume, the sandbox pauses at its timeout and wakes on the next request to its URL.
- Public mode asks for your Agent Canvas API key, so only people you share it with can use the agent.
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.
