How to run ComputeSDK sandboxes on Runtime
Install @computesdk/runtime, pass runtime() as ComputeSDK's provider, and the same compute.sandbox code runs in a Firecracker microVM.
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 its own package. The Runtime provider,
@computesdk/runtime, is published by ComputeSDK from its own repository and
built on Runtime's SDK, withruntime. Each sandbox is a microVM with its own
kernel, Ubuntu 24.04, Python, Node.js and sudo. The median sandbox answered
its first command 221 ms server-side after the create
request on 28 September 2026, and a 2 vCPU, 4 GiB sandbox costs $0.03125 an
hour while it waits. @computesdk/runtime 0.1.4 and computesdk 4.1.10 were
the current npm releases on 11 October 2026.
Switch the provider
Terminalnpm install computesdk @computesdk/runtimeJavaScriptimport { 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, then the key 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
them in order, and fallbackOnError moves to the next 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 at once |
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 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
pass name, metadata and envs through, some 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, because the provider object
that created it holds them; pass env to runCommand there.
Every account gets 100 free hours of a 1 GB machine every month, no card, and runs four sandboxes at once without credit; with credit it runs 100, at $0.08 an hour for a 2 vCPU, 4 GiB sandbox with both CPUs busy (pricing).
Related
- Runtime for ComputeSDK, the provider's full options
- Run untrusted LLM code
- Switch from E2B in one import
- Vercel AI SDK on Runtime
- What is a microVM?
Sources
- computesdk on npm, version 4.1.10, README read 11 October 2026
- @computesdk/runtime on npm, version 0.1.4 (10 October 2026), published from computesdk/computesdk
packages/runtime
On 11 October 2026 @computesdk/runtime 0.1.4 ran against Runtime's API:
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 11 October 2026.