Sandboxes
One API call starts an isolated machine in seconds; it bills by the second in fractions of a cent and tears itself down at a deadline you set. For GPU work, see the quickstart.
What a sandbox is
An instance is a GPU machine you keep until you delete it. A sandbox is the opposite shape: a small CPU machine that boots in seconds, costs a fraction of a cent, and stops itself at a deadline you set. It's what you want when you need a hundred throwaway machines for forty seconds each — agent rollouts, grading an eval, running a tool call, executing code you don't trust.
matmul sandbox create --vcpus 2 --memory 4Gi --ttl 10m --name rollout-1
The deadline is the budget
Every sandbox has a TTL, and it is not advisory: a reaper enforces it server-side, so a sandbox you forget about — or that your code crashes before destroying — still goes away and still stops costing money. That makes the worst case knowable before you start. The free dry run prints it:
matmul sandbox create --vcpus 2 --memory 4Gi --ttl 10m --dry-run # 2 vCPU / 4 GiB $0.2153/hr · at most $0.0359 for the full 10m · nothing started
That estimate runs the same code path as the real create, so the quote can't disagree with the charge. The console shows the same number on the button that starts the sandbox.
Why prices look like $0.0359
A 2 vCPU sandbox that lives 30 seconds costs about 0.14 of one cent. Our ledger is in whole cents and rounds a billed item up, which would turn that into 1¢ — a 7× overcharge, and $100 billed against $14 of real usage across ten thousand rollouts. So sandbox usage accrues in micro-cents (1 cent = 1,000,000 micro-cents) per sandbox, and the remainder below a whole cent is carried for your organisation until it crosses one.
The practical consequence: you are charged for what you actually used, rounding happens once per settlement instead of once per sandbox, and a page showing "$0.0024" is not a rounding artefact — it's the real number.
Running something in it
exec runs one command and returns its exit code, stdout and stderr. The CLI exits with the command's own exit code, like ssh, so && and set -e work:
matmul sandbox exec sbx_0123456789ab -- python -c 'print(1+1)' matmul sandbox exec sbx_0123456789ab --cwd /app --timeout 60s -- pytest -q
Getting your code in
There is no file copy yet — exec is the whole data path, so the sandbox fetches what it needs the way a CI job would: clone it, download it, or pipe a small file in on the command itself. A command is capped at 64 KiB, so the last option is for a script, not a dataset.
matmul sandbox exec sbx_0123456789ab -- sh -lc 'git clone --depth 1 https://github.com/me/evals /app && cd /app && pip install -q -r requirements.txt'
From Python
The SDK's context manager destroys the sandbox on the way out, including when the body raises — so a crashed rollout doesn't bill until its TTL:
from matmul import Client
with Client().sandbox(vcpus=2, memory_mib=4096, ttl_seconds=600) as sb:
r = sb.exec("python score.py")
r.check() # raises if the exit code isn't 0
print(r.stdout, sb.spend)Limits and guardrails
| Guardrail | What it does |
|---|---|
| TTL | Enforced server-side by a reaper. The longest TTL we accept is set per server; a sandbox is ephemeral by definition. |
| Concurrency | A cap on live sandboxes per organisation. Your org's own limit can only lower the global ceiling, never raise it. |
| Balance | Creating a sandbox is refused when your prepaid balance is empty or the account is frozen, like any other launch. |
| Rate limits | Create and exec are rate limited per organisation. These only ever refuse to start work — a 429 never stops a running sandbox. |
| Settle on destroy | Usage is charged when the sandbox ends, not only on the meter tick, because a 40-second sandbox never survives one. |
None of these destroy work you've already paid for. Guards that refuse to start are cheap to get wrong; guards that kill a running job are not, which is why the deadline you set is the only thing that stops a sandbox.
Commands
| Command | What it does |
|---|---|
| matmul sandbox create | Start one. --dry-run prices it without starting anything. |
| matmul sandbox ls | List your organisation's sandboxes. --json for scripts. |
| matmul sandbox get <id> | One sandbox: status, size, price, spend so far. |
| matmul sandbox exec <id> -- <cmd> | Run a command; exits with the command's exit code. |
| matmul sandbox rm <id> | Destroy it and stop the meter. |
Every command takes --json and prints exactly one JSON document on stdout. See the CLI reference and the MCP server, which exposes the same lifecycle to Claude Code and Cursor.