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-service.real-cloud.seaart.ai/api/v1/sandbox |
| 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(options) or Sandbox.create(templateID, options) | SeaCloud defaults to base when no template is provided. Pass code-interpreter or a concrete tpl-... when you need a specific environment. |
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 a proxy URL derived from envdUrl; the raw port route is https://sandbox-router.cloud.seaart.ai/{port}-{sandboxID}/. |
| 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: SeaCloud. Omitting the template uses base.import { Sandbox } from "@seacloudai/sandbox";
const sandbox = await Sandbox.create({ 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: SeaCloud. Omitting the template uses base.from sandbox import Sandbox
sandbox = Sandbox.create(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.
- Use the default
basetemplate for basic commands/files, or passcode-interpreterforrunCodeand concretetpl-...IDs for production. - 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.