CLI
hermitbox runs sandboxes, connects agents, and installs and operates Hermitbox on your hosts. The
installer puts it at ~/.local/bin/hermitbox for the user preset and at /usr/local/bin/hermitbox
when it runs as root.
hermitbox <command> [options]To install it and run a first command, see Connect the CLI. The HTTP API behind each command is in the public API reference, which also summarizes the CLI subcommands.
Conventions
- A command that returns a record prints it to stdout as JSON. Errors go to stderr, with a trace ID when the API gave one, and the exit status is 1.
- Sandbox commands read
HERMITBOX_API_URLandHERMITBOX_API_KEY. Without them, they read the credentialshermitbox upsaved in~/.config/hermitbox/client.json. See Environment variables. - Operator commands (
node,key,projectanddoctor --fleet) needHERMITBOX_OPERATOR_TOKEN. - A
<duration>is a number of seconds (90) or a number followed bys,m,hord(10m,2h). - A
<json>value is one JSON object, quoted for your shell:--labels '{"team":"web"}'. --ends the options. Everything after it is the command to run in the sandbox.
Global options
| Option | What it does |
|---|---|
-h, --help |
Print help for Hermitbox or a command, and exit 0. hermitbox help <command> does the same. |
--version |
Print the version. Only as the first argument. |
hermitbox sandbox --helpSandboxes
run
Create a sandbox, run one command in it, and delete it.
hermitbox run [options] -- <command...>| Option | Default | What it does |
|---|---|---|
--isolation <tier> |
The host chooses | process, wasm, container, gvisor or vm |
--image <image> |
None | The image to start from. Needed for container, gvisor and vm. |
--timeout <duration> |
None | Stop the command after this long |
--stdin |
Off | Send this shell’s standard input to the command once |
--snapshot |
Off | After the command, keep a snapshot in a new sandbox at rest, and print both IDs as JSON on stderr |
--snapshot-output <file> |
None | With --snapshot, also write the snapshot ID to this file (mode 600) |
run also takes the request options of sandbox create, such as --name,
--env and --ttl. It exits with the command’s exit status and deletes the sandbox even when the
command fails.
hermitbox run -- echo hellohermitbox run --isolation vm --image alpine:3.22 -- uname -rsandbox create
Create a sandbox and print its record.
hermitbox sandbox create [options]| Option | Default | What it does |
|---|---|---|
--image <image> |
None | The image to start from |
--isolation <tier> |
The host chooses | process, wasm, container, gvisor or vm |
--name <name> |
None | A name unique in the project |
--labels <json> |
None | Labels, as a JSON object of strings |
--metadata <json> |
None | Metadata, as a JSON object |
--env <json> |
None | Environment variables, as a JSON object |
--workdir <path> |
None | An absolute working directory |
--user <uid> |
None | A numeric user ID |
--ttl <duration> |
None | End access after this long; the data is deleted after |
--idle <duration> |
None | Sleep the sandbox after this long without activity |
--auto-delete |
Off | Delete the sandbox when it goes idle instead of keeping it. Needs --idle. |
--units <count> |
1 | Resource units to reserve |
--network <mode> |
internet |
internet or none |
--spare-ports <count> |
None | Edge ports to reserve for sandbox expose |
--egress <json> |
None | Host rules, as {"allow":[…],"deny":[…]} |
--package <name> |
None | A Wasm package to add. Repeat for more. Wasm tier only. |
--stopped |
Off | Create the sandbox without starting it |
--from-snapshot <snapshot-id> |
None | Start from a snapshot. The other request options are ignored. |
--spec <file> |
None | Read the whole request from a JSON file. The other request options are ignored. |
--idempotency-key <key> |
A random UUID | Repeat a create safely with the same key |
# Create a sandbox from an image and save its ID.
SANDBOX_ID=$(hermitbox sandbox create --image alpine:3.22 | jq -r .id)hermitbox sandbox create \
--name web \
--labels '{"team":"web"}' \
--idle 15msandbox ls
List the project’s sandboxes. hermitbox sandbox with no verb does the same.
hermitbox sandbox ls [--name <name>] [--state <state>] [--labels <json>]| Option | Default | What it does |
|---|---|---|
--name <name> |
None | Only the sandbox with this name |
--state <state> |
None | creating, stopped, starting, running, sleeping, resting, restoring or failed |
--labels <json> |
None | Only sandboxes that carry all these labels |
hermitbox sandbox ls --state runningsandbox get
Print a sandbox’s record without waking it.
hermitbox sandbox get <sandbox-id>hermitbox sandbox get "$SANDBOX_ID"sandbox exec
Run a command in a sandbox, stream its output, and exit with its exit status.
hermitbox sandbox exec <sandbox-id> [options] -- <command...>| Option | Default | What it does |
|---|---|---|
--timeout <duration> |
None | Stop the command after this long |
--stdin |
Off | Send this shell’s standard input to the command once |
--idempotency-key <key> |
None | Run the command at most once for this key |
hermitbox sandbox exec "$SANDBOX_ID" -- ls /echo hello | hermitbox sandbox exec "$SANDBOX_ID" --stdin -- catLifecycle verbs
Change whether a sandbox runs, and how long it lives. Each prints the sandbox’s record.
hermitbox sandbox <start|stop|sleep|wake|rest> <sandbox-id>
hermitbox sandbox <keep-alive|ttl|idle> <sandbox-id> <duration>
hermitbox sandbox wait <sandbox-id> <state> [--timeout <duration>]
hermitbox sandbox rm <sandbox-id>| Verb | What it does |
|---|---|
start |
Start a stopped sandbox |
stop |
Stop compute and keep the sandbox’s disk |
sleep |
Keep the data and suspend memory where the node can, or stop |
wake |
Bring a stopped, sleeping or resting sandbox back |
rest |
Upload a snapshot, then release the node’s compute and disk |
keep-alive |
Extend access by this long and count it as activity |
ttl |
Replace the TTL deadline, counted from now |
idle |
Set how long the sandbox waits without activity before it sleeps |
wait |
Wait until the sandbox reaches a state. --timeout defaults to 30 seconds. |
rm |
Delete the sandbox, its data and its snapshots |
hermitbox sandbox sleep "$SANDBOX_ID"hermitbox sandbox wait "$SANDBOX_ID" running --timeout 2msandbox snapshot
Save a sandbox’s files as a snapshot and print it.
hermitbox sandbox snapshot <sandbox-id>SNAPSHOT_ID=$(hermitbox sandbox snapshot "$SANDBOX_ID" | jq -r .id)sandbox fork
Start a new sandbox from a snapshot.
hermitbox sandbox fork <snapshot-id> [--idempotency-key <key>]--idempotency-key defaults to a random UUID. To snapshot and copy a sandbox in one step, use
fork.
hermitbox sandbox fork "$SNAPSHOT_ID"Processes
Start, list, stop and wait for processes in a sandbox.
hermitbox sandbox ps <sandbox-id>
hermitbox sandbox spawn <sandbox-id> [--stdin] -- <command...>
hermitbox sandbox kill-all <sandbox-id>
hermitbox sandbox wait-port <sandbox-id> <process-id> <port> [--http] [--path <path>] [--timeout <duration>]
hermitbox sandbox wait-log <sandbox-id> <process-id> <pattern> [--timeout <duration>]
hermitbox sandbox wait-exit <sandbox-id> <process-id> [--timeout <duration>]| Verb | What it does |
|---|---|
ps |
List the sandbox’s processes |
spawn |
Start a command in the background and print the process |
kill-all |
Stop every process in the sandbox |
wait-port |
Wait until the process listens on a port. --http waits for an HTTP answer on --path. |
wait-log |
Wait until the process logs a line that matches the pattern |
wait-exit |
Wait until the process exits |
The wait- verbs give up after --timeout, 30 seconds by default.
# Start a server in the background and save its process ID.
PROCESS_ID=$(hermitbox sandbox spawn "$SANDBOX_ID" -- python3 -m http.server 8000 | jq -r .id)
# Wait until it answers HTTP.
hermitbox sandbox wait-port "$SANDBOX_ID" "$PROCESS_ID" 8000 --httpShells and terminals
Work in a sandbox interactively.
hermitbox sandbox terminal <sandbox-id>
hermitbox sandbox shell <sandbox-id> [--cwd <path>] [--command <command>]
hermitbox sandbox ssh <sandbox-id> [<ssh-argument...>]
hermitbox sandbox python [<sandbox-id>] [-c <code>] [--context <name>]| Verb | What it does |
|---|---|
terminal |
Open a full terminal in the sandbox |
shell |
Run lines in one shell that keeps its state between them. --command runs one line and exits. |
ssh |
Connect with OpenSSH through a short-lived key, revoked on exit. Arguments after the ID go to ssh. |
python |
Run Python in a live kernel. -c runs one snippet; without it you get a multiline prompt. --context names the kernel context. |
sandbox python without a sandbox ID creates a container sandbox from the python-interpreter
template and deletes it on exit. See code interpreters.
hermitbox sandbox terminal "$SANDBOX_ID"hermitbox sandbox python -c 'print(2 + 2)'Files
Copy, search and change files in a sandbox.
hermitbox sandbox cp <source> <destination>
hermitbox sandbox sync <sandbox-id> <local-directory> <remote-directory>
hermitbox sandbox exists <sandbox-id> [<path>]
hermitbox sandbox find <sandbox-id> [<glob>]
hermitbox sandbox grep <sandbox-id> <pattern> [--paths <path,...>]
hermitbox sandbox replace <sandbox-id> <old> <new> [--paths <path,...>]
hermitbox sandbox chmod <sandbox-id> <mode> <path>| Verb | Default | What it does |
|---|---|---|
cp |
Copy a file or directory. One side is <sandbox-id>:<path>, the other a local path. |
|
sync |
Copy a local directory into the sandbox | |
exists |
. |
Say whether a path exists |
find |
**/* |
List paths that match a glob |
grep |
--paths . |
Search file contents |
replace |
--paths . |
Replace text in files |
chmod |
Set an octal mode, such as 755 |
cp refuses local symbolic links.
# Upload a directory, then download a file.
hermitbox sandbox cp ./app "$SANDBOX_ID":/data/app
hermitbox sandbox cp "$SANDBOX_ID":/data/app/out.txt ./out.txtsandbox git
Run Git in a sandbox.
hermitbox sandbox git <sandbox-id> clone <url> [--path <path>] [--branch <branch>] [--depth <count>] [--token-env <name>]
hermitbox sandbox git <sandbox-id> <status|pull>
hermitbox sandbox git <sandbox-id> diff [--staged]
hermitbox sandbox git <sandbox-id> branch [<branch>]
hermitbox sandbox git <sandbox-id> checkout <branch> [--create]
hermitbox sandbox git <sandbox-id> add <path...>
hermitbox sandbox git <sandbox-id> commit <message> [--author <author>]
hermitbox sandbox git <sandbox-id> push [--token-env <name>]
hermitbox sandbox git <sandbox-id> log [--limit <count>]| Option | What it does |
|---|---|
--token-env <name> |
Read the Git token from this environment variable on your machine |
--author <author> |
The commit’s author, in Name <email> form |
--create |
Create the branch before checking it out |
--staged |
Show staged changes only |
Git works in repo unless clone --path names another directory.
hermitbox sandbox git "$SANDBOX_ID" clone https://git.example.com/team/app.git --depth 1Ports and network
Publish a sandbox’s ports and change its network.
hermitbox sandbox expose <sandbox-id> <port>
hermitbox sandbox unexpose <sandbox-id> <port>
hermitbox sandbox endpoints <sandbox-id>
hermitbox sandbox network <sandbox-id> <internet|none>
hermitbox sandbox mcp-url <sandbox-id>| Verb | What it does |
|---|---|
expose |
Publish a port through the edge and print its URL |
unexpose |
Withdraw a published port |
endpoints |
List the sandbox’s published endpoints |
network |
Turn internet access on or off |
mcp-url |
Print the sandbox’s own MCP URL |
hermitbox sandbox expose "$SANDBOX_ID" 8000Logs and measurements
Read what a sandbox did, without waking it.
hermitbox sandbox logs <sandbox-id> [--follow] [--since <time>] [--tail <count>]
hermitbox sandbox events <sandbox-id> [--follow] [--since <time>]
hermitbox sandbox top <sandbox-id> [--since <time>] [--once]
hermitbox sandbox metrics <sandbox-id> [--since <time>]
hermitbox sandbox why <sandbox-id>| Verb | What it does |
|---|---|
logs |
Print the sandbox’s log lines as JSON, one per line |
events |
Print its lifecycle events |
top |
Follow its CPU, memory, disk and network samples. --once prints them and exits. |
metrics |
Print its measurements |
why |
Print the decisions recorded for it |
hermitbox sandbox logs "$SANDBOX_ID" --followhermitbox sandbox top "$SANDBOX_ID" --since 2026-11-01T00:00:00Z --oncecreate
Start a coding agent in a new sandbox and attach your terminal to it.
hermitbox create <agent> [--env <name>]
hermitbox create npm:<package>@<version> --bin <name>
hermitbox create pip:<package>==<version> --bin <name>
hermitbox create <https-url> --bin <name> --sha256 <digest>
hermitbox create --list| Option | What it does |
|---|---|
--env <name> |
Pass this environment variable, by name, into the sandbox. Repeat for more. |
--bin <name> |
The program to start, for a package or an HTTPS release |
--sha256 <digest> |
The HTTPS release’s SHA-256 digest |
--list |
List the agents Hermitbox knows |
Hermitbox tries vm, then gvisor, container and process, and uses the first tier a host can
place. With --env it skips vm, because VM memory snapshots could keep the values. The sandbox
sleeps after 15 minutes idle. Hermitbox prints the connect command to reattach.
hermitbox create --listhermitbox create <agent> --env <name>connect
Reattach to a coding agent’s session in a sandbox, waking the sandbox if it sleeps.
hermitbox connect <sandbox-id> [--process <process-id>]| Option | Default | What it does |
|---|---|---|
--process <process-id> |
Start the agent again | The running session to reattach to, as create printed it |
hermitbox connect "$SANDBOX_ID"fork
Snapshot a sandbox and start a copy of it with the same labels.
hermitbox fork <sandbox-id>hermitbox fork "$SANDBOX_ID"template
List, create or build templates. hermitbox templates lists them.
hermitbox template ls
hermitbox template create <name> [--image <image>]
hermitbox template build -f <file>
hermitbox template from <repo> [--image <digest>] [--port <port>] [--install <command>] [--start <command>] [--units <count>] [--check <command>]| Verb | What it does |
|---|---|
ls |
List the project’s templates |
create |
Prepare a built-in template, such as python-interpreter, node-interpreter, browser, desktop, tools or sandbox-agent. --image selects an operator-built image. |
build |
Build the template a TypeScript file exports by default |
from |
Make a template from an HTTPS Git repository or a local checkout, start a sandbox from it, and print its preview URL |
See templates from code for the built-in templates and what
template from recognizes.
hermitbox template create python-interpreterhermitbox template build -f hermitbox.template.tsAgents and integrations
mcp
Run the Hermitbox MCP server for an agent, with the saved credentials.
hermitbox mcp [--http <port>]| Option | Default | What it does |
|---|---|---|
--http <port> |
stdio | Listen on http://127.0.0.1:<port>/mcp instead. Every request needs the project key as a bearer token. |
See MCP and Use with your agent.
hermitbox mcphermitbox mcp --http 8765webhook
Create, list and delete webhook endpoints for sandbox lifecycle events.
hermitbox webhook create <url> [--kinds <kind,...>]
hermitbox webhook ls
hermitbox webhook rm <webhook-id>
hermitbox webhook deadletters <webhook-id>| Option | Default | What it does |
|---|---|---|
--kinds <kind,...> |
created,deleted |
The event kinds the endpoint receives |
create prints the signing secret once. deadletters lists the deliveries that ran out of
retries. See webhooks for the kinds and the payload.
hermitbox webhook create https://hooks.example.com/hermitbox --kinds created,running,deletedHost and fleet
up
Install or start Hermitbox on this host, with the preset the host fits.
hermitbox up [--preset <preset>] [--check]
hermitbox up --preset server [--domain <domain>] [--image [<image>]] [--allow-image <prefix>]| Option | Default | What it does |
|---|---|---|
--preset <preset> |
Detected | user, container, server or node |
--check |
Off | Check this host for the preset and print the plan, without installing |
--domain <domain> |
HERMITBOX_DOMAIN, else localhost |
The server’s public domain. It cannot change once set. |
--image [<image>] |
Off | Install the server as the release image under systemd. An image after it, or HERMITBOX_IMAGE, replaces the release’s. |
--allow-image <prefix> |
The default allowlist | An image prefix or digest the server’s node accepts. Repeat for more. |
--from-dir <directory> |
Download | Install from release assets in this directory |
An ordinary user gets user. Root gets container inside a container and server on a systemd
host. The node preset joins a fleet with HERMITBOX_JOIN_TOKEN, allowing the images in
HERMITBOX_NODE_ALLOW_IMAGES. See install and
operate.
hermitbox upsudo hermitbox up --check --domain sandboxes.example.comdown
Stop Hermitbox on this host. It serves the user and container presets.
hermitbox down [--preset <preset>] [--purge]| Option | Default | What it does |
|---|---|---|
--preset <preset> |
Detected | user or container |
--purge |
Off | Also delete Hermitbox’s files and sandboxes on this host |
hermitbox downupgrade
Upgrade Hermitbox on this host to the newest signed release, keeping its database and sandboxes.
It serves the user and container presets; upgrade a server with hermitbox up --preset server.
hermitbox upgrade [--preset <preset>] [--from-dir <directory>]| Option | Default | What it does |
|---|---|---|
--preset <preset> |
Detected | user or container |
--from-dir <directory> |
Download | Upgrade from release assets in this directory |
hermitbox upgradedoctor
Check this host, the fleet or a metrics endpoint, and say what each tier needs.
hermitbox doctor [--fleet | --metrics <url>] [--json]| Option | Default | What it does |
|---|---|---|
--fleet |
Off | Check the fleet through the operator listener. Needs HERMITBOX_OPERATOR_TOKEN. |
--metrics <url> |
None | Check a Prometheus metrics endpoint |
--json |
Off | Print the result as JSON |
doctor changes nothing. --fleet and --metrics exit 1 when they find a problem.
hermitbox doctorhermitbox doctor --fleet --jsonnode
Join this host to a fleet, or manage fleet nodes through the operator listener.
hermitbox node join [--allow-image <prefix>] [--verify-only]
hermitbox node token [<region>] [--node <node-id>]
hermitbox node <ls|summary|events>
hermitbox node <get|drain|undrain|retire|reinstate|clear-quarantine|release> <node-id>
hermitbox node lost <node-id> --fenced-by <proof> --reason <reason> [--force]
hermitbox node shapes <region> --provider <name>
hermitbox node acquire <region> --provider <name> --shape <name> [--idempotency-key <key>]
hermitbox node acquisition <acquisition-id>
hermitbox node cancel-acquisition <acquisition-id>| Verb | What it does |
|---|---|
join |
Verify the signed bootstrap and join this host with HERMITBOX_JOIN_TOKEN. --allow-image permits an image prefix; repeat it for more. --verify-only checks the bootstrap without installing. |
token |
Issue a join token for a region (default when left out), or for one node with --node |
ls, get, summary, events |
Read the fleet’s nodes, its summary and its events. hermitbox node alone lists nodes. |
drain, undrain |
Stop or resume placing sandboxes on a node |
retire |
Retire a node once its placements have moved. It revokes the node’s credentials. |
reinstate |
Restore a lost node’s assignments |
clear-quarantine |
Clear a node’s quarantine |
release |
Release a provider machine |
lost |
Record a node as lost, with the proof that it was fenced |
shapes, acquire |
List a provider’s machine shapes in a region, or acquire one |
acquisition, cancel-acquisition |
Read or cancel an acquisition |
Every verb but join needs HERMITBOX_OPERATOR_TOKEN. See operate and
machine providers.
hermitbox node lsexport HERMITBOX_JOIN_TOKEN='<token>'
sudo --preserve-env=HERMITBOX_JOIN_TOKEN hermitbox node join --allow-image alpine:key
Create, list or revoke API keys through the operator listener. Each key belongs to one project.
hermitbox key create --project <project-id> [--name <name>]
hermitbox key ls [--project <project-id>]
hermitbox key revoke <key-id>| Option | Default | What it does |
|---|---|---|
--project <project-id> |
None | The key’s project, or the project to list |
--name <name> |
Key |
A name for the key |
create prints the key once. hermitbox key alone lists keys.
hermitbox key create --project defaultproject
Create and manage projects and their limits through the operator listener.
hermitbox project create [options]
hermitbox project ls
hermitbox project <get|usage|freeze|unfreeze|rm> <project-id>
hermitbox project set <project-id> [options]| Option | What it does |
|---|---|
--name <name> |
The project’s name |
--max-units <count> |
Units the project can reserve |
--max-sandboxes <count> |
Sandboxes it can hold |
--max-running <count> |
Sandboxes it can run at once |
--max-units-per-sandbox <count> |
Units one sandbox can reserve |
--max-ttl <duration> |
The longest TTL a sandbox can ask for |
--max-idle <duration> |
The longest idle time a sandbox can ask for |
--max-exec-timeout <duration> |
The longest command timeout |
--max-snapshots <count> |
Snapshots it can keep |
--max-snapshot-bytes <bytes> |
Bytes of snapshots it can keep |
--max-egress-ports <count> |
Edge ports it can reserve |
--allowed-images <prefix,...> |
The image prefixes its sandboxes can use |
--expires-in <duration> |
Expire the project after this long |
--key |
Also create a key for the project |
A limit of unlimited resets it to the inherited value. freeze stops the project’s sandboxes and
refuses new work; unfreeze allows it again. usage prints units and counts against the limits.
hermitbox project create \
--name staging \
--max-units 5 \
--expires-in 24hconfig
Print the API key that hermitbox up saved for you. hermitbox config alone prints its help.
hermitbox config keyhermitbox config keyEnvironment variables
| Variable | Default | Read by |
|---|---|---|
HERMITBOX_API_URL |
The saved URL, else http://127.0.0.1:8082 |
Sandbox, agent, template, mcp and webhook commands |
HERMITBOX_API_KEY |
The saved key for that URL | The same commands. It overrides the saved key. |
HERMITBOX_CONFIG |
$XDG_CONFIG_HOME/hermitbox/client.json, else ~/.config/hermitbox/client.json |
The one credentials file to read |
HERMITBOX_HTTP_DIAGNOSTICS |
Off | Set to 1 to print each API request’s phase and status as JSON on stderr, without URLs, headers or bodies |
HERMITBOX_OPERATOR_API |
http://127.0.0.1:8081 |
node, key, project and doctor --fleet |
HERMITBOX_OPERATOR_TOKEN |
None | The same commands |
HERMITBOX_OPERATOR |
cli |
node: the name recorded as the operator |
HERMITBOX_JOIN_TOKEN |
None | node join and up --preset node |
HERMITBOX_NODE_ALLOW_IMAGES |
None | up --preset node: comma-separated image prefixes or digests |
HERMITBOX_DOMAIN |
localhost |
up --preset server, when --domain is left out |
HERMITBOX_IMAGE |
The release image | up --image, when no image follows the option |
HERMITBOX_REQUIRE |
None | up: comma-separated guarantees the install must provide |
HERMITBOX_DEFAULT_ISOLATION |
The host chooses | up: a tier, or a comma-separated order of tiers, for requests that name none |
HERMITBOX_RELEASE_BASE_URL |
The release distribution | up and upgrade: a release mirror |
$curl -fsSL https://hbx.sh | shInstall Hermitbox and set it up for me