EphemeralBox is a lightweight, short-lived sandbox that provides only exec and file operations. It’s designed for quick, disposable compute tasks where a full Box (with agent, git, snapshots, etc.) is unnecessary.
Creation
Box.create(): Ephemeral boxes are ready immediately — no polling. The API returns with status: "idle" and the box is usable right away.
The request sends { ephemeral: true, ttl?, runtime? } to POST /v2/box.
Available API
Properties
id— box identifier (e.g."sweet-shark-26021")expiresAt— Unix timestamp (seconds) when the box auto-deletes
How it differs from Box
- Instant creation — no polling loop; the response is the ready box
- Auto-expiry — boxes are automatically deleted after TTL;
expiresAttracks this - Reduced surface — only exec + files; no agent, git, public URLs, snapshots, pause/resume
- Simpler config —
EphemeralBoxConfighas onlyapiKey,runtime,ttl,name,networkPolicy,baseUrl,timeout,debug(no agent, git, env, skills, mcpServers) - Composition over inheritance —
EphemeralBoxwraps an internalBoxand exposes only the relevant subset, so agent/git/etc. are not accessible even at runtime
Examples
Run a shell command
Execute inline code
File operations
Clean up early
Otherwise the box auto-deletes atexpiresAt.
Exported types
EphemeralBox— the classEphemeralBoxConfig— config forEphemeralBox.create()EphemeralBoxData— extendsBoxDatawithephemeral: booleanandexpires_at: number