@e2b/sdk

中文文档
2.5.0发布于 2025/10/29MITTypeScriptESM + CJS近 30 天下载 4万

E2B SDK that give agents cloud environments

此软件包已被标记为弃用

The package @e2b/sdk has been renamed to e2b. Please uninstall the old one and install the new by running following command: npm uninstall @e2b/sdk && npm install e2b

原始使用文档
文档目录7 节
  1. What is E2B?
  2. Run your first Sandbox
  3. 1. Install SDK
  4. 2. Get your E2B API key
  5. 3. Execute code with code interpreter inside Sandbox
  6. 4. Check docs
  7. 5. E2B cookbook

e2b logo

Last 1 month downloads for the JavaScript SDK

What is E2B?

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 or Python SDK.

Run your first Sandbox

1. Install SDK

npm i @e2b/code-interpreter

2. Get your E2B API key

  1. Sign up to E2B here.
  2. Get your API key here.
  3. Set environment variable with your API key
E2B_API_KEY=e2b_***

3. Execute code with code interpreter inside Sandbox

import { Sandbox } from '@e2b/code-interpreter'

const sbx = await Sandbox.create()
await sbx.runCode('x = 1')

const execution = await sbx.runCode('x+=1; x')
console.log(execution.text)  // outputs 2

4. Check docs

Visit E2B documentation.

5. E2B cookbook

Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.

版本与发布记录

@e2b/sdk 共发布 165 个版本,首次发布于 2023/08/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.5.0latest2025/10/291 年前
2.4.32025/10/281 年前
2.4.22025/10/251.1 年前
2.4.12025/10/251.1 年前
2.4.02025/10/231.1 年前
2.3.62025/10/221.1 年前

其他发布通道:rc → 0.12.0-rc.5。

关于 @e2b/sdk 的常见问题

@e2b/sdk 是什么?

E2B SDK that give agents cloud environments注意:该包已被作者标记为弃用——The package @e2b/sdk has been renamed to e2b. Please uninstall the old one and install the new by running following command: npm uninstall @e2b/sdk && npm install e2b

如何安装 @e2b/sdk?

在项目目录运行 npm install @e2b/sdk,或使用 pnpm add / yarn add / bun add。

@e2b/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@e2b/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@e2b/sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@e2b/sdk 可以商用吗?

@e2b/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@e2b/sdk 的下载量有多少?

根据 npm 官方下载统计,@e2b/sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 39,857 次,日均约 1,329 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@e2b/sdk 还在维护吗?

最新版本 2.5.0 发布于 2025/10/29(1 年前);至今共发布 165 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/08/11。作者已将其标记为弃用,新项目建议寻找替代方案。