E2b Integration for AI Agents

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with E2b MCP or direct API to run code, manage sandboxes, analyze script results, and automate multi-language workflows through natural language.
E2b Logo
Gradient Top
Gradient Middle
Gradient Bottom
divider

Try E2b now

Enter a prompt below to test the integration in our Tool Router playground. You'll be redirected to sign in and try it live.

Supported Tools

Tools
Connect to SandboxTool to connect to an existing E2B sandbox and retrieve its details.
Create TemplateTool to create a new E2B template with specified configuration.
Create WebhookTool to register a new webhook to receive sandbox lifecycle events for the team.
Delete SandboxTool to terminate and permanently delete a running E2B sandbox instance.
Delete WebhookTool to unregister a webhook and stop receiving lifecycle events.
Check API HealthTool to check the health status of the E2B API.
Get SandboxTool to retrieve detailed information about a specific sandbox by its ID.
Get Sandbox LogsTool to retrieve logs from a specific E2B sandbox instance.
Get Sandbox Lifecycle EventsTool to retrieve the latest lifecycle events for a particular sandbox instance.
Get Sandbox MetricsTool to retrieve timestamped CPU, memory, and disk usage metrics for a sandbox.
Get Team MetricsTool to retrieve timestamped CPU, memory, and disk usage metrics for a team.
Get Team Maximum MetricsTool to retrieve the maximum value for a specific team metric in a given interval.
Get Template Build StatusTool to get the status of a template build.
Get Template FilesTool to get an upload link for a tar file containing build layer files.
Get Webhook ConfigurationTool to retrieve the current webhook configuration for a specific webhook.
List All SandboxesTool to list all running and paused sandboxes associated with your team.
List Sandboxes MetricsTool to retrieve timestamped CPU, memory, and disk usage metrics for multiple sandboxes.
List Team Sandbox Lifecycle EventsTool to retrieve the latest lifecycle events across all sandboxes associated with the team.
List All TemplatesTool to list all available E2B templates for your team.
List All WebhooksTool to retrieve all registered webhooks for your team.
Pause SandboxTool to pause a running E2B sandbox preserving its filesystem and memory state.
Create SandboxTool to create a new E2B sandbox from a template.
Set Sandbox TimeoutTool to set the timeout for an E2B sandbox.
Refresh SandboxTool to refresh an E2B sandbox and extend its time to live.
Start Template BuildTool to start a build for an E2B template.
Update TemplateTool to update an E2B template configuration.
Update Webhook ConfigurationTool to update an existing webhook configuration including URL, enabled status, and subscribed events.
Python
TypeScript

Install Composio

python
pip install composio claude-agent-sdk
Install the Composio SDK for Python or TypeScript

Initialize Client and Create Tool Router Session

python
from composio import Composio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions

composio = Composio(api_key='your-composio-api-key')
session = composio.create(user_id='your-user-id')
url = session.mcp.url
Import and initialize the Composio client, then create a Tool Router session for E2b

Connect to AI Agent

python
import asyncio

options = ClaudeAgentOptions(
    permission_mode='bypassPermissions',
    mcp_servers={
        'tool_router': {
            'type': 'http',
            'url': url,
            'headers': {
                'x-api-key': 'your-composio-api-key'
            }
        }
    },
    system_prompt='You are a helpful assistant with access to E2b tools.',
    max_turns=10
)

async def main():
    async with ClaudeSDKClient(options=options) as client:
        await client.query('Run a Python script to check if a string is a palindrome.')
        async for message in client.receive_response():
            if hasattr(message, 'content'):
                for block in message.content:
                    if hasattr(block, 'text'):
                        print(block.text)

asyncio.run(main())
Use the MCP server with your AI agent (Anthropic Claude or Mastra)

Why Use Composio?

AI Native E2b Integration

  • Supports both E2b MCP and direct API based integrations
  • Structured, LLM-friendly schemas for reliable tool execution
  • Rich coverage for reading, writing, and querying your E2b data

Managed Auth

  • Built-in OAuth handling with automatic token refresh and rotation
  • Central place to manage, scope, and revoke E2b access
  • Per user and per environment credentials instead of hard-coded keys

Agent Optimized Design

  • Tools are tuned using real error and success rates to improve reliability over time
  • Comprehensive execution logs so you always know what ran, when, and on whose behalf

Enterprise Grade Security

  • Fine-grained RBAC so you control which agents and users can access E2b
  • Scoped, least privilege access to E2b resources
  • Full audit trail of agent actions to support review and compliance

Frequently Asked Questions

Do I need my own developer credentials to use E2b with Composio?

Yes, E2b requires you to configure your own API key credentials. Once set up, Composio handles secure credential storage and API request handling for you.

Can I use multiple toolkits together?

Yes! Composio's Tool Router enables agents to use multiple toolkits. Learn more.

Is Composio secure?

Composio is SOC 2 and ISO 27001 compliant with all data encrypted in transit and at rest. Learn more.

What if the API changes?

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

Used by agents from

Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai
Context
Letta
glean
HubSpot
Agent.ai
Altera
DataStax
Entelligence
Rolai

Never worry about agent reliability

We handle tool reliability, observability, and security so you never have to second-guess an agent action.