2024-10-14 19:51:05 -07:00
2024-07-18 10:30:54 +02:00
2023-12-13 22:25:03 +01:00
2024-10-14 19:37:16 -07:00
2024-10-14 19:51:05 -07:00
2023-12-09 19:38:16 +01:00
2023-09-26 19:12:23 +02:00
2024-10-14 19:51:05 -07:00
2024-07-15 14:44:16 +02:00
2024-09-26 11:56:34 +02:00
2024-10-14 16:43:07 -07:00
2024-08-14 13:09:21 +02:00
2024-09-26 14:23:10 +02:00
2023-10-22 12:43:03 -07:00
2024-09-20 12:20:31 +02:00
2023-07-01 17:08:01 -07:00
2023-05-21 10:51:33 -07:00
2024-10-14 19:51:05 -07:00
2024-10-14 11:35:58 -07:00
2024-10-14 11:35:58 -07:00
2024-10-12 20:10:04 -07:00

e2b logo

E2B SDK

The E2B SDK is made to control the E2B Sandboxes - secure cloud environments for running LLM-generated code. The SDK lets you give your AI app a custom code interpreter.

  • ✔️ Works with any LLM and AI framework (see Cookbook for examples)
  • ✔️ Supports streaming content like charts and stdout, stderr
  • ✔️ Python & JS SDK
  • ✔️ Runs on serverless and edge functions
  • ✔️ Runs AI-generated code in secure sandboxed environments
  • ✔️ 100% open source (including infrastructure)
💻 Supported language runtimes
  • ✔️ Python
  • (Beta) JavaScript, R, Java

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


What is E2B?

E2B is an open-source runtime for running AI-generated code in secure cloud Sandboxes. It's tailor-made for agentic & AI use cases.

E2B Sandbox

E2B Sandbox is a secure cloud environment that allows AI agents and apps. You can run multiple instances of Sandboxes, and have long-running sessions. Inside the Sandboxes, LLMs can use the same tools as humans do, e.g.:

  • Running LLM generated code
  • Cloud browsers
  • GitHub repositories and CLIs
  • Coding tools like linters, autocomplete, "go-to defintion"
  • Audio & video editing

Start with E2B SDK

1. Install SDK

JavaScript/TypeScript

npm i @e2b/code-interpreter

Python

pip install e2b_code_interpreter

2. Execute code with code interpreter inside Sandbox

JavaScript

import { CodeInterpreter } from '@e2b/code-interpreter'

const sandbox = await CodeInterpreter.create()
await sandbox.notebook.execCell('x = 1')

const execution = await sandbox.notebook.execCell('x+=1; x')
console.log(execution.text)  // outputs 2

await sandbox.close()

Python

from e2b_code_interpreter import CodeInterpreter

with CodeInterpreter() as sandbox:
    sandbox.notebook.exec_cell("x = 1")

    execution = sandbox.notebook.exec_cell("x+=1; x")
    print(execution.text)  # outputs 2

3. Hello World guides

Dive depeer and check out the JavaScript/TypeScript and Python "Hello World" guides to learn how to connect code interpreter LLMs.

Please visit documentation to get started.

Repository Structure

This repository is a monorepo containing:

  1. Python SDK
  2. JS SDK
  3. CLI
  4. Documentation
Description
Open-source, secure environment with real-world tools for enterprise-grade agents.
Readme Apache-2.0 57 MiB
Languages
Python 56.3%
TypeScript 42.3%
Go 0.6%
Dockerfile 0.3%
Handlebars 0.2%
Other 0.3%