Runloop
Deprecated: a sandbox per Runloop devbox, via @runloop/api-client. Runloop ended customer support on 2026-11-13.
Deprecated: removal in sbox-sdk 0.2.0
Runloop is winding down. Support for existing customers ended on
2026-11-13. sbox-sdk/runloop is deprecated in 0.1.0 and only gets crash
and leak fixes. It will be removed in 0.2.0. Calling runloop() logs a
one-time deprecation warning. Move your workloads to another
adapter. Your code shouldn't need changes beyond the import and
the factory call.
Installation
@runloop/api-client is an optional peer dependency of sbox-sdk, loaded lazily on first use.
pnpm add sbox-sdk @runloop/api-clientAuthentication
A single API key.
| Option | Env var | Required | Description |
|---|---|---|---|
apiKey | RUNLOOP_API_KEY | required | Runloop API key (sent as the SDK bearer token). |
baseURL | — | optional | Override the Runloop API base URL. |
blueprintId | — | optional | Default blueprint id when a spec omits `template`. |
runloop() reads RUNLOOP_API_KEY when you don't pass apiKey. Check the key with client.verify(). It lists one devbox and never creates anything.
Usage
import { createSandboxClient } from "sbox-sdk";
import { runloop } from "sbox-sdk/runloop";
const client = createSandboxClient({
provider: runloop({ apiKey: process.env.RUNLOOP_API_KEY! }),
});
const sandbox = await client.create({
template: "bpt_123",
metadata: { team: "a" },
});
const res = await sandbox.commands.run("python --version");
console.log(res.stdout);
const forks = await sandbox.fork({ count: 2 }); // snapshot the disk, boot 2 devboxes
await sandbox.pause(); // suspend: memory preservedWhat create() does with your spec:
templateis a blueprint id. A snapshot id (snp…) orfromSnapshotrestores that disk state into a new devbox instead.name,metadataandenvare passed through.- It waits with
createAndAwaitRunning, and throws if the devbox fails to boot.
Previews
A devbox has a single V2 tunnel that serves every port. ports.expose(port) reuses that tunnel, or enables one if there isn't one yet, and returns:
https://{port}-{tunnel_key}.tunnel.runloop.aiauth follows the tunnel's mode:
opengives{ type: "public" }.authenticatedgives header auth:X-Runloop-Tunnel-Authorization: Bearer <auth_token>. This doesn't work from a browser WebSocket.
removeTunnel takes no port, so unexpose() only removes the tunnel after the last exposed port is gone.
Capabilities
| Capability | Level | Notes |
|---|---|---|
list | native | walks every cursor page |
pause | native | suspend/resume (memory preserved) |
streaming | emulated | executeAndAwaitCompletion returns buffered output |
filesUpload | native | binary uploadFile, wrapped with toFile |
exposePort | native | V2 tunnel |
snapshot / fork | native | snapshotDisk. Fork snapshots, then boots N devboxes |
privatePreview | unsupported | the tunnel's auth mode is set when it's created |
stop | unsupported | pause (suspend) or destroy (shutdown) |
Flags:
perCommandEnvCwd: false: the core addscwd/envto the command itself.preservesMemoryOnPause: trueandpreviewModel: "tunnel".- No in-place snapshot
restore.
Known limitations
kill()andtimeoutMsstop the adapter from waiting and end the command with exit code 137 or aTimeouterror. The remote process isn't signalled, so it keeps running until it finishes on its own.- The disk snapshot that
fork()takes isn't deleted afterwards.