安装
安装 e2b SDK
配置环境变量
您需要在运行代码前设置如下环境变量,来指定使用 PPIO 沙箱服务。E2B_API_KEY 时需要关闭 API Key 格式校验,直接使用 PPIO 的 API Key。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
查阅 PPIO Agent 沙箱与 E2B SDK 的兼容使用说明,了解接入配置与适用边界,为现有 E2B 应用连接沙箱服务提供参考。
# JavaScript & TypeScript
npm i e2b
# Python
pip install e2b
export E2B_DOMAIN=sandbox.ppio.cn
E2B_API_KEY 时需要关闭 API Key 格式校验,直接使用 PPIO 的 API Key。
export E2B_VALIDATE_API_KEY=false
export E2B_API_KEY="<Your PPIO API Key>"
from e2b import Sandbox
sbx = Sandbox.create()
execution = sbx.commands.run('ls -l')
print(execution)
sbx.kill()
import { Sandbox } from 'e2b'
const sbx = await Sandbox.create()
const execution = await sbx.commands.run('ls -l')
console.log(execution)
await sbx.kill()