Documentation Index
Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
PPIO Agent 沙箱服务提供了 E2B 兼容的 API,如果您已经在使用 E2B 沙箱并希望切换到 PPIO Agent 沙箱,您可以使用特定版本的 E2B SDK 和 CLI 来操控 PPIO Agent 沙箱。当然,我们建议使用 PPIO Agent Sandbox SDK 来访问所有功能。
Code Interpreter SDK
npm i @e2b/code-interpreter@beta
Core SDK
Desktop SDK
CLI
配置环境变量
您需要在运行代码前设置如下环境变量,来指定使用 PPIO Agent 沙箱服务。
export E2B_DOMAIN=sandbox.ppio.cn
export E2B_API_KEY="<Your PPIO API Key>"
下面示例展示了如何通过 E2B SDK 来操控 PPIO Agent 沙箱。
import { Sandbox } from '@e2b/code-interpreter'
// or import { Sandbox } from 'e2b'
// or import { Sandbox } from '@e2b/desktop'
const sbx = await Sandbox.create()
const execution = await sbx.commands.run('ls -l')
console.log(execution)
await sbx.kill()
下面示例展示了如何使用 E2B CLI 来操控 PPIO Agent 沙箱。
export E2B_DOMAIN=sandbox.ppio.cn
# Authentication in CLI
e2b auth login
# Start sandbox and connect to terminal
e2b sandbox spawn <template-id>
# List sandboxes
e2b sandbox list
# Shutdown running sandboxes
e2b sandbox kill <sandbox-id>