Migrate from E2B
SeaCloud Sandbox keeps familiar sandbox concepts while exposing SeaCloud-specific gateway auth, template references, runtime tokens, and public port URLs.
Package Replacement
Section titled “Package Replacement”| Runtime | E2B package | SeaCloud package |
|---|---|---|
| Node | @e2b/code-interpreter or e2b | @seacloudai/sandbox |
| Python | e2b-code-interpreter or e2b | seacloud-sandbox |
| Go | E2B client package | github.com/SeaCloudAI/sandbox-go |
Environment Variables
Section titled “Environment Variables”| Purpose | E2B | SeaCloud |
|---|---|---|
| API token | E2B_API_KEY | SEACLOUD_API_KEY |
| API host | Usually SDK default | SEACLOUD_BASE_URL=https://sandbox-gateway.cloud.seaart.ai |
| Runtime token | Hidden by SDK | envdAccessToken, hidden by SDK after create/connect |
API Mapping
Section titled “API Mapping”| E2B concept | SeaCloud equivalent | Notes |
|---|---|---|
Sandbox.create() / new Sandbox() | Sandbox.create(templateID, options) | SeaCloud requires an explicit template reference such as base, code-interpreter, or tpl-.... |
Sandbox.connect(id) | Sandbox.connect(id, options) | Reconnect refreshes runtime URL/token from the control plane. |
sandbox.kill() / sandbox.close() | sandbox.delete() | Delete disposable sandboxes. Use pause() when you intend to reconnect. |
sandbox.setTimeout(...) | sandbox.setTimeout(seconds) | Lifecycle timeout is seconds. |
| Commands | sandbox.commands.run(cmd, options) | Runtime command timeout is timeoutMs in milliseconds. |
| Filesystem | sandbox.files.read/write/list/makeDir | Paths should be absolute in production examples. |
| Host URL | sandbox.getHost(port) | Returns https://{port}-{sandboxID}.{domain}/. |
| Code interpreter | sandbox.runCode(...) / run_code(...) | Use the code-interpreter template. |
Code Comparison
Section titled “Code Comparison”// Before: E2B-style// const sandbox = await Sandbox.create();// const result = await sandbox.commands.run("echo hello");// await sandbox.kill();
// After: SeaCloudimport { Sandbox } from "@seacloudai/sandbox";
const sandbox = await Sandbox.create("base", { timeout: 1800, waitReady: true,});
try { const result = await sandbox.commands.run("sh", { args: ["-lc", "echo hello"], timeoutMs: 30_000, }); console.log(result.stdout);} finally { await sandbox.delete();}# Before: E2B-style# sandbox = Sandbox.create()# result = sandbox.commands.run("echo hello")# sandbox.kill()
# After: SeaCloudfrom sandbox import Sandbox
sandbox = Sandbox.create("base", timeout=1800, waitReady=True)
try: result = sandbox.commands.run( "sh", args=["-lc", "echo hello"], timeout_ms=30_000, ) print(result["stdout"])finally: sandbox.delete()Migration Checklist
Section titled “Migration Checklist”- Replace packages and environment variables.
- Choose an explicit template:
basefor commands/files,code-interpreterforrunCode, or a concretetpl-.... - Replace kill/close calls with
delete()for disposable work orpause()for resumable work. - Review timeout units: sandbox lifecycle
timeoutis seconds; commandtimeoutMsis milliseconds. - Replace hand-built app URLs with
getHost(port)when using SDKs. - Keep
envdAccessTokenout of logs and client-side code.