MCPcopy
hub / github.com/e2b-dev/E2B

github.com/e2b-dev/E2B @2.31.0 sqlite

repository ↗ · DeepWiki ↗ · release 2.31.0 ↗
4,082 symbols 16,500 edges 656 files 1,049 documented · 26%
README

E2B Logo E2B Logo

Last 1 month downloads for the Python SDK Last 1 month downloads for the JavaScript SDK

What is E2B?

E2B is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our JavaScript SDK or Python SDK.

Run your first Sandbox

1. Install SDK

JavaScript / TypeScript

npm i e2b

Python

pip install e2b

2. Get your E2B API key

  1. Sign up to E2B here.
  2. Get your API key here.
  3. Set environment variable with your API key
E2B_API_KEY=e2b_***

3. Start a sandbox and run commands

JavaScript / TypeScript

import Sandbox from 'e2b'

const sandbox = await Sandbox.create()
const result = await sandbox.commands.run('echo "Hello from E2B!"')
console.log(result.stdout) // Hello from E2B!

Python

from e2b import Sandbox

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

4. Code execution with Code Interpreter

If you need to execute code with runCode()/run_code(), install the Code Interpreter SDK:

npm i @e2b/code-interpreter  # JavaScript/TypeScript
pip install e2b-code-interpreter  # Python
import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()
const execution = await sandbox.runCode('x = 1; x += 1; x')
console.log(execution.text)  // outputs 2

5. Check docs

Visit E2B documentation.

6. E2B cookbook

Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.

Self-hosting

Read the self-hosting guide to learn how to set up the E2B infrastructure on your own. The infrastructure is deployed using Terraform.

Supported cloud providers: - 🟢 AWS - 🟢 Google Cloud (GCP) - [ ] Azure - [ ] General Linux machine

Extension points exported contracts — how you extend this code

SignatureOpts (Interface)
* Get the URL signature for the specified path, operation and user. * * @param path Path to the file in the sandbox.
packages/js-sdk/src/sandbox/signature.ts
UserIdentity (Interface)
(no doc)
packages/cli/src/user.ts
TemplateFromImage (Interface)
(no doc) [2 implementers]
packages/js-sdk/src/template/types.ts
UserOAuth (Interface)
(no doc)
packages/cli/src/user.ts
TemplateBuilder (Interface)
(no doc) [2 implementers]
packages/js-sdk/src/template/types.ts
UserTokens (Interface)
(no doc)
packages/cli/src/user.ts
CommandResult (Interface)
(no doc) [1 implementers]
packages/js-sdk/src/sandbox/commands/commandHandle.ts
UserConfig (Interface)
(no doc)
packages/cli/src/user.ts

Core symbols most depended-on inside this repo

write
called by 201
packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
update
called by 193
packages/python-sdk/e2b/envd/process/process_connect.py
from_dict
called by 157
packages/python-sdk/e2b/api/client/models/node.py
run
called by 144
packages/python-sdk/e2b/sandbox_sync/commands/command.py
remove
called by 117
packages/js-sdk/src/template/types.ts
run
called by 115
packages/js-sdk/src/sandbox/commands/index.ts
push
called by 112
packages/js-sdk/src/sandbox/git/index.ts
write
called by 103
packages/js-sdk/src/sandbox/filesystem/index.ts

Shape

Function 1,642
Method 1,581
Class 548
Interface 295
Enum 10
Route 5
Struct 1

Languages

Python74%
TypeScript25%
Go1%

Modules by API surface

packages/js-sdk/src/sandbox/mcp.d.ts223 symbols
packages/python-sdk/e2b/sandbox/mcp.py168 symbols
packages/js-sdk/src/template/index.ts53 symbols
packages/python-sdk/e2b/template/main.py50 symbols
packages/js-sdk/src/errors.ts46 symbols
packages/js-sdk/src/sandbox/sandboxApi.ts44 symbols
packages/js-sdk/src/sandbox/git/index.ts43 symbols
packages/python-sdk/e2b_connect/client.py42 symbols
packages/js-sdk/src/template/types.ts37 symbols
packages/python-sdk/tests/sync/template_sync/test_stacktrace.py36 symbols
packages/python-sdk/tests/async/template_async/test_stacktrace.py36 symbols
packages/python-sdk/tests/sync/volume_sync/test_file.py35 symbols

Dependencies from manifests, versioned

golang.org/x/expv0.0.0-2024041616015 · 1×
google.golang.org/protobufv1.33.0 · 1×
@bufbuild/protobuf2.6.2 · 1×
@changesets/read0.6.2 · 1×
@connectrpc/connect2.0.0-rc.3 · 1×
@connectrpc/connect-web2.0.0-rc.3 · 1×
@iarna/toml2.2.5 · 1×
@inquirer/prompts7.9.0 · 1×
@npmcli/package-json5.2.1 · 1×
@testing-library/react16.2.0 · 1×
@types/handlebars4.1.0 · 1×
@types/inquirer9.0.7 · 1×

Datastores touched

(mysql)Database · 1 repos
mydbDatabase · 1 repos

For agents

$ claude mcp add E2B \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact