© 2026FindAgent  · @simprr
返回列表
e

e2b-dev/E2B

Open-source, secure environment with real-world tools for enterprise-grade agents.

agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
⭐

11.5k

Stars

🔱

816

Forks

👁

68

Watchers

📋

63

Issues

PythonApache-2.0创建于 2023/3/4更新于 今天
在 GitHub 上查看访问主页
README
由 Gemini 翻译整理

E2B SDK Preview E2B SDK Preview

什么是 E2B?

E2B 是一个开源基础设施,允许您在云端的安全隔离沙箱中运行 AI 生成的代码。要启动并控制这些沙箱,请使用我们的 JavaScript SDK 或 Python SDK。

运行您的第一个沙箱

1. 安装 SDK

JavaScript / TypeScript

npm i e2b

Python

pip install e2b

2. 获取您的 E2B API key

  1. 在 这里 注册 E2B。
  2. 在 这里 获取您的 API key。
  3. 设置包含 API key 的环境变量:
E2B_API_KEY=e2b_***

3. 启动沙箱并运行命令

JavaScript / TypeScript

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

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 Interpreter)执行代码

如果您需要使用 runCode()/run_code() 执行代码,请安装 Code Interpreter SDK:

npm i @e2b/code-interpreter  # JavaScript/TypeScript
pip install e2b-code-interpreter  # Python
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. 查看文档

访问 E2B 文档。

6. E2B 使用指南 (Cookbook)

访问我们的 Cookbook,获取有关结合不同 LLM 和 AI 框架的示例灵感。

自托管 (Self-hosting)

阅读 自托管指南,了解如何在您自己的环境中设置 E2B 基础设施。该基础设施使用 Terraform 进行部署。

支持的云服务提供商:

  • 🟢 AWS
  • 🟢 Google Cloud (GCP)
  • Azure
  • 通用 Linux 机器
贡献者
Vmjg0mbdSE
项目信息
默认分支main
LicenseApache License 2.0
创建时间2023/3/4
最近更新今天
GAI 中文摘要

E2B 是一个开源的云端基础设施项目,旨在为人工智能体提供安全且隔离的运行环境。它通过云端沙箱技术,允许 AI 模型在受控的远程环境中执行生成的代码,从而解决 AI 应用在执行复杂逻辑时的安全与隔离挑战。

提供云端沙箱环境,支持在隔离的容器中运行 AI 生成的代码。 配套 Python 和 JavaScript SDK,方便开发者快速集成并控制远程沙箱。 内置代码解释器功能,能够直接执行代码并处理执行过程中的输入与输出。 支持自托管部署方案,允许企业通过 Terraform 将基础设施部署在 AWS 或 GCP 等云平台上。 具备完善的开发者文档与 cookbook 示例库,辅助开发者更高效地构建 AI Agent。

适用于开发企业级 AI Agent 的工程师与架构师,特别是在需要 AI 自动化执行代码任务、进行数据处理或复杂逻辑推理的应用场景中使用。