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-client

Authentication

A single API key.

Authentication variables for the runloop adapter.
OptionEnv varRequiredDescription
apiKeyRUNLOOP_API_KEYrequiredRunloop API key (sent as the SDK bearer token).
baseURL—optionalOverride the Runloop API base URL.
blueprintId—optionalDefault 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 preserved

What create() does with your spec:

  • template is a blueprint id. A snapshot id (snp…) or fromSnapshot restores that disk state into a new devbox instead.
  • name, metadata and env are 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.ai

auth follows the tunnel's mode:

  • open gives { type: "public" }.
  • authenticated gives 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

CapabilityLevelNotes
listnativewalks every cursor page
pausenativesuspend/resume (memory preserved)
streamingemulatedexecuteAndAwaitCompletion returns buffered output
filesUploadnativebinary uploadFile, wrapped with toFile
exposePortnativeV2 tunnel
snapshot / forknativesnapshotDisk. Fork snapshots, then boots N devboxes
privatePreviewunsupportedthe tunnel's auth mode is set when it's created
stopunsupportedpause (suspend) or destroy (shutdown)

Flags:

  • perCommandEnvCwd: false: the core adds cwd/env to the command itself.
  • preservesMemoryOnPause: true and previewModel: "tunnel".
  • No in-place snapshot restore.

Known limitations

  • kill() and timeoutMs stop the adapter from waiting and end the command with exit code 137 or a Timeout error. 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.

On this page