Skip to Content
kumoba

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:

BuildInstall
Native, no runtime neededscripts/install.sh puts it in ~/.kumoba/bin; also cargo install kumobad
Node.js 22 or laternpm 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:

VariableDefault
KUMOBA_URLunix://$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_FILEthe public CAs; a PEM file to trust a private CA instead
KUMOBA_CERT_FILE and KUMOBA_KEY_FILEnone; 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 daemon

The commands the daemon serves:

CommandWhat it does
runRun one command in a fresh sandbox, stream its output, delete the sandbox
create, start, stop, deleteSandbox lifecycle; create leaves it stopped unless you pass --start
list, get, updateFind sandboxes by label, show one, change labels, timers or network
execRun a command in a started sandbox and stream its output
shellOpen an interactive shell in a started sandbox (Open a shell)
read-file, write-file, list-filesGuest files
exposeA signed, expiring link to a port inside the sandbox
desktopStart the desktop and link to a live view in the browser
screenshot, ui-treeSee 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, keyDrive the desktop's mouse and keyboard (Let an agent drive the desktop)
set-secrets, delete-secretsSecrets that never enter the guest
images, access-logBootable images, and every proxied network connection
capacityRunning slots in use and the KUMOBAD_MAX_RUNNING limit, the memory those sandboxes take, and free disk
prune-stoppedDelete old stopped sandboxes to free disk: --older-than-ms <ms>, --dry-run to only list them; through a fleet, --host <hostId> for one host
eventsSandboxes being created, started, stopped and deleted, and network changes, with exact times
infoThis host's id, versions, image digests, platform, limits and labels
drain, undrainStop creating sandboxes on this host, --strict to also refuse starts, and resume
commandsEvery 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 x and y of click. kumoba <command> --help shows them in its usage line.
  • A default sandbox. With KUMOBA_SANDBOX set 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, type and key. So kumoba click 300 200 and kumoba exec -- ls act on that sandbox. The id comes from the variable only when the command line parses with the id left out, so kumoba click <id> 300 200 still works, and an explicit id always wins: a value given twice, as in kumoba 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 set KUMOBA_SANDBOX, and kumoba <command> --help says whether the command takes it.
  • --kebab-case value, --kebab-case=value and camelCase=value set any argument. A boolean flag needs no value.
  • Everything after -- is the command's trailing list: the program and arguments for run and exec. A program without a / is looked up on the guest's PATH.
  • Types come from the schema: integers and booleans are checked, enums list their choices, null clears a nullable value, and a list with minItems cannot 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's pattern; 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 env and labels take repeated key=value: --env A=1 --env B=2. A label filter on list is written key:value instead. list --label key=value, an empty --label and --label '[]' fail instead of listing every sandbox.
  • Nested objects take dotted names (--network.mode) or JSON.
  • @file reads 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

KindCommandsWhat you get
JSONmostPretty 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
Streamrun, execThe guest's stdout and stderr on yours, as they arrive
TerminalshellAn interactive terminal in yours, until the shell exits
Bytesread-fileThe 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
ImagescreenshotSaves 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
Elementsui-treeOne 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.

The default image's desktop in the browser, opened with kumoba desktop --open

Exit status

StatusMeaning
The guest's ownrun and exec exit with the command's exit code, 124 when it timed out; shell with the shell's
0Success
1The 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
2Usage 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
3The 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 for secrets or env, however their names are spelled (Env=, --env-). Anything else shows as ..., as in env=... or kumoba exec sbx-1 -- ..., or is described without its text, as in unexpected 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 FILE or a key=@file value, 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 protocol without 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)MeaningNext
usageThe command line is wrong: an unknown command, argument or option, a missing argument, or a value of the wrong typekumoba <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 3Start kumobad once so it writes the token file, or set KUMOBA_TOKEN or KUMOBA_TOKEN_FILE
config_invalidA 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 2Fix the setting the message names; kumoba help lists the variables
unreachablekumobad 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 sentStart it with kumobad, or point KUMOBA_URL at a running daemon
unauthorizedkumobad refused the tokenThe 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 daemonkumoba list shows the sandboxes on this daemon
not_foundNo such sandbox or route. A daemon older than this CLI may not have the routekumoba 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 haskumoba images lists them
invalid_request (invalid_cursor)The daemon cannot read the cursor, such as one from another daemonRun the command without --cursor to start from the beginning
invalid_requestThe daemon refused a value; the message names itkumoba <command> --help shows the arguments
conflict (not_started)The sandbox is stopped, and the call needs it startedkumoba start <id>
conflict (desktop_not_started)The sandbox is started, but its desktop is not running, so there is nothing to see or drivekumoba desktop <id>
conflict (busy)Another call holds the sandbox's disk, such as an export, a start or a stopRetry 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 forChange or drop --placement; kumobad fleet list on the fleet shows each host's labels
conflictThe sandbox is in the wrong state for the callkumoba get <id> shows its state
drainingThe host is draining: its operator stopped it from creating sandboxes, and with --strict from starting themThe host was drained on purpose; create the sandbox on another host, or wait or ask its operator
not_idleA stop with --if-idle-for-ms found the sandbox in use, so it kept runningRetry later, or kumoba stop <id> stops it anyway
capacityEvery running slot is in useRetry after the Retry-After seconds, or kumoba capacity shows the slots in use
exceeds_host_memoryThe sandbox asks for more memory than the host's whole memory budgetAsk for less with --memory-mib; kumoba capacity shows the budget
disk_fullThe host is short of free disk for this sandboxkumoba 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 worksUse a sandbox from an image with a desktop, such as kumoba create --image default
guest_errorThe command or file operation failed inside the sandbox, or the image lacks what the call needskumoba get <id> shows the sandbox; the message is the guest's
command_failedThe command could not run in the sandboxkumoba get <id> shows whether the sandbox is still started
request_timeoutThe request body did not arrive in timeRetry
request_too_largeThe request body is over its limitSend a smaller body
forbiddenThis host takes calls only from paired clients, and the connection presented no client certificateSet 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 3Upgrade kumobad to this CLI's version or later
upgrade_requiredThis CLI and the daemon do not speak the same version of the callkumoba version shows both versions; upgrade the older one
bad_gatewayThe app or live view in the sandbox could not be reachedRetry once the app in the sandbox answers
gateway_timeoutThe app in the sandbox sent no response in timeRetry 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 thereThe 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 hostLook for it with kumoba list, by its labels if it has any, before you try again
host_unavailableFrom a fleet: the sandbox's host, or every host that could take it, is unavailableRetry later
unavailablekumobad is shutting downRetry 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 commandThe command may have run; check its effect before running it again
internalkumobad failedRetry; 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 effectThe command may have run; check its effect before running it again
protocolThe daemon's reply was cut short or could not be readRetry; kumoba version shows whether this CLI and the daemon differ
daemon_errorThe daemon answered with an error that has no codekumoba version shows whether this CLI and the daemon differ
no_preview_url--open got no browser link, since the daemon has no preview listenerStart kumobad with KUMOBAD_PREVIEW_LISTEN or KUMOBAD_PREVIEW_URL set
open_failedThe CLI could not start the browser opener (open or xdg-open)Open the url in the printed JSON yourself
cli_errorThe 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 --json

Each 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 sandbox

Last updated on

On this page