@e2b/code-interpreter

JavaScript/TypeScript SDK for running AI-generated code in stateful, isolated E2B cloud sandboxes

SDK
npm
v2.8.0
2,415 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
79 /100 Good
Development Activity 80
Maintenance 96
Community 52
Maturity 48
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 82
Code Quality 84
Innovation 85
Learning Curve 78

@e2b/code-interpreter is the JS/TS client for E2B’s Code Interpreter, a purpose-built sandbox template for executing untrusted or AI-generated code safely. It wraps the base E2B Sandbox SDK with a Jupyter-kernel-backed execution layer, so calling sandbox.runCode() runs Python, JavaScript, TypeScript, R, Java, or Bash inside an isolated cloud VM and streams back stdout, stderr, rich results (charts, images, dataframes), and structured errors.

Because each sandbox keeps a persistent kernel context, variables and imports declared in one runCode call are still available in the next - letting an LLM agent iteratively build up state (load a dataset, then transform it, then plot it) the same way a human would in a notebook, without re-executing setup code on every turn.

What You Get

  • A Sandbox.create() / sandbox.runCode() API built on top of E2B’s isolated cloud VMs, extending the base e2b Sandbox class
  • Stateful Jupyter-kernel execution contexts - variables and imports persist across multiple runCode calls in the same sandbox
  • Multi-language support out of the box: Python, JavaScript, TypeScript, R, Java, and Bash
  • Structured onStdout/onStderr/onResult/onError callbacks plus rich Result objects for charts, images, and other Jupyter display data
  • Runtime coverage across Node, Bun, and Deno, verified by dedicated per-runtime test suites

Common Use Cases

  • Letting an LLM agent execute Python data-analysis code it generated, then read back computed results, tables, or matplotlib charts
  • Building AI code-assistant products that need to actually run and verify generated code rather than just display it
  • Iterative, notebook-style agent workflows where state (loaded data, defined functions) must persist across several tool calls
  • Safely executing user-submitted or untrusted code in a fully isolated VM instead of the host process

Under The Hood

Architecture - The package is a thin, purpose-built layer over the base e2b Sandbox SDK: sandbox.ts extends BaseSandbox and adds runCode/createCodeContext, messaging.ts defines the Result/Execution/OutputMessage wire types and parses Jupyter-style output messages into them, and charts.ts normalizes matplotlib/plotly-style chart output into a consistent JS representation. Execution requests are proxied to a Jupyter kernel running inside the sandboxed VM over the JUPYTER_PORT defined in consts.ts, with utils.ts handling connection-closed detection and line-based streaming reads. Tech Stack - TypeScript compiled with tsup to dual ESM/CJS output, built on the e2b npm package (^2.28.0) as its only runtime dependency, tested with Vitest plus dedicated Bun and Deno test runs to guarantee cross-runtime compatibility, linted with ESLint and formatted with Prettier. Code Quality - The js/tests/ directory has 33+ test files covering execution semantics (statefulness, execution count, interrupts, reconnects), specific data/display types (charts, images, env vars), and runtime-specific behavior (tests/runtimes/bun, tests/runtimes/deno), indicating deliberate attention to correctness across execution edge cases and multiple JS runtimes. API Design - The public surface mirrors familiar async patterns (await Sandbox.create(), await sbx.runCode(...)) with optional streaming callbacks for stdout/stderr/results, keeping the common case to two or three lines of code while still exposing execution contexts and rich result objects for more advanced multi-step agent workflows.

Used by 12 apps in this directory

Python
66%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,596

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 66%
TypeScript 33%
Updated 4 days ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Go
75%
MIT

Digger

Automation · Developer Tools · Devops

5,044

Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.

View details
74
Repo Health
73
Technical
67
Dependency
Built with
Go 75%
TypeScript 15%
Updated 1 weeks ago
TypeScript
90%
Other

FastGPT

AI Agents · AI Development

29,758

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 90%
Updated 4 days ago
TypeScript
73%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

185,614

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 73%
Python 13%
Updated 4 days ago
TypeScript
62%
Other

Flowise

AI Development · Automation · Developer Tools

55,490

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
82
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 62%
JavaScript 27%
Updated 1 months ago
Python
51%
AGPL 3.0

Khoj

AI Assistants · Knowledge Management · Productivity

37,526

A self-hostable AI second brain that chats with your documents, searches the web, builds custom agents, and runs entirely on your own LLM.

View details
63
Repo Health
82
Technical
66
Dependency
Built with
Python 51%
TypeScript 36%
Updated 2 months ago
TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,098

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
90
Repo Health
77
Technical
62
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 6 days ago
TypeScript
95%
MIT

Open Lovable

AI Development

28,602

An open-source AI app builder that scrapes a live website and recreates it as a modern React app through chat — built by Firecrawl as a self-hostable example of the Lovable.dev workflow.

View details
35
Repo Health
66
Technical
70
Dependency
Built with
TypeScript 95%
Updated 10 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers