Skip to content

Commands and jobs

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:

Terminal window
export VM=6f1c0f0e8a
export SI_API_KEY=si_...

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.

Terminal window
si exec runner -- tee /home/user/notes.txt <<'EOF'
alpha
beta
gamma
delta
EOF
Output
alpha
beta
gamma
delta

A failed program is still an HTTP success. The exit code is in X-Exit-Code, and si exec exits with the same code.

Terminal window
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'
Output
HTTP/2 200
X-Exit-Code: 1
...
no such report

A 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.

Terminal window
curl -sS -i -X POST "https://$VM.slashinfra.dev/bin/sleep?arg=60&timeout=5" \
-H "Authorization: Bearer $SI_API_KEY"
Output
HTTP/2 200
X-Exit-Code: 124
X-Timeout: 1
...

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.

Terminal window
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'
Output
event: stdout
data: "first\n"
event: stdout
data: "second\n"
event: exit
data: {"code":0,"timed_out":false}

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.

  1. Open SVMs and select runner.
  2. Select Terminal. A terminal to the VM opens in a new tab.
  3. Run hostname. The prompt shows the VM’s id.
  4. Run exit to close the terminal.

--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.

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.

Terminal window
si job start runner -c 'while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt'
Output
1

The job prints checking alpha at once, then one line every 5 seconds. Its log is at /var/log/jobs/1.log.

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.

Terminal window
si job ls runner
Output
JOB STATE CODE PID CPU_S MEM_MIB STARTED COMMAND
1 running - 46 0.00 0.9 2026-11-29T13:42:21Z while read line; do echo "checking $line"; sleep 5; done < /home/user/notes.txt

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.

Terminal window
si job logs runner --follow 1
Output
checking alpha
checking beta
checking gamma
checking delta

A 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 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.

Terminal window
si job wait runner 1
Output
job 1 exited: code 0, 20.0s

The 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.

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.

Terminal window
si job start runner -- sleep 3600
si job kill runner 2
Output
2
job 2 killed
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.

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.

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.

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.

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.

  • 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.