Skip to content

Integrations

How to run ComputeSDK sandboxes on Runtime

Install @computesdk/runtime and pass runtime() as ComputeSDK's provider. The same compute.sandbox code then runs in a Firecracker microVM.

Updated · Facts checked · By Runtime Cloud

3 min read

Read as Markdown

On Runtime, a ComputeSDK sandbox is a whole Linux machine, billed on the CPU it uses. ComputeSDK is one TypeScript interface over many sandbox providers: E2B, Modal, Vercel, Daytona and others. Each provider is its own package. The Runtime provider, @computesdk/runtime, is published by ComputeSDK from its own repository. It is built on Runtime's SDK, withruntime. Each sandbox is a microVM with its own kernel. It runs Ubuntu 24.04, Python, Node.js and sudo. A 2 vCPU, 4 GiB sandbox costs $0.03125 an hour while it waits. @computesdk/runtime 0.1.11 and computesdk 4.1.13 were the current npm releases on 25 October 2026.

Switch the provider

Terminalnpm install computesdk @computesdk/runtime
JavaScriptimport { compute } from "computesdk";import { runtime } from "@computesdk/runtime";compute.setConfig({ provider: runtime({ apiKey: process.env.RUNTIME_API_KEY }) });const sandbox = await compute.sandbox.create({ metadata: { userId: "123" } });try {  const result = await sandbox.runCommand('python3 -c "print(\\"Hello World!\\")"');  console.log(result.stdout); // Hello World!} finally {  await sandbox.destroy();}

Nothing else in your code changes. Without apiKey, the provider reads RUNTIME_API_KEY. If that is not set, it reads the key that npx withruntime login saved on the machine.

Keep another provider as the fallback

ComputeSDK takes a list of providers and a strategy. With priority, it tries the providers in order. fallbackOnError moves to the next provider when a create fails:

JavaScriptimport { compute } from "computesdk";import { runtime } from "@computesdk/runtime";import { e2b } from "@computesdk/e2b";compute.setConfig({  providers: [runtime(), e2b({ apiKey: process.env.E2B_API_KEY })],  providerStrategy: "priority",  fallbackOnError: true,});

compute.sandbox.create({ provider: "e2b" }) still picks one provider for a single call.

What each call does on Runtime

ComputeSDK On Runtime
create({ envs, metadata, timeout }) envs on every command the provider runs, metadata as labels, timeout as the time limit
create({ templateId }) Starts from a Runtime image
create({ snapshotId }) Starts from a snapshot: files, memory and running processes
runCommand(cmd) bash -c, 60 seconds unless timeout says otherwise; past it, exit code 124
runCommand(cmd, { background }) Starts a Runtime process and returns immediately
onStdout, onStderr Output as the command writes it, through the API; no port in the sandbox
filesystem.* Runtime's file calls, not shell commands
getUrl({ port }) A private preview link carrying its token, one day by default
destroy() Stops the sandbox; getById then returns null

sandbox.getInstance() returns the withruntime sandbox. Use it for what ComputeSDK's interface leaves out: network rules, terminals, the desktop and pause.

Where the other providers differ

ComputeSDK's README warns that "not every provider honors every option". Some providers pass name, metadata and envs through. Others ignore them silently. The Runtime provider maps all three. A sandbox reached later through getById or list does not carry the envs given at create. The provider object that created it holds them. Pass env to runCommand in that case.

A new account gets 100 free hours of a 1 GB machine in its first 30 days. No card is needed. Without credit, an account runs four sandboxes at the same time. With credit, it runs 100. A 2 vCPU, 4 GiB sandbox with both CPUs busy costs $0.08 an hour (pricing).

Sources

On 11 October 2026, @computesdk/runtime 0.1.4 ran against Runtime's API. The checks covered create, a command, streamed output, a file written and read, a timeout's exit code 124, a background command, list, getById and destroy.

Facts on this page were checked on 25 October 2026.

Cut your cloud billby 75%.

No card to start. Billed by the second after.

Start free, no card