A command runs one program in your VM and returns its output and exit code when it ends. A background job keeps running after the request that started it ends, so work longer than the command timeout can finish.
The examples use a VM named runner. Set VM to its id and SI_API_KEY to a key from API keys:
export VM=6f1c0f0e8aexport SI_API_KEY=si_...Run a command
Section titled “Run a command”POST /{path} runs the program at the path in the VM. The request body is its standard input, and the reply is standard output and standard error together. si exec sends the same request.
Each request starts a new process as user in /home/user. A cd or export in one request does not carry into the next, so keep state in files. The command below writes a file that the job reads below.
si exec runner -- tee /home/user/notes.txt <<'EOF'alphabetagammadeltaEOFalphabetagammadeltacurl -sS -i -X POST "https://$VM.slashinfra.dev/usr/bin/tee?arg=/home/user/notes.txt" \ -H "Authorization: Bearer $SI_API_KEY" --data-binary $'alpha\nbeta\ngamma\ndelta\n'HTTP/2 200X-Exit-Code: 0...alphabetagammadeltaimport os, requests
res = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/tee", params={"arg": "/home/user/notes.txt"}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, data=b"alpha\nbeta\ngamma\ndelta\n",)res.raise_for_status()print(res.text, end="")print(res.headers["X-Exit-Code"])alphabetagammadelta0const res = await fetch(`https://${process.env.VM!}.slashinfra.dev/usr/bin/tee?arg=/home/user/notes.txt`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` }, body: 'alpha\nbeta\ngamma\ndelta\n',})if (!res.ok) throw new Error(await res.text())process.stdout.write(await res.text())console.log(res.headers.get('X-Exit-Code'))alphabetagammadelta0A failed program is still an HTTP success. The exit code is in X-Exit-Code, and si exec exits with the same code.
curl -sS -i -X POST "https://$VM.slashinfra.dev/bin/bash" \ -H "Authorization: Bearer $SI_API_KEY" \ --data-binary 'echo "no such report" >&2; exit 1'HTTP/2 200X-Exit-Code: 1...no such reportA file without the executable bit answers 403 svm: /path: Permission denied. Set the bit with si exec runner -- chmod +x /home/user/report.sh.
timeout is 1 to 30 seconds and 30 by default. At the timeout the API ends the process group and returns the output so far, with X-Timeout: 1 and exit code 124.
curl -sS -i -X POST "https://$VM.slashinfra.dev/bin/sleep?arg=60&timeout=5" \ -H "Authorization: Bearer $SI_API_KEY"HTTP/2 200X-Exit-Code: 124X-Timeout: 1...Stream the output
Section titled “Stream the output”Send Accept: text/event-stream to read output as it arrives. Each stdout or stderr event carries one JSON-encoded chunk, and bytes that are not UTF-8 arrive as {"encoding":"base64","data":"..."}. The last event is exit, with code and timed_out. A stream has no 1 MiB output cap and keeps the VM awake while it runs.
curl -sSN -X POST "https://$VM.slashinfra.dev/bin/bash" \ -H "Authorization: Bearer $SI_API_KEY" -H "Accept: text/event-stream" \ --data-binary 'echo first; sleep 1; echo second'event: stdoutdata: "first\n"
event: stdoutdata: "second\n"
event: exitdata: {"code":0,"timed_out":false}import os, requests
with requests.post( f"https://{os.environ['VM']}.slashinfra.dev/bin/bash", headers={ "Authorization": f"Bearer {os.environ['SI_API_KEY']}", "Accept": "text/event-stream", }, data=b"echo first; sleep 1; echo second", stream=True,) as res: res.raise_for_status() for line in res.iter_lines(decode_unicode=True): if line: print(line)event: stdoutdata: "first\n"event: stdoutdata: "second\n"event: exitdata: {"code":0,"timed_out":false}const res = await fetch(`https://${process.env.VM!}.slashinfra.dev/bin/bash`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}`, Accept: 'text/event-stream', }, body: 'echo first; sleep 1; echo second',})if (!res.ok || !res.body) throw new Error(`run failed: ${res.status}`)const reader = res.body.getReader()const decoder = new TextDecoder()for (;;) { const { done, value } = await reader.read() if (done) break process.stdout.write(decoder.decode(value, { stream: true }))}event: stdoutdata: "first\n"
event: stdoutdata: "second\n"
event: exitdata: {"code":0,"timed_out":false}Open an interactive terminal
Section titled “Open an interactive terminal”A terminal is a WebSocket to /bin/{program}. Binary frames carry terminal input and output in both directions, and a text frame {"cols":80,"rows":24} resizes the terminal. Use it for an interactive shell, a full-screen program or an agent. si shell needs an interactive terminal; a pipe or a script uses si exec.
Without Upgrade: websocket, GET /bin/{program} returns the terminal page or the program file, and opens no terminal. Closing the connection ends the program unless it is an hc terminal. A keystroke keeps an auto VM awake for 5 minutes; an open terminal alone does not.
- Open SVMs and select
runner. - Select Terminal. A terminal to the VM opens in a new tab.
- Run
hostname. The prompt shows the VM’s id. - Run
exitto close the terminal.
si shell runneruser@6f1c0f0e8a:~$ hostname6f1c0f0e8auser@6f1c0f0e8a:~$ exitlogout--program chooses bash (the default), zellij, tmux or herdr from the CLI. The API also accepts hc, claude, codex and opencode, and passes an agent’s options in up to 16 arg values.
Start a background job
Section titled “Start a background job”A job runs a program after the request that started it ends. POST /usr/bin/job runs the VM’s job program: the body is a script, and arg=-q prints the job number alone. si job start sends the script and prints the number.
The job writes its standard output and error to /var/log/jobs/<number>.log.
si job start runner -c 'while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt'1curl -sS -i -X POST "https://$VM.slashinfra.dev/usr/bin/job?arg=-q" \ -H "Authorization: Bearer $SI_API_KEY" \ --data-binary 'while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt'HTTP/2 200Location: /var/log/jobs/1.logX-Exit-Code: 0...
1import os, requests
res = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/job", params={"arg": "-q"}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, data=b'while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt',)res.raise_for_status()print(res.text, end="")1const res = await fetch(`https://${process.env.VM!}.slashinfra.dev/usr/bin/job?arg=-q`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` }, body: 'while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt',})if (!res.ok) throw new Error(await res.text())process.stdout.write(await res.text())1The job prints checking alpha at once, then one line every 5 seconds. Its log is at /var/log/jobs/1.log.
List jobs
Section titled “List jobs”List returns every job of the VM, newest first, with its state, exit code, leader PID, CPU seconds, peak memory, start time and command. STATE is running, exited, killed or oom.
si job ls runnerJOB STATE CODE PID CPU_S MEM_MIB STARTED COMMAND1 running - 46 0.00 0.9 2026-11-29T13:42:21Z while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txtcurl -sS -X POST "https://$VM.slashinfra.dev/usr/bin/job?arg=ls" \ -H "Authorization: Bearer $SI_API_KEY"JOB STATE CODE PID CPU_S MEM_MIB STARTED COMMAND1 running - 44 0.00 0.9 2026-11-29T13:38:09Z while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txtimport os, requests
res = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/job", params={"arg": "ls"}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.text, end="")JOB STATE CODE PID CPU_S MEM_MIB STARTED COMMAND1 running - 48 0.00 0.7 2026-11-29T13:38:59Z while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txtconst res = await fetch(`https://${process.env.VM!}.slashinfra.dev/usr/bin/job?arg=ls`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())process.stdout.write(await res.text())JOB STATE CODE PID CPU_S MEM_MIB STARTED COMMAND1 running - 48 0.00 0.7 2026-11-29T13:39:40Z while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txtRead the log
Section titled “Read the log”The log is at /var/log/jobs/<number>.log in the VM. It holds standard output and standard error, and it grows while the job runs. Add --follow to keep printing new lines until the job ends.
si job logs runner --follow 1checking alphachecking betachecking gammachecking deltacurl -sS "https://$VM.slashinfra.dev/var/log/jobs/1.log" \ -H "Authorization: Bearer $SI_API_KEY"checking alphachecking betaimport os, requests
res = requests.get( f"https://{os.environ['VM']}.slashinfra.dev/var/log/jobs/1.log", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.text, end="")checking alphachecking betaconst res = await fetch(`https://${process.env.VM!}.slashinfra.dev/var/log/jobs/1.log`, { headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())process.stdout.write(await res.text())checking alphachecking betaA job still running at a sleep on disk shows killed with code 137 after the wake, because its process ended and it has no exit record. Its log and job number stay. A sleep in memory keeps the process running.
Wait for the end
Section titled “Wait for the end”Wait blocks until the job ends and returns its exit code and run time. A signal reports killed with 128 + the signal. A job still running when its VM ended reports killed with 137. A job that has ended returns at once.
si job wait runner 1job 1 exited: code 0, 20.0scurl -sS -i -X POST "https://$VM.slashinfra.dev/usr/bin/job?arg=wait&arg=1&timeout=30" \ -H "Authorization: Bearer $SI_API_KEY"HTTP/2 200X-Exit-Code: 0...job 1 exited: code 0, 20.0simport os, requests
res = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/job", params={"arg": ["wait", "1"], "timeout": 30}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.text, end="")print(res.headers["X-Exit-Code"])job 1 exited: code 0, 20.0s0const url = new URL(`https://${process.env.VM!}.slashinfra.dev/usr/bin/job`)url.searchParams.append('arg', 'wait')url.searchParams.append('arg', '1')url.searchParams.set('timeout', '30')
const res = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())process.stdout.write(await res.text())console.log(res.headers.get('X-Exit-Code'))job 1 exited: code 0, 20.0s0The request timeout is 1 to 30 seconds. When it ends the wait before the job, the reply has X-Timeout: 1 and exit code 124, and the job keeps running; send the wait again. The CLI retries, so si job wait gives up only at its own --timeout.
Stop a job
Section titled “Stop a job”Kill ends every process of the job, including one that left the session with setsid. A job that has ended keeps its code and answers job N already exited: code N.
si job start runner -- sleep 3600si job kill runner 22job 2 killedcurl -sS -X POST "https://$VM.slashinfra.dev/usr/bin/job?arg=-q" \ -H "Authorization: Bearer $SI_API_KEY" --data-binary 'sleep 3600'curl -sS -X POST "https://$VM.slashinfra.dev/usr/bin/job?arg=kill&arg=2" \ -H "Authorization: Bearer $SI_API_KEY"2job 2 killedimport os, requests
start = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/job", params={"arg": "-q"}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, data=b"sleep 3600",)start.raise_for_status()number = start.text.strip()res = requests.post( f"https://{os.environ['VM']}.slashinfra.dev/usr/bin/job", params={"arg": ["kill", number]}, headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(number)print(res.text, end="")2job 2 killedconst start = await fetch(`https://${process.env.VM!}.slashinfra.dev/usr/bin/job?arg=-q`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` }, body: 'sleep 3600',})if (!start.ok) throw new Error(await start.text())const number = (await start.text()).trim()
const res = await fetch(`https://${process.env.VM!}.slashinfra.dev/usr/bin/job?arg=kill&arg=${number}`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())console.log(number)process.stdout.write(await res.text())2job 2 killedWhen to use which
Section titled “When to use which”| Use | Choose | What it gives you |
|---|---|---|
| A program that ends within the timeout | A command | The output and exit code in the reply, in 1 to 30 seconds. |
| A person at a keyboard | A terminal | An interactive session; closing it ends the program unless it is an hc terminal. |
| Work longer than 30 seconds | A job | A process that outlives the request, a log on disk, and wait and kill. |
| A program that must stay available | A service | A restart after a crash, and a start again after a sleep on disk. |
Scroll horizontally to see all columns.
Options
Section titled “Options”| Field | Type | Default | Allowed values | What it changes |
|---|---|---|---|---|
path (path; si exec -- <PROGRAM>) |
string | Required | An executable file in the VM; a directory answers 405 | The program. A program name goes through /usr/bin/env and PATH. |
--command (-c) |
flag | None | A shell script | Runs the script instead of a program. si exec sends it to /bin/bash -c; si job start sends it as the job’s script. |
arg (query; after --) |
array | None | Repeated arg, at most 512 KiB together; a NUL byte answers 400 |
One argument of the program, in order. |
cwd (--cwd) |
string | /home/user |
An absolute path that exists and that user can enter, at most 4096 bytes |
The working directory. |
timeout (--timeout) |
integer | 30 |
1 to 30 seconds | Ends the process group at the timeout, returns the output so far, and sets X-Timeout: 1 with exit code 124. |
env (--env) |
string | None | KEY=value, repeated; the value is split at its first = |
A variable of this command or job only. The CLI sends it as an env query. |
Accept (header) |
string | text/plain |
application/json, text/event-stream |
JSON splits stdout and stderr and reports truncated and timed_out; a stream sends stdout, stderr and exit events. |
program (path; si shell --program) |
string | bash |
bash, zellij, tmux, herdr in the CLI; the API also accepts hc, claude, codex, opencode |
The program of the terminal. |
arg (query; si shell) |
array | None | Only for claude, codex or opencode; at most 16 values; a NUL byte answers 400 |
The agent’s own options and prompt. |
Upgrade (header) |
string | None | websocket |
Opens the terminal. Without it, the request returns the terminal page or the program file. |
--follow (-f) |
flag | Off | None | Keeps printing new log lines until the job ends. |
--timeout (si job wait --timeout) |
integer | None | A positive number of seconds | Gives up after that time with exit code 124; the job keeps running. |
project (--project) |
string | default |
A project name or id | The project of the VM. SI_PROJECT applies when the flag is absent. |
Scroll horizontally to see all columns.
States
Section titled “States”| State | What it means for you | What you can do |
|---|---|---|
running |
A process of the job lives. | Read the log, wait, kill. |
exited |
The program ended; CODE is its exit code. |
Read the log, wait. |
killed |
A signal ended it; CODE is 128 + the signal, and 137 for si job kill or a sleep on disk. |
Read the log. |
oom |
The kernel killed a process for lack of memory; CODE is 137. |
Read the log; free memory and start again. |
Scroll horizontally to see all columns.
Errors
Section titled “Errors”| Code | When | Fix |
|---|---|---|
bad_request |
A path has a NUL byte, cwd is relative or over 4096 bytes, timeout is outside 1 to 30, an argument has a NUL byte, or an agent has more than 16 arguments. |
Send a valid path, working directory, timeout and arguments. |
not_found |
The program, working directory or job log does not exist. | Check the path with si exec runner -- ls -la. |
method_not_allowed |
The path of a command is a directory. | Use an executable file. |
timeout |
The request body stalled for more than 30 seconds. | Retry with a stable connection. |
payload_too_large |
Input is over 1 MiB, arguments are over 512 KiB, or an agent terminal’s arguments are over 512 KiB. | Send less; write input to a file and read it inside the VM. |
too_many_terminals |
The VM has its 8 terminals open. | Close one terminal. |
svm_crashed |
The command crashed the VM; its disk returned to the last snapshot. | Check your files, then run the command again. |
svm_unreachable |
The node did not answer. | Wait for Retry-After and retry. |
file_read_failed |
The VM could not read the job log. | Retry the read. |
Scroll horizontally to see all columns.
Errors that any request can return are in the error catalog.
Permissions
Section titled “Permissions”Every operation on this page goes to the VM’s own host. A key reaches it when it belongs to the VM’s organization and includes the VM’s project; the VM host checks that scope and does not check a key action. A grant reaches only the methods, paths and arguments it names; see Grants.
| Operation | Who can | Key action |
|---|---|---|
| Run a command | Any member with a key that includes the VM’s project | None |
| Open a terminal | Any member with a key that includes the VM’s project | None |
| Start a job | Any member with a key that includes the VM’s project | None |
| List jobs | Any member with a key that includes the VM’s project | None |
| Read the log | Any member with a key that includes the VM’s project | None |
| Wait for a job | Any member with a key that includes the VM’s project | None |
| Stop a job | Any member with a key that includes the VM’s project | None |
Scroll horizontally to see all columns.
Limits
Section titled “Limits”- A command timeout is 1 to 30 seconds and 30 by default. At the timeout the process group ends with exit code 124.
- Standard input is 1 MiB. Combined standard output and error is 1 MiB in one reply; the API cuts the rest and sets
X-Truncated: 1. A stream has no 1 MiB output cap. - Arguments are at most 512 KiB together.
- A VM serves 64 requests at once by default (
concurrency), and its node accepts 16 by default. A request above the lower limit waits in the queue. See VMs. - A VM has 8 terminal connections. The ninth answers 429
too_many_terminals. - The newest 64 jobs are kept. A start removes the oldest ended jobs. A job number never repeats on a VM and survives a sleep.
The full list is in Limits.
- Background work: start a job, disconnect, and read its log and exit code.
- Services: keep a program running after a crash and a wake.
- Sleep and wake: what a job keeps across a sleep.