Agent 开发框架

E2B|AI 生成代码的安全隔离沙箱基础设施

E2B

E2B 是用于在云端隔离沙箱中运行 AI 生成代码的开源基础设施,提供 JavaScript 与 Python SDK 来启动和控制沙箱。

获取与使用

需要部署

按官方资料自行安装或部署

使用难度待核验
国内可用性待核验

2026-11-09 更新 · 本站尚未实测

项目介绍

Agent 开发框架 · 2026-11-09 更新 · 本站尚未实测

E2B 是一个开源基础设施,允许在云端的安全隔离沙箱中运行 AI 生成的代码。要启动和控制沙箱,可使用其 JavaScript SDK 或 Python SDK。仓库描述将其定位为面向企业级 Agent 的、带有真实工具的安全环境。它本身不是可直接对话的 Agent,也不是 MCP 服务,而是供开发者集成到 AI 应用与 Agent 工作流中的代码执行沙箱基础设施。

核心能力

点击能力名称查看输入、输出和原文依据。

  • 沙箱启动与命令执行:通过 SDK 创建沙箱并运行 shell 命令,README 示例展示了 echo "Hello from E2B!" 的输出读取。
  • Code Interpreter:安装 Code Interpreter SDK 后,可通过 runCode() / run_code() 执行代码,示例为运行 x = 1; x += 1; x 并输出 2。
  • Computer use 与 Desktop:安装 Desktop SDK 后可获得鼠标、键盘、截图、应用启动和桌面流式传输相关 API,示例为启动 google-chrome 并截图。
  • 自托管:README 指引参考 E2B runtime 的 embed 部署指南,使用 Terraform 部署,列出的支持云厂商为 AWS、Google Cloud、Azure 和一般 Linux 机器(通过 Embed)。

实际应用场景

适用场景

适合需要在 AI 应用或 Agent 流程中执行模型生成代码、运行命令、做代码解释、或以桌面方式自动化操作的开发者。也适合希望基于开源 runtime 自建隔离执行环境的团队。具体可承载的工具与工作流需要使用者自行设计,仓库未提供可直接下载的工作流文件。

安装与接入

README 给出的安装方式为 SDK 安装:

  • JavaScript/TypeScript:npm i e2b
  • Python:pip install e2b
  • Code Interpreter:npm i @e2b/code-interpreter 或 pip install e2b-code-interpreter
  • Desktop:npm i @e2b/desktop 或 pip install e2b-desktop

使用前需注册 E2B 并获取 API key,通过环境变量设置 E2B_API_KEY=e2b_***。随后在代码中创建沙箱并调用 commands、runCode 或 desktop 相关接口。更多文档见 https://e2b.dev/docs ,示例集见 e2b-cookbook。自托管需按 runtime 仓库的 embed 部署指南操作,涉及 Terraform。本文未采集到 MCP 配置,仓库材料也未说明 MCP 接入方式。

使用条件与限制

是否需要部署
需自行准备运行环境,具体要求见正文
是否需要注册
账号和认证要求见正文;未明确说明的项目仍待核验
是否需要 API Key
待核验
费用与额度
费用边界见正文,项目许可不代表模型或托管服务免费
所需权限
待核验
许可证与服务条款
待核验

权限费用与限制

  • 使用托管云沙箱需要 E2B API key,属于账号与 API 权限依赖;API key 应妥善保管,不写入公开代码。
  • 仓库为开源代码,但托管沙箱服务、模型与云资源是否收费、免费额度与价格,资料未说明,需向官方核验。
  • 自托管涉及云厂商资源与 Terraform 部署,成本与运维责任由使用者承担。
  • 沙箱的隔离安全边界、运行时长与资源上限等,README 未给出细节,需对照官方文档核验。
  • 资料未说明支持哪些具体 LLM;cookbook 提到可与不同 LLM 和 AI 框架配合,但未列出模型清单。

国内使用情况

网友核验 用户经验分享

与站长实测独立,不代表官方认证或本站已实测。

我要核验
0 位参与者0 份有效分项记录

最近核验:暂无有效核验。参与人数按当前项目有效身份去重;不同核验项分别统计,不合并成用户总结果。仅统计审核通过且未过期的记录。

分项统计、有效期与样本量
核验项目有效人数成功 / 部分 / 失败 / 无法判断成功率最近核验 / 有效期
官方网站访问00 / 0 / 0 / 0样本不足暂无 / 7 天
GitHub 仓库访问00 / 0 / 0 / 0样本不足暂无 / 7 天
安装与运行00 / 0 / 0 / 0样本不足暂无 / 30 天
官方服务国内连接 / MCP 连接00 / 0 / 0 / 0样本不足暂无 / 30 天
国内网络情况00 / 0 / 0 / 0样本不足暂无 / 7 天
国内模型兼容性00 / 0 / 0 / 0样本不足暂无 / 30 天
自定义 API00 / 0 / 0 / 0样本不足暂无 / 30 天
海外服务依赖
00 / 0 / 0 / 0样本不足暂无 / 30 天
海外账号要求
00 / 0 / 0 / 0样本不足暂无 / 30 天
中文界面
00 / 0 / 0 / 0样本不足暂无 / 30 天
客户端兼容性00 / 0 / 0 / 0样本不足暂无 / 30 天
账号及费用信息
00 / 0 / 0 / 0样本不足暂无 / 30 天

成功率 = 成功 ÷(成功 + 部分成功 + 失败);无法判断不计入分母。至少 5 份可判断结果才显示成功率。账号、费用、海外依赖与语言等事实项,成功表示核查结论与资料吻合,具体观察另行统计;不表示免费或没有海外依赖。不同网络、客户端和版本的结果不能直接等同。

最近有效核验

暂无审核通过且未过期的网友核验。欢迎提交真实使用记录。

查看全部有效核验 →

国内实测状态:国内可用性待核验。协议兼容和官方资料说明不等于国内网络可用。

官方网站访问
尚未实测 待核验
GitHub 仓库访问
尚未实测 待核验
官方服务国内连接
尚未实测 待核验
国内网络情况
尚未实测 待核验
国内模型兼容性
尚未实测 待核验
自定义 API
尚未实测 待核验
海外服务依赖
尚未实测 待核验
海外账号要求
尚未实测 待核验
中文界面
尚未实测 待核验
国内最后核验时间
尚未实测

许可与国内使用

仓库 LICENSE 为 Apache License 2.0,版权声明为 FoundryLabs, Inc.。该许可适用于仓库代码;商业模块、托管服务、第三方模型与云服务的条款需分别核验,公开仓库不等于全部功能免费。README 未说明对中国大陆的网络可用性、备案或数据驻留安排,域名也不代表服务部署地域,国内使用与数据合规需另行核验。

项目资料与来源

官方网站 ↗

GitHub 仓库 ↗

官方文档 ↗

字段依据与待核验事项

access:来源确认 · npm i e2b

project_type:来源确认 · is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud.

原始 README(折叠技术参考)
<p align="center">
  <img src="/readme-assets/logo-black.png#gh-light-mode-only" alt="E2B Logo" width="200">
  <img src="/readme-assets/logo-white.png#gh-dark-mode-only" alt="E2B Logo" width="200">
</p>

<h4 align="center">
  <a href="https://pypi.org/project/e2b/">
    <img alt="Last 1 month downloads for the Python SDK" loading="lazy" decoding="async" style="color:transparent;width:170px;height:18px" src="https://static.pepy.tech/personalized-badge/e2b?period=monthly&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=PyPi%20Monthly%20Downloads">
  </a>
  <a href="https://www.npmjs.com/package/e2b">
    <img alt="Last 1 month downloads for the JavaScript SDK" loading="lazy" width="200" height="30" decoding="async" data-nimg="1"
    style="color:transparent;width:170px;height:18px" src="https://img.shields.io/npm/dm/e2b?label=NPM%20Monthly%20Downloads">
  </a>
</h4>

<!---
<img width="100%" src="/readme-assets/preview.png" alt="Cover image">
--->
## What is E2B?
[E2B](https://e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=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](https://www.npmjs.com/package/e2b) or [Python SDK](https://pypi.org/project/e2b).

## 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](https://e2b.dev/?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=E2B).
2. Get your API key [here](https://e2b.dev/dashboard?tab=keys&utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=E2B).
3. Set environment variable with your API key
```
E2B_API_KEY=e2b_***
```

### 3. Start a sandbox and run commands

JavaScript / TypeScript
```ts
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
```py
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()`](https://e2b.dev/docs/code-interpreting?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=E2B)/[`run_code()`](https://e2b.dev/docs/code-interpreting?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=E2B), install the Code Interpreter SDK ([JavaScript](./packages/code-interpreter-js) / [Python](./packages/code-interpreter-python)):

```
npm i @e2b/code-interpreter  # JavaScript/TypeScript
pip install e2b-code-interpreter  # Python
```

```ts
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](./packages/desktop-js) / [Python](./packages/desktop-python)):

```
npm i @e2b/desktop  # JavaScript/TypeScript
pip install e2b-desktop  # Python
```

```ts
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](https://e2b.dev/docs?utm_source=github&utm_medium=referral&utm_campaign=readme&utm_content=E2B).

### 7. E2B cookbook
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.

## Self-hosting

Read the [embed deployment guide](https://github.com/e2b-dev/runtime/blob/main/embed/README.md) to learn how to set up the [E2B runtime](https://github.com/e2b-dev/runtime) on your own. The infrastructure is deployed using Terraform. 

Supported cloud providers:
- 🟢 AWS
- 🟢 Google Cloud (GCP)
- 🟢 Azure
- 🟢 General Linux machine (via Embed) 
历史前置条件说明(补充参考)

Node.js 或 Python 环境以安装对应 SDK;需要注册 E2B 账号并获取 E2B_API_KEY 才能使用托管沙箱;自托管需自行准备 AWS/GCP/Azure 或 Linux 机器并使用 Terraform,具体版本与资源要求待核验;费用、免费额度、沙箱资源上限与支持模型清单待向官方核验。

项目来源与清单版权许可

https://github.com/e2b-dev/E2B

https://github.com/e2b-dev

整理来源:https://github.com/slavakurilyak/awesome-ai-agents

清单版权与许可:

MIT License

Copyright (c) 2024 Slava Kurilyak

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.