Runtime Cloud SDK and CLI
One client for every Runtime Cloud product, and the runtime CLI. No
dependencies; Node.js 22 or later, or Bun.
npm install @withruntime/cloud
Set RUNTIME_API_KEY from your secret manager (create a key at
https://withruntime.com/account/keys). Never put a key in browser code, a URL or
a command-line argument.
import { Sandbox } from "@withruntime/cloud";
await using sbx = await Sandbox.create();
const result = await sbx.exec("python3 -c 'print(6 * 7)'");
console.log(result.exitCode, result.stdout);
Sandbox.create() needs no arguments and returns once the sandbox is running;
await using stops it when the block ends. With no arguments you get the free
trial while it lasts (20 hours, up to three sandboxes at once), 2 vCPU, 4 GiB of
memory and a 4 GiB disk.
The sandbox object does the rest:
exec, execStream, spawn and processes for commands and background
work, with cwd, env (the place for secrets), stdin and timeoutMs;
terminal() for an interactive terminal over a WebSocket;
files to read, write, list, glob, stat, move and remove, and to copy whole
directories with upload and download;
pause, wake, extend, fork and snapshot;
interpreter, network, previews and desktop for the other products.
The client has sandboxes, images, volumes, snapshots, feedback and
support. Every write carries an idempotency key, made for you, so the SDK's
own retries (timeouts, 429, 503) never do anything twice. Errors are typed and
carry a code, a hint and a requestId.
CLI
npx @withruntime/cloud login
npx @withruntime/cloud sandbox create
npx @withruntime/cloud help
Installed globally, the command is runtime (also runtime-cloud):
runtime sandbox exec <id> -- ls, runtime sandbox shell <id>,
runtime image build --pip pandas, and --json on every command.
MCP
runtime mcp serves Runtime's MCP tools on stdio for agents that want a local
command, over the saved connection. Remote agents use
https://api.withruntime.com/mcp with a bearer key.
Docs: https://withruntime.com/docs/javascript and https://withruntime.com/docs/cli.