Skip to main content
AgentsUse

Code Execution and Sandboxes

E2B

Isolated Linux sandboxes in the cloud for running code written by AI agents, with Python and JavaScript SDKs and a separate code interpreter SDK.

usage_basedApache-2.0Checked 2026-10-07Source verified

Quick decision

Best for
Agent products that need to execute untrusted or AI-generated Python, JavaScript, or shell code in a fresh Linux sandbox with files, ports, templates, and optional code interpreter style stateful execution.
Not ideal for
Teams that mainly need prebuilt SaaS actions with managed end-user OAuth, such as sending Gmail or updating a CRM, where a tool integration platform is a closer fit than raw code execution infrastructure.
Pricing model
Free Hobby tier to start, with paid Pro and custom Enterprise upgrades. Sandboxes are billed by running time, with separate usage costs and higher session and concurrency limits on paid plans. See the pricing page for current rates and the workload estimator.
Deployment
Managed cloud. Self-hosted runtime. BYOC on Enterprise.
Authentication
API key authentication with E2B_API_KEY for SDK and sandbox control.
Review state
Source verified. Facts checked 2026-10-07. Not locally tested by AgentsUse.

What it does

E2B gives each agent session an isolated Linux machine that boots from a snapshot and works with any model or agent framework. The public GitHub organization describes the stack as open at the core, covering the Firecracker runtime, the control plane, the in-VM agent, the SDKs, and the dashboard. The main SDK repository frames the same idea more narrowly: open-source infrastructure for running AI-generated code in secure isolated sandboxes in the cloud, controlled from JavaScript or Python.

Day to day use starts with a sandbox. The SDK can create a sandbox, run shell commands, work with files, expose ports, pause and resume sessions, and use templates that define a base image, files, environment, and a start command captured in a snapshot. A separate Code Interpreter SDK adds stateful runCode execution on top of the same sandbox model for data work and iterative code loops. E2B also documents an MCP gateway that runs inside sandboxes and connects to tools from the Docker MCP Catalog or custom MCP servers.

Deployment is flexible for a hosted sandbox product. Teams can run on E2B Cloud, use the self-hosting Embed path on their own machine with Docker Compose, or use the broader runtime deployment described for AWS, Google Cloud, Azure, and general Linux in the SDK README. Pricing is usage based with a free Hobby tier, a paid Pro tier, and custom Enterprise terms that add BYOC deployment and larger concurrency.

Verified capabilities

Sandboxes

  • Sandbox lifecycle Source verified

    Create sandboxes from snapshots or templates, run them in isolation, pause and resume them, set timeouts, and kill them through the SDK.

  • Filesystem and ports Source verified

    Create, list, and work with files and directories in the sandbox, download files, and expose a sandbox port through a host address for HTTP or WebSocket access.

  • Custom templates Source verified

    Define sandbox templates with a base image, copied files, environment variables, setup commands, and a start command captured so processes are already running at creation.

Execution

  • Command and code execution Source verified

    Run shell commands in a sandbox, and use the Code Interpreter SDK when you need stateful runCode execution built on the sandbox SDK.

  • Desktop sandbox option Source verified

    A separate Desktop SDK provides a graphical desktop sandbox with launch, screenshot, and streaming style computer use APIs for LLM driven desktop tasks.

MCP

  • MCP gateway in sandboxes Source verified

    E2B documents a batteries-included MCP gateway inside sandboxes for type-safe access to tools from the Docker MCP Catalog or custom MCP servers.

Deployment

  • Self-hosting path Source verified

    The runtime behind E2B Cloud can be run on your own infrastructure, including an Embed path that brings the stack up with Docker Compose.

Quick start

Run a first E2B sandbox from Python

Install the Python SDK, set your E2B API key, create a sandbox, and run a shell command inside it. This follows the SDK README quickstart, with a placeholder key.

Run a first E2B sandbox from Python
pip install e2b

from e2b import Sandbox

with Sandbox.create() as sandbox:
    result = sandbox.commands.run('echo "Hello from E2B!"')
    print(result.stdout)

Source: https://github.com/e2b-dev/E2B. Examples use placeholders only. Never paste a real key into a profile, config file you share, or a ticket.

MCP support: E2B documents an MCP gateway that runs inside sandboxes and gives access to tools from the Docker MCP Catalog or custom MCP servers. A separate E2B MCP server was also found in search results, but the gateway is the verified documented path in this run.

Works with

Packages

Python package e2b on PyPI and JavaScript package e2b on npm, plus @e2b/code-interpreter for stateful code execution.

API

Programmatic sandbox control through the Python and JavaScript SDKs, including commands, files, ports, pause, and resume.

Deployment

Managed E2B Cloud, self-hosted runtime, Embed with Docker Compose, and BYOC on Enterprise plans.

Frameworks

The GitHub organization states E2B works with any model or agent framework and ships sandbox backends for several agent stacks.

Only sourced support is listed. A missing framework means AgentsUse has not verified it yet, not that it cannot work.

Health and maintenance

GitHub stars

14,223

Checked 2026-10-07

GitHub forks

1,092

Checked 2026-10-07

Package
PyPI: e2b, version 2.53.1
License
Open source, Apache-2.0
Maintainer
E2B

Stars, forks, and Apache-2.0 license read from the fetched GitHub repo page for e2b-dev/E2B. Package name and version read from the fetched PyPI page for e2b, release files for 2.53.1. Weekly downloads were not read from PyPI, so they are omitted. The npm page for e2b was also fetched but showed a different version line, so PyPI is used as the package source here.

Pricing and license

Free Hobby tier to start, with paid Pro and custom Enterprise upgrades. Sandboxes are billed by running time, with separate usage costs and higher session and concurrency limits on paid plans. See the pricing page for current rates and the workload estimator.

Official pricing or docs →

Limitations and safety

  • Hosted session length and concurrency are plan gated on the pricing page, with longer sessions and custom sizes on paid tiers.
  • Self-hosting the full runtime is an infrastructure project in Go with Firecracker and Terraform or Embed pieces, not a simple local library install.
  • E2B is execution infrastructure first. Prebuilt business app actions and end-user OAuth for SaaS tools are not its core surface.
Safety

Browser and data tools can read pages, fill forms, and download files. Start with a test account or read-only access, keep credentials in environment variables, and review agent actions before connecting anything that can spend money, send messages, or delete data.

Alternatives to E2B

Common questions

What does E2B do for an AI agent?

Isolated Linux sandboxes in the cloud for running code written by AI agents, with Python and JavaScript SDKs and a separate code interpreter SDK.

Is E2B open source?

Yes. This profile records the license as Apache-2.0 from the official repository.

Does E2B support MCP?

E2B documents an MCP gateway that runs inside sandboxes and gives access to tools from the Docker MCP Catalog or custom MCP servers. A separate E2B MCP server was also found in search results, but the gateway is the verified documented path in this run.

Sources and freshness

Last checked 2026-10-07. Verification label: source verified, which means public claims trace to the sources above. It does not mean AgentsUse ran the tool. Spotted an error? Send a correction. Back to the tools directory.