E2B README

The project's README from github.com/e2b-dev/E2B. As one markdown file: README.md.

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 (JavaScript / Python):

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. Computer use with Desktop

For mouse, keyboard, screenshot, application, and desktop streaming APIs, install the Desktop SDK (JavaScript / Python):

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

const desktop = await Sandbox.create()
await desktop.launch('google-chrome')
const screenshot = await desktop.screenshot()

6. Check docs

Visit E2B documentation.

7. 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:

E2B (e2b-dev/E2B)

Searching Databaseโ€ฆ

14.4K ยทGitHub
What is this?E2B is open-source infrastructure that lets you run AI-generated code in secure, isolated cloud sandboxes, so agents can execute untrusted code safely.
Is this a library or a cloud service?Both: it is a sandbox cloud service controlled through JavaScript/TypeScript or Python SDKs, and you can also self-host the whole infrastructure yourself.
How do I run my first sandbox?Install the SDK, sign up for an E2B API key, set it as an environment variable, then start a sandbox and run commands from your JS/TS or Python code.
Do I need an E2B API key to use the sandboxes?Yes, you need to sign up on E2B and get an API key before starting any sandbox.
Can I self-host E2B instead of using the cloud?Yes, there's a self-hosting guide that deploys the infrastructure with Terraform, but it currently only fully supports AWS and GCP โ€” Azure and generic Linux machines are not yet done.
Who is E2B for?Developers building AI agents or copilots that need to execute LLM-generated code safely, such as code interpreters or AI coding assistants.
Is this a desktop app or a cloud platform?It's a cloud platform accessed via SDK calls from your own JS/Python code; there's no desktop app involved.
What is the Code Interpreter SDK for?It's an add-on SDK that lets you execute code inside a sandbox with a simple runCode()/run_code() call, useful for notebook-like agent workflows.
What is the Desktop SDK?It adds computer-use capabilities to sandboxes: mouse, keyboard, screenshots, application control, and desktop streaming APIs.
Are there example projects to learn from?Yes, the E2B Cookbook has examples combining E2B sandboxes with different LLMs and AI frameworks.
Which cloud providers back the hosted E2B service?The managed E2B cloud service itself works out of the box; the self-hosting option specifically supports deploying on AWS and GCP via Terraform.
Creator
e2b-dev
Size
127.1 MB
Stars
14.4K
Age
3y
Commits ยท 90 Days