CLI
kumoba runs sandboxes from your shell, for people and for agents. It builds its commands from the daemon it talks to (GET /v1/commands), so its help always matches that daemon, and most new daemon commands work without a CLI upgrade. Interactive commands such as shell need a CLI that knows the terminal output kind, from 0.3 on.
Two builds behave the same:
| Build | Install |
|---|---|
| Native, no runtime needed | scripts/install.sh puts it in ~/.kumoba/bin; also cargo install kumobad |
| Node.js 22 or later | npm install -g kumoba, or npx kumoba <command> |
Connecting
With no settings it uses the zero-config daemon in ~/.kumoba: the socket kumobad.sock and the token token. Override with:
| Variable | Default |
|---|---|
KUMOBA_URL | unix://$KUMOBA_HOME/kumobad.sock; http://127.0.0.1:7788 also works (loopback only), and https://host:port reaches a daemon on another machine |
KUMOBA_TOKEN or KUMOBA_TOKEN_FILE | $KUMOBA_HOME/token |
KUMOBA_CA_FILE | the public CAs; a PEM file to trust a private CA instead |
KUMOBA_CERT_FILE and KUMOBA_KEY_FILE | none; a PEM client certificate and key for a daemon that requires mutual TLS. Like KUMOBA_CA_FILE, only with an https:// URL |
KUMOBA_HOME | ~/.kumoba |
See Run sandboxes on another machine for a daemon on another host.
Finding commands
kumoba # every command, with a one-line summary
kumoba exec --help # one command: usage, arguments, types, defaults
kumoba help exec # the same
kumoba commands --json # every command with its full JSON Schema, for agents
kumoba skill # the agent skill for this CLI version, offline
kumoba mcp # serve the commands to an MCP client as tools, over stdio
kumoba version # this CLI and the daemonThe commands the daemon serves:
| Command | What it does |
|---|---|
run | Run one command in a fresh sandbox, stream its output, delete the sandbox |
create, start, stop, delete | Sandbox lifecycle; create leaves it stopped unless you pass --start |
list, get, update | Find sandboxes by label, show one, change labels, timers or network |
exec | Run a command in a started sandbox and stream its output |
shell | Open an interactive shell in a started sandbox (Open a shell) |
read-file, write-file, list-files | Guest files |
expose | A signed, expiring link to a port inside the sandbox |
desktop | Start the desktop and link to a live view in the browser |
screenshot, ui-tree | See the desktop: a PNG of the screen, or its named buttons, fields and windows with the point to click each one |
click, hover, drag, scroll, type, key | Drive the desktop's mouse and keyboard (Let an agent drive the desktop) |
set-secrets, delete-secrets | Secrets that never enter the guest |
images, access-log | Bootable images, and every proxied network connection |
capacity | Running slots in use and the KUMOBAD_MAX_RUNNING limit, the memory those sandboxes take, and free disk |
prune-stopped | Delete old stopped sandboxes to free disk: --older-than-ms <ms>, --dry-run to only list them; through a fleet, --host <hostId> for one host |
events | Sandboxes being created, started, stopped and deleted, and network changes, with exact times |
info | This host's id, versions, image digests, platform, limits and labels |
drain, undrain | Stop creating sandboxes on this host, --strict to also refuse starts, and resume |
commands | Every command the daemon serves, with its JSON Schema |
Arguments
Every command reads its arguments the same way, checked against its schema:
kumoba exec <id> --timeout-ms 5000 -- python3 -c 'print(1)' # positional, flag, trailing list
kumoba exec <id> timeoutMs=5000 -- python3 -c 'print(1)' # key=value works too
kumoba create --image default --memory-mib 2048 --network.mode allowlist --network.hosts pypi.org,files.pythonhosted.org
kumoba create --args '{"image":"default","labels":{"team":"qa"}}'- Positional values fill the command's positional arguments in order: the sandbox id, then any others the command takes, such as the
xandyofclick.kumoba <command> --helpshows them in its usage line. - A default sandbox. With
KUMOBA_SANDBOXset to a sandbox id, the commands that work inside one sandbox take it when you leave the id out:exec,shell,read-file,write-file,list-files,get,desktop,screenshot,ui-tree,click,hover,drag,scroll,typeandkey. Sokumoba click 300 200andkumoba exec -- lsact on that sandbox. The id comes from the variable only when the command line parses with the id left out, sokumoba click <id> 300 200still works, and an explicit id always wins: a value given twice, as inkumoba type <id> hello --text bye, is refused (text given twice) instead of read another way. When the id came from the variable and no such sandbox exists, the hint says so. Commands that create, start, stop, change, export or delete a sandbox always need the id. A command that misses its id says to pass it or setKUMOBA_SANDBOX, andkumoba <command> --helpsays whether the command takes it. --kebab-case value,--kebab-case=valueandcamelCase=valueset any argument. A boolean flag needs no value.- Everything after
--is the command's trailing list: the program and arguments forrunandexec. A program without a/is looked up on the guest'sPATH. - Types come from the schema: integers and booleans are checked, enums list their choices,
nullclears a nullable value, and a list withminItemscannot be left empty, whether it is given as a flag, a JSON array or in--args. The Node.js build also checks a value typed as a flag against the schema'spattern; the native build, and values given as JSON, leave that check to the daemon. - Lists take
a,b, a repeated flag, or a JSON array. - Maps such as
envandlabelstake repeatedkey=value:--env A=1 --env B=2. A label filter onlistis writtenkey:valueinstead.list --label key=value, an empty--labeland--label '[]'fail instead of listing every sandbox. - Nested objects take dotted names (
--network.mode) or JSON. @filereads a value from a file and@-from stdin, so secrets stay out of shell history:env=TOKEN=@token.txt. Start a value with@@for a literal@.--args '{...}'passes all arguments as one JSON object.
Output
| Kind | Commands | What you get |
|---|---|---|
| JSON | most | Pretty JSON on a terminal, one line of JSON when piped or with --json. -q prints only the ids, one per line, and says on stderr when the reply was cut short (truncated), so a list with more matches than --limit (1000 by default) does not look complete |
| Stream | run, exec | The guest's stdout and stderr on yours, as they arrive |
| Terminal | shell | An interactive terminal in yours, until the shell exits |
| Bytes | read-file | The file on stdout, or into -o FILE as it arrives; -o - also means stdout. Exits 1 if the transfer ends before the whole file arrived, and removes a partial -o FILE |
| Image | screenshot | Saves the PNG into -o FILE, or a new file in $KUMOBA_HOME/screenshots (~/.kumoba/screenshots). That folder must be yours with mode 0700, and the CLI creates each file new with mode 0600 and refuses to write through an existing file or a symbolic link, and prints its path and size, as in /home/me/.kumoba/screenshots/sbx-1-1764834000000.png 1024x768. --json prints {"path", "width", "height", "bytes"}, -q only the path, and -o - writes the PNG to stdout |
| Elements | ui-tree | One line per element, indented under the element that holds it: push button "Send" at 812,440. The point is the element's centre, ready for click. Says on stderr when there were more than --limit. --json prints the elements with their bounds |
write-file reads the file content from content=@path, or from stdin when it is piped. It creates missing parent directories as --user, or as root without it. read-file, write-file and list-files with --user have the permissions exec --user has, supplementary groups included; Files has the owner, group and mode of created directories and the limits.
--open opens a returned url in your browser. That is how kumoba desktop <id> --open shows the desktop live, on a Linux or a macOS sandbox, and kumoba expose <id> --port 3000 --ttl-seconds 600 --open opens a web app running in the sandbox. Those links point at the daemon's preview listener, which the zero-config daemon starts on 127.0.0.1:7789, apart from its API. A daemon configured by hand needs KUMOBAD_PREVIEW_LISTEN, and behind a reverse proxy KUMOBAD_PREVIEW_URL.

Exit status
| Status | Meaning |
|---|---|
| The guest's own | run and exec exit with the command's exit code, 124 when it timed out; shell with the shell's |
| 0 | Success |
| 1 | The daemon rejected the request: unknown sandbox, bad state, invalid value. Also a reply that broke off, or a connection kumobad closed after it took the command (protocol, with reason outcome_unknown unless the command only reads), and --open when the browser opener cannot start |
| 2 | Usage error: unknown command or option, missing argument, wrong type. Also a bad connection setting (KUMOBA_URL, a TLS variable or file), and an -o FILE that cannot be written |
| 3 | The daemon cannot be reached, or closed the connection before it began to answer the request for its command list, so no command was sent; there is no token yet; or the daemon is too old to describe its commands. A command list that breaks off partway is protocol, exit 1 |
Errors
A failure prints two lines on stderr: what went wrong with its stable code, and the next command to run, with the sandbox id or the command filled in:
$ kumoba exec sbx-1 -- ls
kumoba: sandbox sbx-1 is not started [conflict]
hint: start it with `kumoba start sbx-1`A message of several lines, such as a boot failure that quotes the worker's log, keeps [<code>] on its first line and indents the rest by two spaces, so the hint: line is always the last unindented one.
Both CLIs open a fresh connection for every request. Once it is connected (after the TLS handshake), the command may have reached kumobad, so any failure from then on, such as a reset, a close, a TLS error, a reply or an error reply that breaks off, a stream or a shell that ends before the command exits, or a reply that is not JSON, is protocol, exit 1, with the reason outcome_unknown unless the command only reads. Only a failure before that point, or a TLS refusal of the client certificate, is unreachable, exit 3. The first request, for the daemon's command list, only reads, so any failure of it before its reply begins is unreachable, exit 3, too; one whose reply breaks off partway is protocol, exit 1.
With --json anywhere before --, the error is one JSON object on stderr instead, so a script or an agent can branch on code and reason and run the hint. reason is there when one code covers several cases, and status when kumobad answered; fields without a value are left out:
$ kumoba get sbx-404 --json
{"error":{"code":"not_found","reason":"sandbox_not_found","message":"sandbox sbx-404 not found","hint":"`kumoba list` shows the sandboxes on this daemon","status":404}}An unknown command or argument names the closest match: kumoba sandbox list suggests kumoba list, memory=2048 suggests memory-mib=2048, and kumoba create default suggests image=default. A program given to exec or run without --, as in kumoba exec sbx-1 ls -la, suggests kumoba exec sbx-1 -- ls .... Errors and suggestions never repeat a value that may hold a credential:
- A value is repeated only when it is a plain word (letters, digits and
_./:-, at most 64 characters) and not forsecretsorenv, however their names are spelled (Env=,--env-). Anything else shows as..., as inenv=...orkumoba exec sbx-1 -- ..., or is described without its text, as inunexpected positional value. - In the
--suggestion, every value given before the program shows as..., and so do the program's own arguments. - JSON that does not parse is reported as
<name>: not valid JSON, for every argument and for--args, with no quote of it. - A bare value for a list of objects, as in
secrets=...without[, is refused before anything is sent. - A file path, from
-o FILEor akey=@filevalue, is repeated only when it holds nothing but letters, digits and_./:-; a sandbox id goes into a hint only when it is a plain word. - A reply that is not JSON is reported as
protocolwithout quoting it. - A URL in a message shows only its scheme, host and port, never a user name, password, path or query.
The native and the npm CLI print the same message, code, hint and exit status, with two exceptions. The text that the operating system, the runtime or the TLS library adds after a colon can differ: why a socket or file could not be reached, read or written, why a reply or the command list could not be read, and why TLS refused a certificate and key for a reason other than the ones kumoba checks itself (a file with no PEM item or bad base64 in one, an encrypted key, a key that does not match its certificate). And the npm CLI checks a value against its schema's pattern before it sends anything, so kumoba list --label task is a usage error there (exit 2), while the native CLI sends it and kumobad refuses it with invalid_request (exit 1).
kumobad itself reports a request body it cannot read without quoting a value from it from this version on. An older kumobad, or an older host behind a fleet, still quotes serde's text, which can hold the value it refused, such as a JSON value given with --args, which the CLI passes on without checking it. --json, -q, -o FILE (or --output=FILE) and --open work before the command name too.
kumoba help errors prints this table offline, for the installed version:
| Code (reason) | Meaning | Next |
|---|---|---|
usage | The command line is wrong: an unknown command, argument or option, a missing argument, or a value of the wrong type | kumoba <command> --help shows the arguments |
config_invalid (no_token) | kumoba has no token: KUMOBA_TOKEN is unset, and the token file is missing or empty, as before kumobad first ran. Exits 3 | Start kumobad once so it writes the token file, or set KUMOBA_TOKEN or KUMOBA_TOKEN_FILE |
config_invalid | A connection setting is wrong: a bad KUMOBA_URL, http:// to another machine, a TLS variable without an https:// URL, or a TLS file that cannot be read. Exits 2 | Fix the setting the message names; kumoba help lists the variables |
unreachable | kumobad cannot be reached at KUMOBA_URL, or it closed the connection before it began to answer the request for its command list, so no command was sent | Start it with kumobad, or point KUMOBA_URL at a running daemon |
unauthorized | kumobad refused the token | The hint names where the token came from (KUMOBA_TOKEN, KUMOBA_TOKEN_FILE or $KUMOBA_HOME/token); it must match the daemon's token file |
not_found (sandbox_not_found) | No sandbox has that id on this daemon | kumoba list shows the sandboxes on this daemon |
not_found | No such sandbox or route. A daemon older than this CLI may not have the route | kumoba list shows the sandboxes; kumoba version shows both versions |
invalid_request (unknown_image) | The daemon has no image by that name; the message lists the ones it has | kumoba images lists them |
invalid_request (invalid_cursor) | The daemon cannot read the cursor, such as one from another daemon | Run the command without --cursor to start from the beginning |
invalid_request | The daemon refused a value; the message names it | kumoba <command> --help shows the arguments |
conflict (not_started) | The sandbox is stopped, and the call needs it started | kumoba start <id> |
conflict (desktop_not_started) | The sandbox is started, but its desktop is not running, so there is nothing to see or drive | kumoba desktop <id> |
conflict (busy) | Another call holds the sandbox's disk, such as an export, a start or a stop | Retry shortly; kumoba get <id> shows activeOperations |
conflict (no_matching_host) | From a fleet: no available host that serves the image has every placement label the call asked for | Change or drop --placement; kumobad fleet list on the fleet shows each host's labels |
conflict | The sandbox is in the wrong state for the call | kumoba get <id> shows its state |
draining | The host is draining: its operator stopped it from creating sandboxes, and with --strict from starting them | The host was drained on purpose; create the sandbox on another host, or wait or ask its operator |
not_idle | A stop with --if-idle-for-ms found the sandbox in use, so it kept running | Retry later, or kumoba stop <id> stops it anyway |
capacity | Every running slot is in use | Retry after the Retry-After seconds, or kumoba capacity shows the slots in use |
exceeds_host_memory | The sandbox asks for more memory than the host's whole memory budget | Ask for less with --memory-mib; kumoba capacity shows the budget |
disk_full | The host is short of free disk for this sandbox | kumoba prune-stopped --older-than-ms 0 --dry-run lists stopped sandboxes to delete |
guest_error (no_desktop) | The sandbox has no desktop to drive: its image has no desktop, or it runs macOS, where only the live view works | Use a sandbox from an image with a desktop, such as kumoba create --image default |
guest_error | The command or file operation failed inside the sandbox, or the image lacks what the call needs | kumoba get <id> shows the sandbox; the message is the guest's |
command_failed | The command could not run in the sandbox | kumoba get <id> shows whether the sandbox is still started |
request_timeout | The request body did not arrive in time | Retry |
request_too_large | The request body is over its limit | Send a smaller body |
forbidden | This host takes calls only from paired clients, and the connection presented no client certificate | Set KUMOBA_CERT_FILE and KUMOBA_KEY_FILE to a client certificate the host's client CA signed, as pairing with a code from kumobad host pair-code gives |
upgrade_required (daemon_too_old) | kumobad is older than this CLI: it does not describe its commands. Exits 3 | Upgrade kumobad to this CLI's version or later |
upgrade_required | This CLI and the daemon do not speak the same version of the call | kumoba version shows both versions; upgrade the older one |
bad_gateway | The app or live view in the sandbox could not be reached | Retry once the app in the sandbox answers |
gateway_timeout | The app in the sandbox sent no response in time | Retry once the app in the sandbox answers |
host_unavailable (outcome_unknown) | From a fleet: the host took the call, but its answer was lost, so the call may or may not have taken effect there | The command may have run; check its effect before running it again |
host_unavailable (may_exist) | From a fleet: the host took the create, but its answer was lost, so the sandbox may exist on that host | Look for it with kumoba list, by its labels if it has any, before you try again |
host_unavailable | From a fleet: the sandbox's host, or every host that could take it, is unavailable | Retry later |
unavailable | kumobad is shutting down | Retry once it is back; kumobad starts it |
internal (outcome_unknown) | kumobad lost track of the call partway, so it may or may not have taken effect, as when the sandbox's worker ends during a command | The command may have run; check its effect before running it again |
internal | kumobad failed | Retry; the daemon's log has the details |
protocol (outcome_unknown) | kumobad took the request, then the connection or its reply broke, so the call may or may not have taken effect | The command may have run; check its effect before running it again |
protocol | The daemon's reply was cut short or could not be read | Retry; kumoba version shows whether this CLI and the daemon differ |
daemon_error | The daemon answered with an error that has no code | kumoba version shows whether this CLI and the daemon differ |
no_preview_url | --open got no browser link, since the daemon has no preview listener | Start kumobad with KUMOBAD_PREVIEW_LISTEN or KUMOBAD_PREVIEW_URL set |
open_failed | The CLI could not start the browser opener (open or xdg-open) | Open the url in the printed JSON yourself |
cli_error | The CLI itself failed, such as writing -o FILE (exits 2) | The message says what failed |
A daemon older than this CLI sends no reason, so its errors get the hint of the code alone. The daemon's HTTP error codes are listed in the HTTP API.
For agents
An agent with a shell needs nothing beyond the CLI:
kumoba commands --json | jq '.commands[] | {name, summary}'
id=$(kumoba create --image default --labels task=fix-tests --start -q)
kumoba exec "$id" --cwd /workspace -- pytest -q; echo "exit $?"
kumoba list --label task:fix-tests --jsonEach command's inputSchema in kumoba commands --json is a JSON Schema, so it can be handed to a model as a tool definition as is. An agent without a shell, or a client that takes MCP servers, can have the same commands as tools through kumoba mcp: see Use kumoba as an MCP server.
kumoba skill prints the kumoba agent skill built into this CLI, and kumoba skill <reference> one of its references (arguments, desktop, errors, network), without a daemon. See Use kumoba from your coding agent.
With --json, a failure is one JSON object on stderr with code, reason, message, hint and status (see Errors), so an agent can branch on the code and run the command the hint names, such as kumoba start <id> for a stopped sandbox.
To let an agent see and use the sandbox's desktop, see Let an agent drive the desktop.
create --start boots the sandbox in the same call. When every running slot is in use it exits 1 at once, before any disk is copied, with running sandbox capacity exhausted; --wait-ms 60000 waits up to a minute for a slot first, and kumoba capacity shows how many slots are in use.
Examples
kumoba run --image default --network.mode blocked -- python3 -c 'print(sum(range(10)))'
kumoba run --timeout-ms 2000 -- sleep 5; echo $? # 124
id=$(kumoba create --image default --start -q)
kumoba write-file "$id" --path /workspace/data.csv content=@./data.csv
kumoba exec "$id" --cwd /workspace -- python3 -c 'import csv; print(sum(1 for _ in open("data.csv")))'
kumoba read-file "$id" --path /workspace/out.png -o out.png
kumoba set-secrets "$id" secrets=@./secrets.json
kumoba access-log --json | jq '.entries[] | select(.decision == "denied")'
kumoba events --json | jq '.events[] | select(.type == "stopped") | [.sandboxId, .reason, .atMs]'
kumoba stop "$id"
kumoba export "$id" -o sandbox.kumoba && kumoba delete "$id"
kumoba import content=@sandbox.kumoba # back as a new stopped sandboxLast updated on
Troubleshooting
Fixes for common kumoba errors: libkrun or /dev/kvm at install, cannot reach kumobad, TLS failures, capacity and disk full errors, macOS sandbox issues.
TypeScript SDK
Use the kumoba TypeScript SDK in Node to run code in VM sandboxes, expose ports, set secrets, drive the desktop, follow events and handle errors.