e2b-dev/e2b-cookbook

Examples of using E2B

1,393

stars

765

commits

TypeScript

primary language

Sep 4, 2026

updated

docs.e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=repo_website&utm_content=e2b-cookbook
agent
ai
ai-agents
code-interpreter
cookbook
devtools
e2b
example
gpt
gpt4
guides
javascript
llm
openai
python
python3
sdk
tutorial
typescript

README

E2B Cookbook Preview Light E2B Cookbook Preview Dark

✴️ E2B Cookbook

Example code and guides for building with E2B SDK.

Read more about E2B on the E2B website and the official E2B documentation.

Examples

Hello World guide

Open-source apps

  • E2B AI Analyst - analyze your data & create interactive charts
  • E2B Fragments - prompt different LLMS to generate apps with UI
  • E2B Surf - computer use AI agent powered by OpenAI

LLM providers

ProviderTopic(s)ExamplePythonTypeScript
OpenAIAgents SDKAgentic workflows running in E2B sandboxesPython-
GPT-5.6Data analysis and visualization of a CSVPythonTypeScript
GPT-5.6Code interpreter and reasoning on image dataPythonTypeScript
GPT-5.6Code interpreter for ML on datasetPythonTypeScript
Codex CLIOpenAI Codex, running inside a SandboxPythonTypeScript
AnthropicClaude Opus 5Code interpreterPythonTypeScript
Claude CodeClaude Code, running inside a SandboxPythonTypeScript
Claude Managed AgentsSelf-hosted worker running inside a SandboxPython-
MetaMuse SparkCoding agent with E2B as its execution backendPython-
MistralCodestralCode interpreterPythonTypeScript
GroqLlama 3Code interpreter via function callingPythonTypeScript
Fireworks AIQwen2.5-Coder-32B-InstructCode interpreterPython-
Llama 3.1 405B, 70B, 8BCode interpreterPython-
Together AILlama 3.1, Qwen 2, Code Llama, DeepSeek CoderCode interpreterPythonTypeScript
WatsonX AIIBM Graphite, Llama, MistralCode interpreterPythonTypeScript

AI frameworks integrations

FrameworkDescriptionPythonTypeScript
🦜⛓️ LangChainLangChain with Code InterpreterPython-
🦜🕸️ LangGraphLangGraph with code interpreterPython-
CrewAICrewAI agent with sandboxed Python executionPython-
Hermes AgentLearn an incident-triage skill in one sandbox and apply it in a fresh sessionPython-
▲ Vercel AI SDKNext.js + AI SDK + Code Interpreter-TypeScript
Vercel AI SDKAI SDK sandbox provider: sandboxed tools via restricted sessions, and harness coding agents (Claude Code, Codex) running inside E2B-TypeScript
Vercel eveFeedback analyst agent whose sandbox backend is E2B, publishing an HTML report from the sandbox-TypeScript
FlueFeedback analyst agent running entirely inside an E2B sandbox, publishing an HTML report from the sandbox-TypeScript
PiPi builds its own E2B code-interpreter extension in a sandbox, then uses it to analyze data-TypeScript
AgentKitAgentKit Coding Agent-TypeScript
Sandbox Agent SDKRun Sandbox Agent inside E2B and connect with the SDK-TypeScript
StirrupThe lightweight framework for building agentsPython-

Remote execution integrations

IntegrationDescriptionPythonTypeScript
CrabboxWarm one E2B sandbox, sync local changes, and rerun a test suite on the same leasePython-

Model Context Protocol (MCP)

ExampleDescriptionTypeScript
MCP ClientBasic MCP client connection to E2B sandboxTypeScript
MCP Custom ServerConnect to custom filesystem MCP server from GitHubTypeScript
MCP Custom TemplateCreate custom E2B template with pre-installed MCP serversTypeScript
MCP Research AgentResearch agent using arXiv and DuckDuckGo MCP serversTypeScript
MCP Claude CodeClaude Code with MCP integrationTypeScript
MCP BrowserbaseWeb automation agent using Browserbase MCP serverTypeScript
MCP Groq ExaAI research using Groq with Exa MCP serverTypeScript

Example use cases

  • Upload dataset and analyze it with Llama 3.3 - Python
  • Scrape Airbnb and analyze data with Claude Opus 5 and Firecrawl - TypeScript
  • Visualize website topics with Claude Sonnet 5 and Firecrawl - Python
  • Next.js app with LLM + Code Interpreter and streaming - TypeScript
  • How to run a Docker container in E2B - Python/TypeScript
  • How to run Playwright in E2B - TypeScript
  • Map custom subdomains to your sandboxes - TypeScript
  • Feedback analyst agent on Flue, publishing an HTML report from a sandbox - TypeScript
  • Warm an E2B sandbox and rerun tests after adding a local regression case - Python
  • Teach Hermes an incident-triage playbook and reuse it in a fresh session - Python

Running the examples as a test suite

Every example is exercised nightly against live E2B by tests/run-examples.ts: each one is uploaded into a fresh sandbox, installed with its own toolchain (npm, uv, Poetry, or nbconvert for notebooks) and run. An example passes if it exits 0.

npm install
npm test                      # all of them
npm test -- hello-world       # substring filter, one or a few

You need an E2B_API_KEY plus whichever provider key the examples you are running use - see .env.example. hello-world-js and hello-world-python need only the E2B key, so they are the ones to try first.

What counts as a failure. The suite checks the sandbox, not the model. A provider rate limit or an exhausted quota counts as OK, because the sandbox still built, installed and ran; non-deterministic model behaviour - no chart produced, a malformed tool call, generated code raising inside the sandbox - is reported as skipped. Real failures are the things that are actually broken: missing templates, dependency resolution, wrong entrypoints, auth, retired model ids, sandbox timeouts.

Some examples are deliberately not covered - they need a provider key this repo does not hold, a long-lived server the runner cannot assert on, or an upstream fix. Each exclusion is listed with its reason at the top of tests/run-examples.ts, so a gap is never silent.

Contributors

(top 30 of 31)

tizkovatereza

175 commits

mlejva

150 commits

jamesmurdza

106 commits

beran-t

62 commits

e2b-dev/e2b-cookbook

Examples of using E2B

1,393

stars

765

commits

TypeScript

primary language

Sep 4, 2026

updated

docs.e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=repo_website&utm_content=e2b-cookbook
agent
ai
ai-agents
code-interpreter
cookbook
devtools
e2b
example
gpt
gpt4
guides
javascript
llm
openai
python
python3
sdk
tutorial
typescript

README

E2B Cookbook Preview Light E2B Cookbook Preview Dark

✴️ E2B Cookbook

Example code and guides for building with E2B SDK.

Read more about E2B on the E2B website and the official E2B documentation.

Examples

Hello World guide

Open-source apps

  • E2B AI Analyst - analyze your data & create interactive charts
  • E2B Fragments - prompt different LLMS to generate apps with UI
  • E2B Surf - computer use AI agent powered by OpenAI

LLM providers

ProviderTopic(s)ExamplePythonTypeScript
OpenAIAgents SDKAgentic workflows running in E2B sandboxesPython-
GPT-5.6Data analysis and visualization of a CSVPythonTypeScript
GPT-5.6Code interpreter and reasoning on image dataPythonTypeScript
GPT-5.6Code interpreter for ML on datasetPythonTypeScript
Codex CLIOpenAI Codex, running inside a SandboxPythonTypeScript
AnthropicClaude Opus 5Code interpreterPythonTypeScript
Claude CodeClaude Code, running inside a SandboxPythonTypeScript
Claude Managed AgentsSelf-hosted worker running inside a SandboxPython-
MetaMuse SparkCoding agent with E2B as its execution backendPython-
MistralCodestralCode interpreterPythonTypeScript
GroqLlama 3Code interpreter via function callingPythonTypeScript
Fireworks AIQwen2.5-Coder-32B-InstructCode interpreterPython-
Llama 3.1 405B, 70B, 8BCode interpreterPython-
Together AILlama 3.1, Qwen 2, Code Llama, DeepSeek CoderCode interpreterPythonTypeScript
WatsonX AIIBM Graphite, Llama, MistralCode interpreterPythonTypeScript

AI frameworks integrations

FrameworkDescriptionPythonTypeScript
🦜⛓️ LangChainLangChain with Code InterpreterPython-
🦜🕸️ LangGraphLangGraph with code interpreterPython-
CrewAICrewAI agent with sandboxed Python executionPython-
Hermes AgentLearn an incident-triage skill in one sandbox and apply it in a fresh sessionPython-
▲ Vercel AI SDKNext.js + AI SDK + Code Interpreter-TypeScript
Vercel AI SDKAI SDK sandbox provider: sandboxed tools via restricted sessions, and harness coding agents (Claude Code, Codex) running inside E2B-TypeScript
Vercel eveFeedback analyst agent whose sandbox backend is E2B, publishing an HTML report from the sandbox-TypeScript
FlueFeedback analyst agent running entirely inside an E2B sandbox, publishing an HTML report from the sandbox-TypeScript
PiPi builds its own E2B code-interpreter extension in a sandbox, then uses it to analyze data-TypeScript
AgentKitAgentKit Coding Agent-TypeScript
Sandbox Agent SDKRun Sandbox Agent inside E2B and connect with the SDK-TypeScript
StirrupThe lightweight framework for building agentsPython-

Remote execution integrations

IntegrationDescriptionPythonTypeScript
CrabboxWarm one E2B sandbox, sync local changes, and rerun a test suite on the same leasePython-

Model Context Protocol (MCP)

ExampleDescriptionTypeScript
MCP ClientBasic MCP client connection to E2B sandboxTypeScript
MCP Custom ServerConnect to custom filesystem MCP server from GitHubTypeScript
MCP Custom TemplateCreate custom E2B template with pre-installed MCP serversTypeScript
MCP Research AgentResearch agent using arXiv and DuckDuckGo MCP serversTypeScript
MCP Claude CodeClaude Code with MCP integrationTypeScript
MCP BrowserbaseWeb automation agent using Browserbase MCP serverTypeScript
MCP Groq ExaAI research using Groq with Exa MCP serverTypeScript

Example use cases

  • Upload dataset and analyze it with Llama 3.3 - Python
  • Scrape Airbnb and analyze data with Claude Opus 5 and Firecrawl - TypeScript
  • Visualize website topics with Claude Sonnet 5 and Firecrawl - Python
  • Next.js app with LLM + Code Interpreter and streaming - TypeScript
  • How to run a Docker container in E2B - Python/TypeScript
  • How to run Playwright in E2B - TypeScript
  • Map custom subdomains to your sandboxes - TypeScript
  • Feedback analyst agent on Flue, publishing an HTML report from a sandbox - TypeScript
  • Warm an E2B sandbox and rerun tests after adding a local regression case - Python
  • Teach Hermes an incident-triage playbook and reuse it in a fresh session - Python

Running the examples as a test suite

Every example is exercised nightly against live E2B by tests/run-examples.ts: each one is uploaded into a fresh sandbox, installed with its own toolchain (npm, uv, Poetry, or nbconvert for notebooks) and run. An example passes if it exits 0.

npm install
npm test                      # all of them
npm test -- hello-world       # substring filter, one or a few

You need an E2B_API_KEY plus whichever provider key the examples you are running use - see .env.example. hello-world-js and hello-world-python need only the E2B key, so they are the ones to try first.

What counts as a failure. The suite checks the sandbox, not the model. A provider rate limit or an exhausted quota counts as OK, because the sandbox still built, installed and ran; non-deterministic model behaviour - no chart produced, a malformed tool call, generated code raising inside the sandbox - is reported as skipped. Real failures are the things that are actually broken: missing templates, dependency resolution, wrong entrypoints, auth, retired model ids, sandbox timeouts.

Some examples are deliberately not covered - they need a provider key this repo does not hold, a long-lived server the runner cannot assert on, or an upstream fix. Each exclusion is listed with its reason at the top of tests/run-examples.ts, so a gap is never silent.

Contributors

(top 30 of 31)

tizkovatereza

175 commits

mlejva

150 commits

jamesmurdza

106 commits

beran-t

62 commits

Languages

TypeScript

73.6%

JavaScript

26.4%