SuperAPIAI Directory

e2b-cookbook

github.com · AI developer platforms

E2B Cookbook is an example code and guide repository officially maintained by E2B, used to demonstrate how to build applications using the E2B SDK. The repository includes a Hello World getting-started guide, multiple open-source applications (such as data analysis, LLM-generated UI, and computer-use agents), AI framework integrations, reinforcement learning, remote execution integrations (including MCP), and various use cases (such as uploading datasets for analysis, web scraping analysis, running Docker containers, Playwright testing, cloud browser driving, subdomain mapping, sandbox cleanup, etc.). Each example is verified in real E2B sandboxes through a nightly test suite. It is suitable for developers to learn how to use E2B and get started quickly.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux · API

About this tool

E2B Cookbook is a collection of example code and guides for developers, designed to help users build applications using the E2B SDK. The repository is maintained by the E2B team, and its content covers a variety of scenarios from beginner to advanced.

Purpose: To provide runnable code examples and operational guides, lower the barrier to using the E2B SDK, and demonstrate how to integrate E2B sandbox capabilities across different tech stacks and frameworks.

Main capabilities:

  • Hello World guide: Provides minimal examples in JavaScript and Python, requiring only an E2B API key to run.
  • Open-source application examples: Including E2B AI Analyst (data analysis and interactive charts), E2B Fragments (prompting different LLMs to generate applications with UI), and E2B Surf (a computer-use AI agent based on OpenAI).
  • Multi-turn reinforcement learning: The OpenEnv Terminus example, which can obtain the first reward without a model or GPU, and optionally connect to native TRL training.
  • AI framework integration and reinforcement learning: For example, providing code rewards for TRL GRPO, first obtaining code rewards in a GPU-free environment, and then training JSON processing tasks in sandboxed Python execution.
  • Remote execution integration: Including examples related to the Model Context Protocol (MCP).
  • Use case examples: Uploading a dataset and analyzing it with Llama 3.3 (Python), scraping Airbnb with Claude Opus 5 and Firecrawl and analyzing it (TypeScript), visualizing website themes with Claude Sonnet 5 and Firecrawl (Python), a Next.js application integrating an LLM and code interpreter with streaming output support (TypeScript), running Docker containers in E2B (Python/TypeScript), Tailcat encrypted links (Python/TypeScript), running Playwright in E2B (TypeScript), testing applications in a sandbox using the Notte cloud browser (Python), driving Chromium using the Anchor cloud browser (TypeScript), mapping custom subdomains to sandboxes (TypeScript), deleting old paused sandboxes by age and metadata (Python/Shell), a Flue-based feedback analysis agent publishing HTML reports (TypeScript), preheating a sandbox and rerunning tests (Python), teaching the Hermes event classification manual and reusing it in a new session (Python).

Usage:

  • Each example contains standalone code and instructions; users can clone the repository and run it following the guidance in the example directory.
  • Running the examples requires E2B_API_KEY, and some examples also require the corresponding model provider's key; refer to .env.example for configuration.
  • It is recommended to start with hello-world-js or hello-world-python, as these two examples only require an E2B key.
  • The repository includes a test suite tests/run-examples.ts, which runs all examples nightly in real E2B sandboxes: each example is uploaded to a new sandbox, installed and run using its toolchain (npm, uv, Poetry, or nbconvert), and is considered passing if the exit code is 0.
  • The test suite focuses on the sandbox itself rather than model behavior: provider rate limiting or quota exhaustion is considered passing (because the sandbox still successfully builds, installs, and runs); non-deterministic model behavior (such as not generating a chart, malformed tool call format, or generated code erroring inside the sandbox) is marked as skipped; real failures include missing templates, dependency resolution issues, entry point errors, authentication issues, retired model IDs, sandbox timeouts, etc. Some examples are excluded because they require provider keys the repository does not hold, long-running services that cannot be asserted on, or upstream fixes; the reasons for exclusion are listed at the top of tests/run-examples.ts.

Use cases: suitable for developers who want to learn the E2B SDK, teams that need to quickly validate sandbox execution capabilities, and people looking for implementation references for scenarios such as AI agents, data analysis, code interpretation, and browser automation.

Limitations: the repository is a collection of examples and does not provide production-level support; running the examples requires the corresponding API keys and network environment; some examples depend on specific models or third-party services and may break as external conditions change; the test suite only verifies sandbox execution and does not guarantee model output quality.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools