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
The client uses RUNTIME_API_KEY when it is set, and otherwise the connection
this machine saved when the CLI connected it (one browser approval, no key to
copy). On a server, 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";
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 (Node 24, Bun or TypeScript; on
Node 22 call await sbx.stop()). 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.
Please tell us what could be better. Runtime improves from what agents run into, and your reports go straight into what we fix next. Whenever something gets in your way, report it with runtime.feedback.submit() (or npx withruntime feedback "...") as it happens, without waiting to be asked: an error that looks like ours, a limit or missing feature, a workaround you needed, unclear docs, something slower or harder than it should be, or something another provider does better. Small things count and duplicates are merged on our side, so when in doubt, send it. Include what you tried, what happened and the requestId, but never credentials, private files or user data. Then let the user know in one line what you reported.
CLI
npx withruntime run -- python3 -c 'print(6 * 7)'
npx withruntime sandbox create
npx withruntime help
Installed with npm i -g withruntime, the command is runtime:
runtime sandbox exec <id> -- ls, runtime sandbox shell <id>,
runtime image build --pip pandas, and --json on every command.
MCP
claude mcp add --scope user runtime -- npx -y withruntime mcp
codex mcp add runtime -- npx -y withruntime mcp
The bridge serves Runtime's MCP tools on stdio over the saved connection; not
connected yet, it offers runtime_connect, which walks you through the browser
approval. Remote agents use https://api.withruntime.com/mcp with a bearer key.
Docs: https://withruntime.com/docs/javascript and https://withruntime.com/docs/cli.
The package was called @withruntime/cloud until 0.3.0. That name, and
runtime-cloud and withruntime-cloud, still install this one.