Claude Managed Agents
Claude runs the agent loop, and the tool calls run in sandboxes you own. A webhook router on E2B gives each session its own worker sandbox.
- E2B
- Self-hosted environment via webhooks
- E2B/claude-managed-agents-webhooks
- e2b + anthropic
- Python, 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 Claude Managed Agents project.
- 1.Install e2b and the Anthropic SDK (anthropic for Python, @anthropic-ai/sdk for TypeScript) using the project's package manager.
- 2.The code 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. Ask me for ANTHROPIC_API_KEY, ANTHROPIC_ENVIRONMENT_ID, ANTHROPIC_ENVIRONMENT_KEY and ANTHROPIC_AGENT_ID from the Claude Console the same way.
- 3.Follow the Claude Managed Agents guide at https://docs.e2b.dev/agents/claude-managed-agents: start the E2B/claude-managed-agents-webhooks template with auto-resume, write its config, and print the webhook URL. Have me register it in the Claude Console for session.status_run_started, then write the signing key (ANTHROPIC_WEBHOOK_SIGNING_KEY) into the same sandbox.
- 4.Create a session, send one message that runs a shell command, and show me Claude's answer and the worker log from the sandbox.
Or set it up yourself
1. Install the SDKs
2. Set your keys
3. Start the webhook sandbox
4. Register the webhook, then start a session
What runs in the sandbox
Claude decides what to do. The filesystem, tools, network and logs live in E2B sandboxes you own.
- Every tool call runs in a worker sandbox with /mnt/session as its workdir. Claude's reasoning loop does not.
- Each session gets its own worker. Follow-up turns reconnect to it and reuse the same /mnt/session files.
- The router starts workers with auto-resume and pause-on-timeout, so idle sessions pause instead of losing state.
- The webhook sandbox verifies Claude's webhooks with your signing key and keeps the session-to-sandbox assignments.
More agent platforms
Other hosted agent APIs that run their tools on E2B.
- OpenAI Agents APIPick E2B as the execution environment for OpenAI's Agents API, app-managed or webhook-managed.
- Gemini Managed AgentsRun the file and shell tools of a Gemini API managed agent in your own E2B sandbox.
- Cursor cloud agentsRun Cursor's self-hosted cloud agents on E2B dispatcher and worker sandboxes.
