# Nodes and fleet One machine runs Hermitbox on its own; more machines join it as nodes. The control service decides what runs where, and each node runs only what control asks of it. | Part | Where it runs | What it does | | --- | --- | --- | | `hermitboxd` | Every host, as a node | Runs sandboxes and owns their local files; never chooses what to run | | Control | One service, with Postgres | Keeps desired state, projects and keys; places sandboxes; reaches nodes only through their mutual-TLS API | | Edge | In front, facing clients | Routes TLS, HTTP and TCP to sandboxes; holds a connection while control wakes one | | Object store | An S3 store; on one host, beside control | Holds uploaded snapshots for rest, moves and rebuilds | ## One host Every installation is a fleet of one. `hermitbox up` runs control, the edge, `hermitboxd`, Postgres and an object store on the same machine, and enrolls the local daemon as its first node. - **User preset:** an ordinary account, no root and no Docker. Everything listens on loopback, port 7331 by default. - **Server preset:** root on a systemd host, with Docker, nftables and a domain. Control and the edge run as systemd units, and the API gets a renewed TLS certificate for the domain. [Install Hermitbox](https://docs.hermitbox.dev/v0.2.1/get-started/install.md) covers each preset. A single host needs nothing more: the rest of this page is about adding hosts. ## Add a node A node joins with a token that an operator mints for a region. On a trusted host with the operator credentials, run: ```sh # Mint a join token for a region. hermitbox node token ``` On the new host, keep the token in the environment, never in the command's arguments: ```sh export HERMITBOX_JOIN_TOKEN='' curl -fsSL https://hbx.sh | \ sudo --preserve-env=HERMITBOX_JOIN_TOKEN HERMITBOX_PRESET=node sh ``` The joining host checks the signed bootstrap with the release keys built into the CLI. It trusts the fleet's certificate authority only when it matches the token's hash, makes its own key, and never sends that key anywhere. A new node allows no container images until the operator names some with `--allow-image`. Control, the edge and the nodes talk over a private network, such as WireGuard. Once `hermitbox node ls` shows the node healthy, placement starts using it. Machine providers can rent and release hosts for you: see [Machine providers](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md). ## What control decides A node never decides what should run; control does. - **Placement.** Control picks a node by region, tier, required guarantees and features, and free memory, CPU, disk and ports. A sandbox the fleet can't fit is refused with `no_room`. - **Epochs.** Each placement has an epoch. Every request that changes a sandbox carries it, and a node refuses an older one, so one sandbox never runs as two copies. - **Moves.** Draining a node moves its sandboxes where another node has room. A resting sandbox can wake on any node in its region. - **Health.** Nodes send heartbeats. A silent node is suspect after 15 seconds, and gets no new sandboxes; after 45 seconds it is unavailable. - **Upgrades.** Control offers each node the signed daemon release, one healthy node per region at a time. A node that can't reconcile on the new release rolls back. No timer declares a host lost. When a host is gone for good, you fence it outside Hermitbox (power it off, or cut it from the private network) and confirm with `hermitbox node lost`. Control then rebuilds its sandboxes from their newest uploaded snapshots, where another node has room. ## The edge The edge is the only part that faces the internet. It reads the TLS server name, the HTTP host or a dedicated TCP port to find a sandbox, using routes it polls from control. When the sandbox is asleep, the edge holds the client's first bytes, asks control to wake it, then relays them. The application sees an ordinary connection. ## When a part fails | Failure | What keeps going | | --- | --- | | Control or Postgres down | Running sandboxes keep running; nothing new is decided until it returns | | `hermitboxd` crashes | Containers and process sandboxes keep running; wasm sandboxes stop and keep their files | | A host reboots | Its sandboxes resume only once control authorizes them | | An edge dies | Its connections close; other edges keep serving | | The object store is down | Local data stays; rest and rebuilds wait | ## Next steps - [Operate Hermitbox](https://docs.hermitbox.dev/v0.2.1/guides/operate.md): drain, fence, upgrade and observe nodes. - [Machine providers](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md): acquire and release hosts automatically. - [Architecture](https://docs.hermitbox.dev/v0.2.1/reference/architecture.md): epochs, failures and the full flow. --- # Isolation tiers Each sandbox runs on one isolation tier, from confined processes on the host's kernel to a virtual machine with its own kernel. A request that names a tier gets it, or a refusal that says what is missing. | Tier | Runs | Separates a sandbox with | Kernel | Needs from the host | | --- | --- | --- | --- | --- | | `process` | Native commands on a bundled userland | Landlock, seccomp and rlimits; namespaces and a cgroup of its own where the host allows | The host's | Linux with Landlock ABI 3 (6.2 or later); no root | | `wasm` | WebAssembly, Python and JavaScript, agentOS packages | A virtual kernel in a shared, unprivileged agentOS sidecar | A virtual kernel per sandbox | `x86_64`; no root | | `container` | Any image the host allows | Namespaces, cgroups, every capability dropped | The host's | Docker or Podman | | `gvisor` | Any image the host allows | The container tier's settings, under gVisor's `runsc` | gVisor's user-space kernel | Docker with `runsc`, which the server preset installs | | `vm` | `linux/amd64` images | A Firecracker virtual machine under KVM | Its own Linux kernel | `x86_64` with KVM the daemon's user can open | Only `vm` boots its own kernel. By default a node serves every tier its measured host capabilities allow, side by side, and `hermitbox doctor` lists the tiers it serves and why the others are off. ## Process tier The `process` tier runs each sandbox as confined Linux processes, with no host privilege. Landlock keeps it out of other sandboxes' data and `/proc`, and a seccomp filter denies mounts, `ptrace`, namespace creation, `bpf` and identity changes. What else it gets depends on the host: - **Namespaces:** where user namespaces work, each sandbox gets its own PID and IPC namespaces, a private `/tmp`, and an empty network for `network: 'none'`. - **Limits:** where cgroup controllers are delegated to `hermitboxd`, the kernel enforces memory and CPU limits. Elsewhere memory is a sampled budget, not a hard cap. - **Users:** as root, each sandbox gets its own UID once the host's credential-drop probe passes. As an ordinary user, sandboxes share yours. - **Network:** with kernel network policy, eBPF programs decide each destination. Without it, internet-enabled process sandboxes share the host's network and must trust each other. The [process isolation](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md) reference covers each mode. ## Wasm tier The `wasm` tier runs software built for WebAssembly inside agentOS's virtual kernel. All wasm sandboxes on a node share one sidecar, so they share a fault domain and its CPU. Ingress is HTTP over TCP, hostname egress is refused, and sleep keeps data but not processes. See [agentOS on Hermitbox](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md). ## Container and gVisor The `container` tier runs images through Docker or Podman, with every capability dropped, `no-new-privileges`, private IPC and a PID limit. Images come only from the host's allowed prefixes. Containers share the host's kernel. The `gvisor` tier is the same engine, images, limits and firewall, with gVisor's `runsc` as the runtime. Each sandbox's system calls go to gVisor's user-space kernel, not the host's. They cost more: one-byte reads and writes cost about 26 times what they cost in a container. Hostname egress is refused on this tier. ## Virtual machine tier The `vm` tier boots each sandbox in a Firecracker virtual machine with its own Linux kernel. It needs an image, and as an ordinary user it can sleep with memory. See [Virtual machines](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md) for what a host needs and how images become disks. ## How the default is chosen When a request names no tier, control tries `container`, `vm`, `gvisor`, `process` and `wasm`, in that order, keeping only the tiers that fit the source: - An `image` runs on `container`, `vm` or `gvisor`. - No image runs on `process` or `wasm`. - `packages` runs on `wasm`. The first tier that a healthy node serves, with the guarantees in `require`, wins. A snapshot or a template keeps the tier it was saved on. The operator can fix one tier, or change the order, with `HERMITBOX_DEFAULT_ISOLATION=process` or a comma-separated list. ```ts // Ask for a container from an image. const box = await hb.sandbox({ isolation: 'container', image: 'alpine:3.22', }) console.log(box.isolation) // container ``` ```python # Ask for a container from an image. box = hb.sandbox( isolation='container', image='alpine:3.22', ) print(box.isolation) # container ``` The chosen tier is stored before compute starts and never changes for the life of the sandbox. ## Never a weaker guarantee A tier you name is never swapped for another. A `container` request never runs on `runsc`, and a `gvisor` request never runs without it. When no healthy node serves the tier, creation answers 503 `no_room`: ```txt No node can serve the vm tier for this request ``` The same holds for guarantees. Each sandbox reports `guarantees`, such as `own-kernel`, `memory-limit`, `private-network` and `host-firewall`, and a guarantee its node doesn't announce reads `false`. A create can `require` any of them, and a wake checks them again: ```ts // Place this sandbox only where memory limits are enforced. const box = await hb.sandbox({ image: 'alpine:3.22', require: ['memory-limit'], }) ``` ```python # Place this sandbox only where memory limits are enforced. box = hb.sandbox( image='alpine:3.22', require=['memory-limit'], ) ``` A request can't loosen the host's policy. Capabilities, mounts, images, users and network rules come from the host's configuration, and `HERMITBOX_REQUIRE` adds requirements no request can remove. ## Next steps - [Sandbox tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md): measurements and a full comparison. - [Capabilities](https://docs.hermitbox.dev/v0.2.1/reference/capabilities.md): which tiers give which guarantees. - [Host capabilities and guarantees](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md): what the host probe checks. --- # Lifecycle A sandbox is created, started, stopped, put to sleep, woken, rested, snapshotted, forked and deleted. Every verb but `delete` keeps the sandbox's data; they differ in what else they keep. | Verb | SDK | Afterwards | Released | | --- | --- | --- | --- | | `create` | `hb.sandbox(options)` | A new sandbox from an image, a snapshot or a template, started unless `start: false` | Nothing | | `start` | `box.start()` | Running, with its data | Nothing | | `stop` | `box.stop()` | Stopped; data stays on its node | Processes and memory | | `sleep` | `box.sleep()` | Sleeping with its data, and with memory and processes where the tier suspends | CPU, and memory when the tier stops instead | | `wake` | `box.wake()` | Running again, with whatever sleep or rest kept | Nothing | | `rest` | `box.rest()` | Resting; a snapshot in the object store | Compute and local data on the node | | `snapshot` | `box.snapshot()` | A saved copy of the data directory | Nothing; a running sandbox restarts | | `fork` | `snapshot.fork()` | A new, independent sandbox from a snapshot | Nothing | | `delete` | `box.delete()` | Gone | Compute, data and the sandbox's snapshots | The HTTP API uses the same verbs: `POST /v1/sandboxes//start`, `/stop`, `/sleep`, `/wake` and `/rest`, `POST /v1/sandboxes//snapshots` for a snapshot, and `POST /v1/snapshots//sandboxes` for a fork. ## Sandbox states A sandbox reports one of these in `box.state`: | State | Means | | --- | --- | | `creating` | Hermitbox recorded the request and is placing it | | `starting` | Compute is booting or resuming | | `running` | Commands and connections reach it | | `sleeping` | Suspended, or stopped by a sleep, on its node | | `stopped` | No compute; data on its node | | `resting` | No compute and no node; its data is a snapshot in the object store | | `restoring` | A wake is downloading and restoring that snapshot | | `failed` | The last change didn't complete; the sandbox's events say why | ## Sleep and wake `box.sleep()` suspends the sandbox where its tier can keep memory, and stops it otherwise. The answer's `tier` says which: `suspended` or `stopped`. A node that announces `memory-sleep` keeps processes and terminals across sleep: - `process`, always. - `container`, on a rootful engine with memory limits. - `vm`, as an ordinary user, once its start test has restored a guest on that host. - `wasm` never does: sleep ends its processes and keeps its data. A sandbox wakes in any of these ways: - **An API call:** `box.wake()`, `box.start()` or `POST /v1/sandboxes//wake`. - **A lookup:** `hb.sandbox('')` in the SDK, or `hermitbox sandbox exec`, wakes a sleeping or resting sandbox. Pass `wake: false` to the SDK to look without waking. - **A command or a connection:** an SDK command or a connection to one of its ports reaches the edge, which holds the bytes while control wakes the sandbox, then relays them. `POST /v1/sandboxes//exec` doesn't wake: it answers 409 `not_running` until you do. The wake's `tier` says what happened: `resumed` (memory restored), `booted` (started from its files) or `restored` (rebuilt from a resting snapshot). ```ts // Sleep: compute stops, the data stays. await box.sleep() // Wake it yourself, or let the next command or connection wake it. await box.wake() ``` ```python # Sleep: compute stops, the data stays. box.sleep() # Wake it yourself, or let the next command or connection wake it. box.wake() ``` With an `idle` timer, control sleeps a sandbox that has had no activity and no live session for that long. With `autoDelete` as well, it deletes the sandbox instead. ## Stop and start `box.stop()` ends every process: the stop signal first, then a kill after the grace period. Data and placement stay on the node. `box.start()` boots compute again from those files, and an `entrypoint` runs again from the beginning. ## Rest and restore `box.rest()` takes a snapshot, uploads it to the object store, and only then releases the sandbox's compute and local data. If the upload doesn't complete, the local data stays and rest fails. A resting sandbox keeps its ID and uses no node at all. A wake places it on a node with room, downloads and restores the snapshot, and boots it under a new placement epoch. It can land on a different node from the one it left. ## Snapshot and fork A snapshot copies the sandbox's persistent files, not its memory. A running sandbox is stopped for the copy and started again, so its processes restart. A `vm` sandbox asleep with its memory is copied asleep, and a fork on the same node wakes with the source's processes. ```ts // Save the box as it is. const snapshot = await box.snapshot() // Start an independent copy from that snapshot. const copy = await snapshot.fork() ``` ```python # Save the box as it is. snapshot = box.snapshot() # Start an independent copy from that snapshot. copy = snapshot.fork() ``` A fork is a new sandbox with its own ID and agent key, on the snapshot's tier. Changes to one never reach the other. `snapshot.delete()` removes a snapshot, except while a template version uses it. ## Delete a sandbox `box.delete()` removes the sandbox's compute, data and snapshots, and retires its addresses. It is refused while a template still uses the sandbox's data. After a `ttl` passes, access stops at once (410 `gone`) and upkeep deletes the sandbox. ## Next steps - [Sandboxes](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): what the data directory holds. - [Templates](https://docs.hermitbox.dev/v0.2.1/concepts/templates.md): start every sandbox from the same snapshot. - [Public API](https://docs.hermitbox.dev/v0.2.1/reference/api.md): request and answer shapes for every verb. --- # Sandboxes A sandbox is an isolated place to run commands, keep files and serve ports. Each one has its own data directory, network policy and limits, and runs on one isolation tier for its whole life. ```ts import { Hermitbox } from 'hermitbox' const hb = new Hermitbox() // Create a sandbox on the host's default tier. const box = await hb.sandbox() // Run a command in it. const result = await box.run('echo hello') console.log(result.stdout) // hello // Delete it when you're done. await box.delete() ``` ```python from hermitbox import Hermitbox hb = Hermitbox() # Create a sandbox on the host's default tier. box = hb.sandbox() # Run a command in it. result = box.run('echo hello') print(result.stdout) # hello # Delete it when you're done. box.delete() ``` | Part | What it is | | --- | --- | | Commands | One-shot commands, streams, background processes, shells and terminals | | Files | A persistent data directory; file paths are relative to it | | Ports | Declared ports and spare ports, reached through the edge | | Network | `internet` (the default) or `none`, plus egress rules where the node enforces them | | Limits | Units of memory and CPU, timers and project quotas | | Tier | `process`, `wasm`, `container`, `gvisor` or `vm`, fixed at creation | ## Run commands Every sandbox runs a Hermitbox agent that starts commands and serves files. `box.run` waits for the result, `box.stream` yields output as it arrives, and `box.spawn` starts a background process. A string command runs with `sh -c`. An argument array, such as `['cat', 'app.py']`, skips the shell. Commands start in the data directory unless `cwd` or the sandbox's `workdir` says otherwise. Each command carries one idempotency key, and Hermitbox never retries it on its own. A stream that ends without an exit has an unknown outcome: inspect the sandbox before you run it again. ## Files and what persists The data directory is the part of a sandbox that lasts. Stop, sleep, rest and moves keep it, and snapshots and forks copy it. On the `container`, `gvisor` and `vm` tiers it is mounted at `/data`. On the `process` tier it is a host directory: commands start there, and `HOME` and `TMPDIR` point to it. ```ts // Write a file into the data directory, then read it back. await box.write('notes/today.txt', 'hello') console.log(await box.read('notes/today.txt')) // hello ``` ```python # Write a file into the data directory, then read it back. box.write('notes/today.txt', 'hello') print(box.read('notes/today.txt')) # hello ``` Treat everything outside the data directory as temporary. By default a container's root filesystem is read-only and its `/tmp` lives in memory. File operations work while the sandbox is stopped or sleeping too: the node serves them without starting compute. ## Ports and endpoints A sandbox can declare ports at creation, each `public` or `private`. Public ports get an address on the edge, and private ones are reachable only on the fleet's private network. A sandbox also has three spare ports by default, which `box.expose(port)` publishes on demand and returns as a URL. Workload ports are never bound to a public address on the host. Only the edge and control can dial them, and a connection that arrives through the edge wakes a sleeping sandbox. ## Network and limits `network: 'none'` cuts a sandbox off on every tier. With `internet`, egress rules for hostnames or addresses apply where the node enforces them, and a node that can't refuses them by name. `box.network('none')` replaces a running or stopped sandbox's compute with the new policy and keeps its data. Resources come in units: one unit is 512 MiB and 250 CPU millis unless the operator sets other values. How strictly a tier enforces them differs, and [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md) says how. Timers put a sandbox to sleep or end it for you. `ttl` sets a deadline after which access stops and the sandbox is deleted. `idle` sleeps it after that long without activity, or deletes it when `autoDelete` is set. `box.keepAlive(duration)` extends access and counts as activity. Project ceilings bound all three. ## Projects and keys Every sandbox belongs to one project, and every API key belongs to one project. The key you use chooses the project, and another project's sandbox IDs answer 404 to it. An operator creates projects and keys on the private operator listener. The installer creates the first key and saves it for the CLI and the SDKs. ```sh # Create a project with limits, then a key for it. The key prints once. hermitbox project create --max-units 5 --max-running 3 hermitbox key create --project ``` Project limits cap units, running sandboxes, snapshots, timers and allowed images. A request over a limit gets 403 `limit_exceeded` with the limit's name. ## Address a sandbox Each sandbox has an ID, assigned at creation (`box.id`). It can also have a `name`, unique within its project, plus `labels` and `metadata` you set. ```ts // Find a sandbox again by its ID. A sleeping one wakes unless wake is false. const box = await hb.sandbox('') // List the project's sandboxes that carry a label. const boxes = await hb.sandboxes({ labels: { team: 'ci' } }) ``` ```python # Find a sandbox again by its ID. A sleeping one wakes unless wake is false. box = hb.sandbox('') # List the project's sandboxes that carry a label. boxes = hb.sandboxes(labels={'team': 'ci'}) ``` The same ID works in the CLI (`hermitbox sandbox get `) and in the HTTP API (`/v1/sandboxes/`). ## Next steps - [Lifecycle](https://docs.hermitbox.dev/v0.2.1/concepts/lifecycle.md): what each verb keeps. - [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md): how each tier separates a sandbox from the host. - [Public API](https://docs.hermitbox.dev/v0.2.1/reference/api.md) and [The sandbox agent](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md): every field and route. --- # Security model Hermitbox treats code in a sandbox as hostile. It keeps that code away from the host, from other sandboxes and from the keys that run the fleet, at the strength of the tier you choose. | Boundary | What holds it | Where it is weaker | | --- | --- | --- | | Sandbox and host | The tier's isolation, with policy from the host's configuration | `process` and `container` share the host's kernel | | Sandbox and sandbox | Per-tier separation; credentials bound to one sandbox | Shared-UID process sandboxes can signal each other; wasm sandboxes share one sidecar | | Sandbox and network | `network: 'none'` on every tier; egress only through gateways the node owns | Without kernel network policy, internet-enabled process sandboxes can reach host listeners | | Client and API | A project key reaches only its project; control stores only its SHA-256 | The edge sees agent and exposed-port traffic in clear, since it terminates that TLS | | Control and node | Mutual TLS 1.3, and an epoch on every change | The key exchange is classical | | Releases | ML-DSA-65 signatures checked before a binary runs | — | ## What Hermitbox trusts Hermitbox trusts the host's root and the operator, the operator token, the fleet's certificate authority, signed releases, and the Linux kernel. Kernel bugs are outside the model, except that the `vm` tier gives each sandbox a kernel of its own. It never trusts anything from inside a sandbox: the data directory, a guest kernel, or what the agent reports. Every walk of a data directory refuses links and special files. It never trusts DNS answers, proxy settings in a sandbox, or images beyond the host's allowed prefixes. ## Host policy wins Capabilities, mounts, images, users, network rules and limits come from the host's configuration, never from a request. Control decides what runs, but it can't decide how weakly: a node refuses weaker isolation than its policy, an image outside `allowed_images`, and any field it hasn't announced. A request that names a tier or a guarantee gets it, or a refusal that names what is missing. [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md) shows how. ## Where keys live Hermitbox's own keys never enter a sandbox. The project key stays with your client: a request to a sandbox's agent carries a capability for that sandbox alone, valid for at most five minutes. | Key | Where it lives | | --- | --- | | Project API key | Your client's `client.json` (mode 0600) or environment; control keeps only its SHA-256 | | Agent signing key | One per sandbox, in the node's private state, outside data, snapshots and exports | | Node identity key | Made on the node and never sent; root-only on a server | | Fleet certificate authority | Control | | Release signing key | The release workflow's protected environment; nodes and the CLI hold only the public keys, built in | | Secret-sealing keys | Control's environment | Secrets you pass at creation (`secrets`) are the one exception, by design: they reach the sandbox you made them for. Control seals them at rest with AES-256-GCM, and they never appear in a view, an event, a log or a record's digest. A `vm` guest receives them over vsock into memory, never onto a disk. ## Post-quantum keys | Use | Algorithm | Post-quantum | | --- | --- | --- | | Release, join bootstrap, host bundle and server manifest signatures | ML-DSA-65 (FIPS 204) | Yes | | Node and control mutual TLS key exchange | X25519 or NIST curves (rustls with ring) | No | | Fleet and node certificates | ECDSA P-256 | No | | Sandbox capabilities | Ed25519 | No | | SSH client and host keys | Ed25519, short-lived | No | | Public API certificates | Public WebPKI | No | | Secrets at rest in control | AES-256-GCM, symmetric | Not a public-key scheme | A node checks every release before it downloads it: the version must be no older than its own, and the offer must carry an ML-DSA-65 signature by a release or recovery key compiled into the daemon. Control or its certificate authority can pass a signature on, but can't make one. ## Known limits - **Process sandboxes share the host's kernel.** A kernel escape from one escapes its host or enclosing container. In the plain mode it has no PID, mount or network namespace. - **An ordinary user's process sandboxes share that user.** They share per-user limits and can signal each other. Use them for work you trust, or require `separate-users`. - **Without delegated cgroups,** process memory is a sampled budget, not a hard cap. - **Wasm sandboxes share one sidecar,** with no per-sandbox CPU rate. - **Containers share the host's kernel,** and Podman has no host firewall. - **Failover waits for an operator.** No timer declares a host lost, so a lost host's sandboxes stay down until someone fences it and confirms. - **A compromised fleet certificate authority** cuts every node off until each one re-enrolls. ## Next steps - [Threat model](https://docs.hermitbox.dev/v0.2.1/reference/threat-model.md): adversaries, boundaries and the file behind each one. - [Process isolation](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md): the process tier's two modes and its limits. - [Kernel network policy for process sandboxes](https://docs.hermitbox.dev/v0.2.1/reference/bpf.md): egress in the kernel. --- # Templates A template is a sandbox prepared once and saved as a snapshot, so every sandbox made from it starts in the same state. Installs and builds run once, when the template is made, never again per sandbox. | Part | What it holds | | --- | --- | | Source | An image on `container`, `gvisor` or `vm`, or no image on `process` or `wasm` | | Build | Files copied in, commands run, and an optional readiness check | | Snapshot | The prepared data directory, saved as an immutable version | | Start command | What runs in each new sandbox, in its data directory unless `workdir` says otherwise | | Tier | The tier the snapshot was made on; every sandbox from it runs there too | ## Start from a template Pass the template's name or ID when you create a sandbox. Hermitbox forks the newest version's snapshot and runs its start command. ```ts // Each sandbox from it starts with the dependencies installed. const box = await hb.sandbox({ template: 'my-api' }) ``` ```python # Each sandbox from it starts with the dependencies installed. box = hb.sandbox(template='my-api') ``` A create takes exactly one source: an `image`, a `snapshot` or a `template`. A sandbox from a template is an ordinary fork: it has its own ID and data, and changes never reach the template. ## Build one from code `hb.template` starts a sandbox from `from`, copies your files in, runs each `run` command, and snapshots the result. The copy happens from your machine; only the build plan and the finished snapshot reach control. ```ts // Copy the project in, install its dependencies, and save the result. const template = await hb.template({ name: 'my-api', from: 'node:22', copy: [['./', 'app']], run: ['cd /data/app && npm ci'], start: 'cd app && npm start', }) ``` ```python # Copy the project in, install its dependencies, and save the result. template = hb.template( name='my-api', from_='node:22', copy=[('./', 'app')], run=['cd /data/app && npm ci'], start='cd app && npm start', ) ``` Each `run` and `ready` command has up to ten minutes. A failed step says how it ended (its exit code, a signal or a timeout), and the build deletes its sandbox. The CLI runs the same builder from a file: `hermitbox template build -f hermitbox.template.ts`. ## Template versions Each build registers a new, numbered version, and a version never changes. `template.rebuild()` builds the next one from the same local files. New sandboxes start from the newest version, and `hb.templates()` lists them. A snapshot that a version uses can't be deleted, and neither can the sandbox that built it, while that version exists. ## Templates from a spec `POST /v1/templates` takes a `name` and a `spec`: the same fields as a create, such as `image`, `isolation`, `entrypoint` and `env`, with no snapshot or template as its source. Control prepares it once on each active node that serves the spec's tier and keeps a stopped snapshot there. A sandbox from it forks a ready copy in its region. Bucket mounts carry credentials, so a template never stores them. Pass them when you create each sandbox. ## Built-in templates `hermitbox template create` builds the plans Hermitbox ships for `python-interpreter`, `node-interpreter`, `desktop`, `browser` and `tools`. Starter projects such as `nextjs`, `vite-react` and `fastapi` are prepared on a container-capable node the first time a sandbox asks for one. `hermitbox template from ` prepares a Git repository the same way. ## Next steps - [Templates from code](https://docs.hermitbox.dev/v0.2.1/guides/templates-from-code.md): every builder field and starter. - [Code interpreters](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md) and [Native tools](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md): the built-in plans. - [Lifecycle](https://docs.hermitbox.dev/v0.2.1/concepts/lifecycle.md): how snapshots and forks work. --- # Decisions Each line records one choice Hermitbox has made and why. A change that makes a new choice adds a line under its subject, and a choice that replaces an older one replaces its line. Third-party software is recorded here, with its version and licence, before Hermitbox uses it. ## Licence and contributions - Hermitbox is AGPL-3.0-only (LICENSE.md). What users embed or copy into their own projects (`sdk/`, `integrations/`, `action/`, `templates/stacks/`) is Apache-2.0, so using it puts no AGPL terms on their code. The CLI is AGPL-3.0-only, because it bundles control's code. - Copyright is held by The Hermitbox Authors (NOTICE). Contributions come in under the Individual CLA in `cla/INDIVIDUAL.md`, adapted from Apache's, so other licence terms stay possible. A released version keeps the licence it shipped under. - The process tier's kernel programs in `bpf/` are `GPL-2.0-only OR BSD-2-Clause` and declare "Dual BSD/GPL" to the kernel, so the kernel admits the GPL-only helpers they call; the Rust that loads them stays AGPL-3.0-only. REUSE.toml gives the compiled object the same dual licence, and `LICENSES/` holds the SPDX texts. - Every file carries SPDX lines checked by REUSE. Generated licence-header strings inside source use REUSE's narrow ignore directives, so a generator's output is not misread as a header. - Hermitbox never links or copies the code of a control plane that integrates with it over the API, and that control plane never links Hermitbox's, because their licences differ; the two talk over Hermitbox's APIs only. ## Architecture - Hermitbox has three parts: `hermitboxd` on each host (Rust), the control service (TypeScript on Bun, with Postgres) and the edge (TypeScript on Bun). Control decides what runs; a node never does, and control reaches a host only through `hermitboxd`'s mutual-TLS API. - The daemon and `hermitbox-agent` share one Cargo workspace and one release version. The agent's token contract is small, so the daemon does not link the agent's server, shell or file watcher. - Control writes intent before it asks a node, keeps sandbox intent in its own table, serializes work with Postgres advisory locks on a separate pool, and runs upkeep on a serialized one-minute interval, because that needs no job-queue library. Advisory locks are polled without holding a database connection while waiting, so nested region and sandbox operations cannot exhaust the pool. - An epoch names one placement. Every mutating node request carries it, so an older handle can never change a newer copy; a move fences and retires the old copy, and the edge closes connections from older epochs. - Sleep keeps data and suspends memory where the node can; otherwise it stops. Rest uploads a snapshot and then releases local compute and data. Wake resumes memory, boots from local files or restores a resting snapshot under a new epoch. - The control execution lease allows autonomous restart only while it is current, and its expiry never stops a running sandbox. Without the store lease, failover needs an operator-confirmed loss. - The optional object-store lease is off by default on host and control. It needs rootful cgroup v2 Docker with cgroupfs and a host that does not suspend leased execution, and an independent watchdog outside the daemon's cgroup freezes and kills leased work, so stopping it does not depend on the daemon's own loop. - Store-lease authority is bounded by the store's HTTP Date and CLOCK_BOOTTIME and fences two seconds early. A lease is bound to a fresh in-memory daemon session, so a disk-cloned or restarted node cannot reuse it. Whole-host pauses and hostile hosts are outside its guarantee. - Automatic scaling is off by default. When on, it grows one fitting host after two room refusals, releases hosts one region at a time with healthy survivors, and never releases a manually owned, lost or unknown host. - The autoscaler orders hosts of the machine the served `hermitboxd` is built for, read from its ELF header, and orders none when that binary is missing or for another machine. - A sandbox kept to one node (a stack copy's fork) stays on it through every wake, restore and move, and is refused where that node cannot take it, because its prepared files might be native to that node. ## Node protocol and formats - The Rust types define the node protocol, and `openapi/` is generated from them. The public API (`/v1`) and the edge protocol (`/edge/v1`) are committed with their OpenAPI documents and generated clients. - Before the first public release, a format change updates its producers, consumers, generated clients and fixtures together. From the first public release, changes within a major version are additive. - A node announces each new request field in `features` before control sends it, and an absent announcement reads as an absent guarantee, so control never sends a node a field it would ignore. - The `blocklyd` names on the wire and on disk (the epoch header, the `blocklyd.*` container labels) are frozen format names. `tests/formats.rs` and `tests/fixtures/` pin those formats byte for byte. - The node records the tier it chose at creation and requires it on reads; the public sandbox and both SDKs report it as `isolation`. - A value owned by another system is imported from it: HTTP statuses from `StatusCode` and `http-status-codes`, signals from `libc`, durations in TypeScript from `control/src/durations.ts`. Docker's answers are read once, in `runtime/docker.rs`. - Control validates requests with Zod and generates the public OpenAPI document from the same schemas; the SDKs take their types from that document through openapi-typescript. - Create identity and request fingerprints are stored before placement. An exec with an uncertain outcome is never replayed, so a lost reply cannot run a command twice. - Each container gets its own Ed25519 signing key, and only the public key reaches control and edge. Sandbox capabilities last five minutes and bind sandbox, epoch, scope and bounds; file capabilities last one minute and name one path and method; edge capabilities name one route. A project key is never sent to a sandbox. - Errors use the node envelope `{error:{code,message,details}}`, and a refusal for a missing guarantee carries the missing names as typed data. ## Isolation and security - The hardening is the host's. A request can narrow host policy but never relax it, and a deployment's requirements are combined with each request's, so a request cannot erase them. - A request that names a tier or a guarantee gets it or a refusal naming what is missing. Hermitbox chooses a backend only when the request leaves the choice open, and reports the choice. - API and operator listeners bind to loopback by default. Remote clients reach the API through TLS, and workload ports are reachable only from the configured control and edge sources. - A node accepts a client certificate only when its leaf states the clientAuth extended key usage, because RFC 5280 otherwise lets a general-purpose certificate from the same CA pass. - TLS in `hermitboxd` is rustls with ring, and OpenSSL, native-tls and AWS-LC are banned in `deny.toml`, so no host carries an OpenSSL to patch. - The agent marks its supervisor non-dumpable before it loads secrets, keeps its signing secret in a randomly named bootstrap variable that no child inherits, and refuses a bootstrap executable that another user can write or that sits behind a writable or symlinked ancestor. - Node and agent share one descriptor-relative, no-follow path walk that refuses absolute paths, parent traversal and symlinked parents, so no file operation follows a link. - Control seals sandbox secrets at rest in sandbox, snapshot and template records with AES-256-GCM from a versioned key ring (`HERMITBOX_SECRET_KEYS`). The authenticated data binds purpose, record type, project and record ID, so a copied value opens nowhere else. - Every stored digest of something that holds secrets is an HMAC-SHA256 under a key derived from the provider seal key, so the database alone cannot test a guess. A record whose secrets do not open fails alone, and stopping or deleting a sandbox does not need to open them. - Webhook signing secrets are derived from the operator seal key and shown only on creation. Delivery uses pinned public DNS with redirects off, and only operator configuration can allow a private receiver. - Embedded Postgres requires SCRAM on its Unix socket as well as TCP, because Landlock does not restrict Unix socket connections. - Git credentials go through a one-call, HTTPS-host-scoped credential helper, with redirects, hooks and every trace destination disabled, so a token is never written to a file. - `hermitboxd serve` sets memory-deny-write-execute on its own process. The systemd unit leaves MemoryDenyWriteExecute off, because every process the unit starts would inherit it. - Browser sandboxing and FUSE need user namespaces the host approves. They are host-local opt-ins: a request can never grant a privilege, and CAP_SYS_ADMIN is never given in a container's own namespace. A host with native FUSE requires a non-root sandbox user. - On AppArmor hosts, the `hermitbox-native-tools` profile is Docker's default profile with only its mount denial replaced. FUSE needs an administrator-selected, loaded, enforcing profile, and there is no fallback. - Diagnostics and failure logs redact credentials, token patterns and private-key blocks, and a secret is never put in a label, an argument vector or a stored record in the clear. - Docker's OOM flag comes from its runtime event, so OOM is never inferred from a SIGKILL alone. Where systemd 255 or newer is present, its journal can confirm an OOM; missing or ambiguous evidence reads as unknown. ## Tiers and runtimes - There are five tiers: `container`, `gvisor`, `vm`, `process` and `wasm`. A request that names none is placed in the order container, vm, gvisor, process, wasm on a healthy node; images start only on container, gvisor or vm. - `HERMITBOX_DEFAULT_ISOLATION` fixes one tier or gives an order as a comma-separated list. The chosen tier is stored before compute is created, and a later ensure never changes it. - A mixed node announces each guarantee per tier (for example `tier-process:egress-hostnames`), so control never assumes one tier's guarantee for another. - Each backend must answer its own health check. An unreadable tier keeps its records and reports partial inventory; it never changes a saved tier. - Container engines are found in a fixed order: environment, system Docker, user Docker, user Podman, system Podman. An explicit socket never falls back, and remote engine endpoints are refused, because local data binds cannot reach them. - The engine API is negotiated through Bollard, and native Podman calls use Podman's generated stubs, so no engine protocol is written by hand. Native Podman gives each workload its own Netavark network. - A rootless engine's memory and CPU guarantees are bounded by what the engine enforces for that copy. `allowUnenforcedMemory` is an explicit acceptance; without it a missing limit is refused. - The `gvisor` tier is the container backend with runsc as its OCI runtime: the same engine, images, limits, ports, bridge and firewall. A request for `container` runs only on runc and one for `gvisor` only on runsc; neither falls back to the other. - A node serves `gvisor` only beside a container tier of the same engine and while that engine lists runsc; Podman and rootless Docker are refused by name until their cgroup enforcement is proved. FUSE and the browser's own sandbox stay off on gVisor until proved there. - Each runsc version is installed in its own directory and kept while a running sandbox needs it, so an upgrade never changes a running sandbox's runtime. - gVisor's kernel gets a hard nproc limit beside the host's pids cgroup, because the host controller counts gVisor's own threads rather than the workload's processes. - A gVisor exec's completion is authenticated with a fresh HMAC key on private stdin, and the in-sandbox exec deadline wrapper is a subreaper that kills and reaps what it adopts. - The process tier is its own runtime behind the same runtime trait. It uses the bundled userland, Landlock (ABI 3 or newer, or it fails closed), a seccomp deny filter layered on the platform's, rlimits and nice, and no namespaces in its plain mode. - The process seccomp filter refuses namespace clone flags, `pidfd_getfd` and reuse-port BPF filters, so a same-UID neighbour cannot be reached around Landlock. - The process tier allocates stable UIDs from host policy when the daemon can change UID, and announces a shared UID otherwise. In shared-UID mode, pathname-only IPC is refused and private IPC needs Landlock's abstract-socket scope. - The namespaced process mode uses the unmodified bubblewrap helper, never setuid. A node announces `tier-process:private-pids` only from the launch it performs, and a namespaced launch whose helper fails fails; it never starts plain. - Process-tier limits live in a cgroup per sandbox below the daemon's delegated cgroup. Sleep freezes that cgroup and kill uses `cgroup.kill`, so nothing that escaped the tree survives. - The process tier's network policy is a set of cgroup BPF programs loaded with aya. The `kernel-network-policy` capability is proved by loading and attaching every program in a disposable cgroup, never read from configuration; when it is off, the node says what is missing. - With public internet on, a process sandbox reaches what a container reaches behind the host firewall: everything except this host, link-local, multicast and private addresses. The policy refuses inet sockets other than TCP and UDP and is reported as the `host-firewall` guarantee. - The BPF object is committed, and CI rebuilds it with pinned packages and requires the same bytes, so the object is reviewed as its source. It needs no CO-RE relocation, because it reads only UAPI context fields. - The `wasm` tier wraps agentOS: its Rust client and native sidecar pinned at the same version, because the protocol requires matching versions. The sidecar runs as a separate child process under its own worker identity. - A wasm sandbox's root is chunked SQLite under its data directory and its data mount is a host directory, so snapshots carry both. The shared sidecar has no per-VM suspend, so processes end on sleep while files persist. - The `vm` tier runs each sandbox in a Firecracker microVM with its own kernel. KVM is mandatory, and a node announces the tier only where KVM works for its user and a signed bundle is present. - A VM boots trusted init as PID 1 from a read-only EROFS image, and init runs the agent as a non-root child in its own cgroup. Bootstrap configuration and secrets arrive only over vsock, into memory, never on a disk, label or argument. - An OCI image becomes digest-named EROFS layers (at most 13) with a sized ext4 upper, and a VM's manifest digest is pinned at its first start, so later starts use exactly the same image. - As an ordinary user, a VM's network is gvisor-tap-vsock in a confined packet helper, chosen over pasta because it needs no host user namespace or TUN device. The helper refuses every destination the host itself would receive. - As root, VMs are served by `hermitboxd-vm-worker.service`, because the daemon's own unit keeps no devices, namespaces or network-administration capability. Each root monitor runs under the jailer with a uid and gid of its own, and its network is a CNI TAP behind a default-drop bridge. - VM memory sleep uses Firecracker's full snapshots only, because its diff snapshots are a developer preview. A memory image records its host class and monitor digest and restores only on a match; otherwise the disk boots cold. - A wake renames a memory image before loading it, so one image is never restored twice. Guest init sets the clock and mixes host entropy on resume, because the guest kernel has no VMGenID. - Cloud Hypervisor is not added as a second monitor: its live migration still needs the disk at the same path on both hosts, and Hermitbox's VM disks are local files that must be copied anyway. - The VM monitor is built from Firecracker's source with a static GNU C library toolchain, so its C library matches the launcher's confinement, and its seccomp policy is derived from Firecracker's published one. - Releases are built for x86_64 and aarch64. The process tool bundle and the VM bundle are x86_64's for now, so native tools and `vm` report themselves off on aarch64 with the reason; `wasm` is off there too, because the pinned sidecar is x86_64's. ## Sandbox features - The agent runs processes with their own identities and process groups, bounded replay and bounded queues, so a disconnected client does not own a process's life. - Exec, logs, terminals and files go through the agent and edge; persistent data is still reached through the node's file routes while compute is stopped or sleeping. - Every exec a Hermitbox client starts has a deadline by default, and the agent refuses one longer than its token allows. - Terminals use portable-pty, and the agent embeds the Brush shell as a fallback when an image has no `/bin/sh`, so shell execution never needs an image utility. - File transfers stream through bounded spools and chunks, JSON file reads keep a 1 MiB bound, and sync is an upsert by SHA-256. Chunked writes to one path are serialized by an advisory lock. - Sandbox names are unique in a project while data exists; a name-only lookup finds the sandbox, and an option with a source creates one. - Lifetime changes (TTL, idle, auto-delete) serialize with lifecycle operations and stay within project ceilings. - Templates are built through the sandbox's own files and commands, snapshotted only after ready succeeds, and warmed on each eligible node that advertises the template's tier. - SSH uses short-lived Ed25519 client keys made in agent memory, ephemeral host keys and public `authorized_keys` only. A lease ends at the earliest of token expiry, five minutes and the idle interval, and the CLI passes keys to ssh-agent on stdin, never through a key file. Managed SSH servers set `Compression no`, because the bundled OpenSSH offers only delayed compression after authentication. - S3 mounts use a trusted mount worker in its own mount namespace. Mount credentials are sealed before creation, delivered by a scoped agent request and left out of every view. - Browser, desktop and interpreter kernels wrap maintained programs (Chromium's headless shell, Xvfb with xdotool, x11vnc with noVNC and websockify, ipykernel and IJavascript), so Hermitbox implements no browser, X11, RFB or kernel protocol. IJavascript is the JavaScript kernel, because it returns structured results and errors where other kernels print them as console text. - Process-tier tools use host glibc and never ship one. The core browser and kernel bundle needs glibc 2.34 and the desktop 2.36, and an older host gets a refusal naming the minimum. - The native tool bundle uses unmodified upstream runtimes (python-build-standalone, Node's official tarball, Chrome's headless shell) with small launchers, instead of rewriting binaries. - The browser runs in a pre-confinement worker under bubblewrap with private user, PID and mount namespaces, and Chromium's own sandbox stays on. - No image contains Chromium's Widevine module, because its terms forbid redistribution; images use only the open-source headless shell. - MCP is optional, behind the CLI and the agent's `mcp` build feature. Sandbox MCP uses only the sandbox's scoped capability and has no fleet or project-key client. - Coding-agent sessions use the agent's PTY API. A supplied session key keeps the session out of automatic VM placement, because VM sleep can write guest memory to a file. ## Storage, snapshots and transfer - Snapshot and fork copy persistent files, not memory, except that a VM fork on one node can take its source's memory image. - A node-local snapshot restores only into its own workload; a fork waits for the source's upload and uses the stored archive. - An archive upload that finishes after its snapshot was deleted cannot bring it back, because completion needs an uploading row. - A restore stages the whole copy and checks it before it touches current data, and locks source and target in ID order until publication. - Snapshot count is reserved before copying and bytes are checked against project limits before publication; a refused copy is discarded and the source resumes. - XFS reflink shares unchanged blocks; elsewhere a full copy is made, and sparse holes are kept. - A store's refusal is reported with its HTTP status and S3 error code, so the caller and the node log name the cause. - The one-box and image presets include a persistent S3 store (RustFS) beside Postgres, because snapshots and rest need object storage. - VM disks are copied only after an orderly stop and a read-only fsck, while holding the VM's lifetime lease. A stopped VM's data is read through a separate file-only guest with no image, network or entrypoint. ## Network and edge - The edge is the public entry point. It reads TLS SNI, the HTTP Host header or a dedicated TCP port, holds bytes while control wakes a sandbox, and then relays them; applications see no platform greeting. - Route versions come from the database, not host clocks, and the edge enforces sandbox epochs on live connections. - The edge buffers at most 64 KiB while it waits, shares one wake per sandbox and keeps backpressure after splicing. Its default greeting wait is five seconds, below the shortest client TLS timeout measured. - Public raw TCP ports are allocated under an advisory lock and quarantined for ten minutes after release. Public UDP is refused, because the fronts are TCP. - A relay strips hop-by-hop response headers, as RFC 9110 section 7.6.1 requires. - API TLS is served by a separate Caddy. The edge keeps the public listener and hands the API hostname's TLS to Caddy over a service-owned Unix socket, and Caddy owns certificates. - Control makes its own agent calls through the edge's private socket, so readiness does not depend on public DNS or NAT hairpinning. - Agent hostnames are terminated with an operator-supplied wildcard certificate; other TLS routes pass through unchanged. - Hostname egress gives each sandbox its own bridge, firewall rules installed by root, and unprivileged HTTP and TLS gateways on that bridge that resolve the permitted Host or SNI at each connection. - An egress policy holds DNS too: the bridge's gateway answers only names the policy allows and refuses the rest. - Every hostname gateway, on every tier, refuses raw IP addresses, non-public answers and names that resolve to an address of this host, including cloud metadata addresses. - Address rules (`egressAddresses`) are placed only on a tier that announces `egress-addresses`, and are refused on an isolated network. - The process tier follows the host's addresses through rtnetlink, so rules naming this host stay current, and a hostname gateway asks the kernel how a destination is routed before dialling it. - The container firewall covers both the ordinary and the internal Docker bridges, and the internal bridge has inter-container communication disabled. ## Control plane - A deployment has projects. Keys are stored as hashes, each key names its project, and every list and route is scoped to it, so a foreign ID answers 404. - Each project limit has its own column. Deployment defaults come from `HERMITBOX_PROJECT_`, a project value overrides them, and null restores inheritance. - Resources are whole units (512 MiB and 250 CPU millis by default), so admission counts one thing. A unit's CPU is an admission reservation; a ceiling is enforced only where a tier announces `cpu-limit`. - Quota is decided in short project transactions. Compute reservations are written before node work and released only on a confirmed stop. - Public addresses are allocated in the same transaction as accepted quota and sandbox intent, so a refused request reserves nothing. - Lowering a limit freezes excess usage but keeps data readable; project expiry revokes keys and deletes data. - Operator routes live on a private listener with their own authentication; nothing operator-only is on the public listener. - Control serves a Prometheus registry on the operator listener and opt-in OpenTelemetry tracing. Labels use route patterns, and traces exclude bodies, URLs and credentials. - The welcome page is served by control's own listener and keeps an entered key only in page memory. - The documentation site is static with local search, built from `docs/` and published only by an explicit maintainer step. - The capability page (`docs/reference/capabilities.md`) lists Hermitbox's own capabilities, each linked to the code or document that implements it, and names no other product. ## Installation and hosts - Installing is one command that asks nothing. The installer detects the host and takes its preset: an ordinary user, a container, a server with root, a platform that runs images, or a node joining a fleet. - Every preset checks its first download against a digest embedded in the installer, and server installs verify an ML-DSA-65-signed manifest before they use any service binary or archive. - Root, Docker and KVM add tiers, and none is needed to start. The ordinary-user preset uses an available local engine, then the process tier, then wasm when process confinement is refused. - A user installation keeps its files under the caller's home, following the XDG Base Directory Specification, and runs as systemd user services without interactive authorization. A user installation adds the CLI to the owned shell profiles in one removable PATH block. - A host bundle carries its programs' runtime libraries and loader, so neither host glibc age nor a different C library becomes an installation step. - Bundles are authenticated with the release keys and staged privately before activation; archive links and special file modes are refused even after verification. - An upgrade is authenticated before services stop, keeps previous bundle directories for running agents, and refuses a PostgreSQL major-version change. - The first API key is printed once. A first-key marker is claimed atomically before it is shown, and a later run prints a reference to the key instead. - The server preset keeps workloads on Docker with private network, private PIDs, and memory and CPU limits as its floor, and installs gVisor itself from the pinned release. - Under Ubuntu's unprivileged user-namespace restriction, the server preset loads the AppArmor profile the namespaced tiers need and widens the daemon's unit to exactly those namespaces, rather than adding a privileged helper. - The release image bundles control, edge, node, agent, a Debian userland, Node, Python and build tools. Embedded Postgres and S3 listen on loopback, and external database and S3 settings override them. The image uses one state volume and serves the API and agent traffic on one HTTP front, leaving TLS to the platform. - Each hosting platform gets a deployment shape that keeps state: a Render Blueprint, a Fly configuration, Railway and Coolify templates, Koyeb service fields, and cloud-init for a DigitalOcean machine, because App Platform has no persistent volume. A platform-supplied bootstrap key (`HERMITBOX_BOOTSTRAP_API_KEY`) is used without being stored or logged. - `install.sh` takes HOME from the account's passwd entry when started without one, as cloud-init and other system services start it. ## Releases and CI - A release is a pull request that raises `version` in `Cargo.toml`. `release.yml` tags and publishes it once CI passes on that commit of `main`, and both architectures and the tag are built from that commit. - Each architecture is built natively on its own runner, with no cross-compiling or emulation. x86_64 file names keep their original names, and aarch64 files add the machine after the stem. - Control, edge, the CLI and the SDKs release with the daemon, from the same tag. - The template images are built, pushed and attested in their own job after the GitHub Release is published, from the same commit and at its version, so a slow or failing template never holds back the binaries, the install line or the main image; a failed template fails the run and is built again by re-running the failed jobs. - A commit is a release only when it raises the version over its parent's, so a root commit, or a commit that changes anything else, never publishes; the version step reads the parent's `Cargo.toml` itself. - `title.yml` checks a pull request's title (50 characters or fewer) and that its title and body mention nobody, on every open, edit and push, because CI's pull request runs don't start on an edit; main's ruleset requires it beside `proof`. - `curl -fsSL https://hbx.sh | sh` is the install command, always written with `https://` (a bare host makes curl fetch over plain HTTP, where the script could be replaced before any redirect): the `hermitbox-get` Worker (`infra/get/`) passes the newest release's own `install.sh` through unchanged, `/v` a pinned one, and with no such release, or when GitHub errs, answers a script that fails with the reason (an HTTP error would leave `curl -f | sh` running nothing and succeeding); a short name because the install line is the first thing anyone types. - `measure.yml` measures the current build alone; a comparison is made against a released version, never a historical commit checked out by hash. - `proof.yml` posts a `proof` status from the newest dispatch of each of the four proving workflows on a commit. Main's ruleset requires `proof`, a pull request, and no force-push or deletion, because a skipped job counts as passed and so cannot carry this. - A proof counts for every commit with the same git tree as the commits its runs were dispatched on, since equal trees are byte-identical content; a run's tree comes from its `head_commit` so the look back over the newest 300 dispatches costs no extra calls, and only a dispatch of `proof.yml` from the default branch with `sha` posts it for a commit that has no runs. - A quick push or a pull request runs only the suites its changed files reach. A file nobody named reaches every suite, and a job outside them still runs and passes with its steps skipped. - A worker branch's proof (a dispatch of the four proving workflows on it) runs only the suites the files it changed since it left main reach: `scripts/changed-suites.sh` also answers for CI's acceptance, Any host, VM experiments and Rootless engines, and a workflow it doesn't reach runs only its `changes` job and reports success, which `proof.yml` counts, because a docs-only proof took about an hour. Each answer follows what reads the file: TypeScript reaches Any host because the CLI and the host bundle compile control's and the SDK's sources, the VM runtime's files are the ones VM experiments' pull requests already name, and main's pushes still run everything but a version alone (below). - A proof, or a push to main, whose change only raises the version (`scripts/version-only.py`, against the same base `changed-suites` uses) runs the release's builds and version checks alone: CI's workspaces in full (the CLI's build, `release:check`, `openapi:check`, `docs:check`), the VM image helper built `--locked`, the committed OpenAPI documents against the types (the agent's carries the crate's version), Acceptance's build of the daemon and release image with the version their programs say, and Any host's host bundle build; the acceptance, end-to-end, bundle acceptance, VM experiment and rootless engine suites skip, because a release proved about an hour of suites that had passed on its parent and a version string reaches none of them but through those checks. - Version-only is read from content: every changed line is one of the listed version fields moving to Cargo.toml's new version, and every required field says it afterwards, so a release that leaves one behind runs everything; the docs' image tags and bun.lock's workspace version are optional, because nothing reads them as the release. A file the list doesn't name is never version-only, and `version-only.test.ts` fails when a tracked file names the image or the Action by version outside the list. - Main takes the short set only when the newest push run of each of the four workflows on the parent commit succeeded; anything else, the API's answer missing included, runs everything. - A newer push to main cancels the older push's runs in progress in Any host, VM experiments and Rootless engines, but never CI's: release.yml publishes only after CI passes on the release commit, and an Actions push payload doesn't list the changed files, so a release push can't be told apart by its files. Main's schedule and dispatches keep a group apart from its pushes so a push never cancels them. - Any host, VM experiments and Rootless engines run `changes` on every run but a worker branch's push, because a skipped `changes` skipped every job that waits on it by default, which left main's Any host pushes and schedule without the bundle and its acceptance. - Rust jobs compile through sccache from a cache that only pushes to main publish; branches, pull requests and dispatches read it. - Every build of the release image goes through buildx with GitHub Actions' cache backend, one scope per target and machine, on a builder of its own so a job's other `docker build`s keep the default one. Only main's pushes save a cache, so a branch reads main's and never replaces it; Any host's release-build also saves within a run, for that run's bundle job. The release only reads: its commit is one main's push already built and saved. The Dockerfile compiles the dependencies from the manifests alone before the sources arrive, a plain manifest-first layer rather than cargo-chef, which would add a dependency for the same layer. - Control's end-to-end suites run in 4 shards balanced by bun's `--timings` from `.github/e2e-timings.json` (per-file durations a CI run measured), and the acceptance steps that read none of their output run in their own job beside them, because one runner took them in series for over two hours on every proof. - `.github/e2e-timings.json` is refreshed by copying over it the `control-e2e-timings` artifact of a CI run on main (the end-to-end measurements job merges every shard's measured per-file durations into it), when the shards' times drift apart, because bun balances by the recorded durations and a stale file put 31 of the suites' 97 minutes on one shard. - `release.ts check` fails, naming the file, when a committed `Cargo.lock` lists `hermitboxd` or `hermitbox-agent` at another version than Cargo.toml's, because a release that missed `vm-image/Cargo.lock` was caught only by the VM build. - Any host's bundle runtime acceptance runs as five jobs at once instead of one that took 29 minutes: the tool checks with the Python cohort, the browser and JavaScript cohorts, the desktop and SSH cohorts, the installed VM, and the release image's userland, each fetching only the inputs it reads. A cohort stays whole on one runner, and a runner that times without the tool checks first warms each cohort with one untimed sandbox, so every sample is still taken with the bundle cached. `native-evidence` joins the parts into the `installed-native-tools` artifact, each part's files in its own folder beside one startup report; the job fails when the runners' host facts differ, since the report states its host once, or when a cohort is short. - The cloud-init boot matrix runs in its own CI job beside the one-box install, one runner per distribution of `deploy/platforms/cloud-init/images.json`, each preparing the same unreleased artifacts as the one-box job and booting QEMU on the hosted runner's real KVM device, because two emulated boots in series on the one-box runner took 46 of its 52 minutes on every proof. - Every pinned build input is fetched under one retry policy and checked against its digest, so a registry outage gets a retry, never a rerun until it passes. - The documentation is served by the `hermitbox-docs` Worker (`infra/docs/`) over Workers Static Assets: pages stay under `/v/`, an address without a version goes to the same page of the version the Worker was built with, and `/llms.txt` and `/llms-full.txt` answer with that version's files so agents have one stable address. Every host but docs.hermitbox.dev answers with `X-Robots-Tag: noindex`, so the workers.dev preview is never indexed. - Every documentation page carries the agent panel (the install line, the copy-prompt and a link per agent to `docs/get-started/agents.md`), a Markdown twin at its route plus `.md` linked with `rel="alternate"`, and the site has `llms.txt` and `llms-full.txt` after llmstxt.org, all generated at build from the canonical Markdown (`site/tools/llms.ts`) so they never drift from the pages. - `docs/get-started/agents.md` uses only each agent's documented install form (Cursor's install link, `claude mcp add`, `code --add-mcp`, `codex mcp add`), points at `~/.local/bin/hermitbox` because agents started from a desktop might not have it on `PATH`, and says ChatGPT has nothing to add until a public MCP endpoint exists, since `hermitbox mcp --http` is loopback-only. - A pinned build input whose digest CI knows is read first from the input mirror at cache.hbx.sh (`infra/cache/`, a Cloudflare Worker over R2 keyed by SHA-256), then from its upstream, because upstream outages caused most of CI's flaky failures. The mirror is untrusted by design: a reader keeps only bytes that match its pinned digest, and a miss, an error or other bytes go upstream at once without spending the retry budget. - Only main's push runs write to the input mirror, authenticated by the run's GitHub OIDC token (issuer, audience, repository, ref and event checked in the Worker), so no credential is stored anywhere. A write is kept only when its bytes hash to the digest it is written under, and an input over Cloudflare's 100 MB request body limit stays upstream-only. - The mirror's Worker checks the token with jose's `jwtVerify` and `createRemoteJWKSet`, restricted to RS256, GitHub's issuer and the mirror's audience, and checks the run's repository, ref and event itself; it hashes an upload with Workers' DigestStream as it streams, because a 100 MB body buffered whole does not fit a Worker's 128 MB of memory. - A stack in a user's project (`templates/stacks/`) never reads the input mirror: it reaches only the upstreams it pins. - The native tool image's archives (`templates/native-tools/artifacts.json`) reach its build cache through `templates/native-tools/inputs.py` under the same policy, in CI and in the release alike, because the release's in-build download had neither the mirror nor a retry. - Every request to the input mirror and to a pinned upstream names Hermitbox and its repository in its User-Agent (`archive_retry.USER_AGENT`), because the Browser Integrity Check in front of hbx.sh refuses urllib's own `Python-urllib/x.y`. - Ubuntu test fixtures try an ordered list of signed mirrors until one serves every index; apt's signature checks keep the plain-HTTP mirror safe. - `hermitboxd`'s dependencies pass `cargo deny`, `Cargo.lock` is committed, and every build runs with `--locked`, because the daemon runs as root on every node. - Every signature Hermitbox verifies for a release, a join bootstrap or a host bundle is ML-DSA-65 (FIPS 204), under the rule that every key Hermitbox holds is post-quantum; the keys that are not yet (sandbox capabilities, the fleet CA and node certificates, the mutual TLS key exchange, SSH) are listed in threat-model.md. A node and the CLI refuse a release key of any other algorithm, naming it. - `release.yml` and the preview workflows sign and check with Bun's node:crypto (`control/tools/release-sign.ts`), because the runners' OpenSSL 3.0 has no ML-DSA; the private key is read from the environment, never from a command line. ## SDKs, CLI and integrations - The TypeScript and Python clients read `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` when `url` and `key` are not passed; passed values win, and with neither the error says what to set. Additive before the first stable API; the TypeScript client reads the environment only where a process environment exists. Published examples pass neither from v0.2.1, the first release that carries the default, and install its SDK packages. - The SDKs expose sandbox and snapshot handles over a thin generated transport, and generate defaults and duration units from the control contract. - TypeScript `run` uses native promises and asynchronous Python uses eager asyncio tasks. Collected output is bounded by the agent's capture limit while streams keep receiving. - The SDKs generate default idempotency keys for create, fork and exec, and keep caller-supplied keys. - The Python SDK closes a process stream at the protocol's exit event, so a finished command never waits for an intermediary to end the body. - Every installer and the CLI find the client credential file through one function: an explicit path, else the user's configuration directory. - `hermitbox create` tries the tiers in order and deletes each attempt a tier refuses. - Framework adapters (AI SDKs, agent frameworks) are optional, separate entry points; their tests use scripted models, so none needs a model account. - Integrations with Rivet, sandbox-agent, celld and OpenOrange are separate packages that talk to Hermitbox over its public API and never bundle the other project's code. - The GitHub Action is a thin shell over the CLI; an empty image input selects the default tier. - Coding agents install in the user's sandbox from pinned upstream packages; Hermitbox ships the recipes and no agent binaries. ## Third-party software and licences ### Policy - Hermitbox wraps maintained open-source programs at pinned versions and records each licence here before use. Each pin is checked against its publisher's digest or signature. - Copyleft programs (GPL, LGPL, and MPL where noted) run as separate, unmodified programs and are never linked or copied into Hermitbox. Images and bundles keep every upstream notice, and corresponding sources, recipes and patches ship as separate source assets. - `hermitboxd`'s Rust dependencies can use only Apache-2.0, Apache-2.0 WITH LLVM-exception, BSD-3-Clause, ISC, MIT, Unicode-3.0 and Zlib (`deny.toml`), so its binary carries no obligation beyond its own licence and the notices. - `deny.toml` grants four narrow exceptions, each for one locked crate: notify 8.2.2 (CC0-1.0), terminfo 0.9.0 (WTFPL, the embedded shell's terminfo parser), webpki-roots 1.0.11 (CDLA-Permissive-2.0, Mozilla CA data; its licence and notice ship with the image and release, `deploy/webpki-roots.NOTICE`) and option-ext 0.2.0 (MPL-2.0, an unmodified file-level dependency of the Jupyter client; its source and licence are linked in `interpreter.md`, and no source is vendored). - webpki-root-certs 1.0.12 (CDLA-Permissive-2.0, the same terms) is selected only for other platforms and is absent from the shipped Linux graph. - RUSTSEC-2026-0543 (chrono unmaintained) is the one ignored advisory, because the maintained shell, Jupyter and agentOS releases still require chrono. - Inventories of resolved packages and their notices: [interpreter base](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/interpreter-base.json), [Python interpreter](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/python-interpreter.json), [Node interpreter](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/node-interpreter.json), [Node canvas](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/node-canvas.json), [browser](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/browser.json), [desktop Python](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/desktop-python.json), [native tools (Debian)](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/native-tools-debian.json), [Playwright](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/playwright.json), [rclone modules](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/rclone-modules.json), [standalone Python](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/python-standalone.json), [micromamba builder](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/micromamba-builder.json), [earlier conda-forge prefix lock](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/conda-prefix.lock.json) and [VM kernel configuration inspection](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/firecracker-kernel.json). ### Rust crates linked into `hermitboxd` and the agent - agentOS client 0.4.7 (Apache-2.0), pinned with its sidecar. - Jupyter: jupyter-zmq-client 3.0.1 and jupyter-protocol 2.0.3 (BSD-3-Clause) and zeromq 0.7.0 (MIT), with async-io 2.6.0, concurrent-queue 2.5.0, futures-lite 2.6.1, parking 2.2.1 and polling 3.11.0 (Apache-2.0 OR MIT); asynchronous-codec 0.7.0 and redox_users 0.5.3 (MIT); crossbeam-queue 0.3.14, crossbeam-utils 0.8.23, dirs 6.0.0, dirs-sys 0.5.0 and hermit-abi 0.5.3 (MIT OR Apache-2.0); saa 5.6.2, scc 3.8.8 and sdd 4.8.11 (Apache-2.0); sha1_smol 1.0.1 (BSD-3-Clause); and option-ext 0.2.0 (MPL-2.0, exception above). - SSH keys: ssh-key 0.6.7 (Apache-2.0 OR MIT), Ed25519 generation only, with base16ct 0.2.0, base64ct 1.8.3, const-oid 0.9.6, crypto-bigint 0.5.5, der 0.7.10, ecdsa 0.16.9, ed25519 2.2.3, elliptic-curve 0.13.8, p256 0.13.2, p384 0.13.1, p521 0.13.3, pem-rfc7468 0.7.0, pkcs1 0.7.5, pkcs8 0.10.2, primeorder 0.13.6, rfc6979 0.4.0, sec1 0.7.3, signature 2.2.0, spki 0.7.3, ssh-cipher 0.2.0 and ssh-encoding 0.2.0 (Apache-2.0 OR MIT); cipher 0.4.4, hmac 0.12.1, inout 0.1.4, num-iter 0.1.46, rand_chacha 0.3.1, rsa 0.9.10, rustc_version 0.4.1 and semver 1.0.28 (MIT OR Apache-2.0); curve25519-dalek-derive 0.1.1, ff 0.13.1, group 0.13.0 and num-bigint-dig 0.8.6 (MIT/Apache-2.0); curve25519-dalek 4.1.3 and ed25519-dalek 2.2.0 (BSD-3-Clause); fiat-crypto 0.2.9 (MIT OR Apache-2.0 OR BSD-1-Clause); spin 0.9.9 (MIT); and chrono 0.4.45 (MIT OR Apache-2.0). - Shell and terminals: Brush (brush-core 0.5.0 and brush-builtins 0.2.0, MIT) and portable-pty 0.9.0 (MIT). - Host and kernel interfaces: nix 0.32.0 (MIT; 0.31 stays as brush's own dependency) and rustix for namespaces and mounts; Landlock 0.4.8 (Apache-2.0 OR MIT); procfs 0.18.0 (MIT OR Apache-2.0), so no kernel format is parsed by hand; linux-raw-sys 0.12.1 (under its MIT option) for UAPI constants; seccompiler 0.5.0 (Apache-2.0 OR BSD-3-Clause); object 0.39.1 and 0.40.0 (Apache-2.0 OR MIT) for ELF headers. - eBPF: aya 0.16.0 and aya-obj 0.6.0 (MIT OR Apache-2.0), chosen over libbpf-rs because libbpf links libelf (GPL-2.0-or-later OR LGPL-3.0-or-later); aya reads the clang object in pure Rust. - KVM: kvm-ioctls 0.24.0 (Apache-2.0 OR MIT), kvm-bindings 0.14.0 (Apache-2.0) and vmm-sys-util 0.15.0 (BSD-3-Clause), so no ioctl number or structure is copied. - Engines and images: Bollard 0.21.1 (Apache-2.0); podman-api-stubs 0.9.0 (MIT), because the podman-api 0.11.0 SDK depends on an unmaintained crate; oci-spec 0.10.0 (Apache-2.0), whose reference parser also matches allowed-image prefixes. - Networking: hyper and h2 (MIT) for HTTP/2 CONNECT streams, tokio-util (MIT) framing, Tokio (MIT) and Axum (MIT); tokio-vsock 0.7.3 and vsock 0.5.5 (Apache-2.0) with memoffset 0.9.1 (MIT); hickory-net and hickory-proto 0.26.3 (MIT OR Apache-2.0, MIT selected) for upstream DNS; rtnetlink 0.24.0 (MIT); ipnet 2.12.2 (MIT OR Apache-2.0, MIT selected); percent-encoding 2.3.2 (MIT OR Apache-2.0). - TLS and crypto: rustls with ring 0.17.14 (ISC and Apache-2.0, with MIT notices); x509-parser 0.18 (MIT OR Apache-2.0) to read the clientAuth extension; webpki-roots 1.0.11 (exception above). - Release signatures: ml-dsa 0.1.2 (Apache-2.0 OR MIT), RustCrypto's pure-Rust FIPS 204, because ring has no ML-DSA, with its SubjectPublicKeyInfo reader: pkcs8 0.11.0, spki 0.8.1, der 0.8.3, pem-rfc7468 1.0.0, signature 3.0.0, module-lattice 0.2.4, shake 0.1.0, keccak 0.2.2, sponge-cursor 0.1.0, ctutils 0.4.8 and cmov 0.5.4 (Apache-2.0 OR MIT). - Other: uuid 1.29.3 (MIT OR Apache-2.0); flate2 1.1.11 (MIT OR Apache-2.0) with miniz_oxide 0.9.1 (MIT OR Zlib OR Apache-2.0), and zlib-rs 0.6.8 (Zlib) locked; notify 8.2.2 (CC0-1.0) and terminfo 0.9.0 (WTFPL), both exceptions above; OpenTelemetry API, SDK and HTTP adapter 0.33.1 (Apache-2.0). - The VM image helper is its own workspace (`vm-image/`): oci-client 0.18.0 (Apache-2.0) with reqwest 0.13.5, http-auth 0.1.10, olpc-cjson 0.1.4, rustls-platform-verifier 0.7.1, rustls-native-certs 0.8.5, openssl-probe 0.2.2 (it locates host trust data and links no OpenSSL) and unicase 2.10.0, under MIT, Apache-2.0 or ISC. ### Container and gVisor tiers - gVisor runsc release-20261109.0 (Apache-2.0), pinned by its published SHA-512 in `deploy/gvisor.json` with its sidecar programs, registered as the engine's OCI runtime; release-20261102.0 is the upgrade test's previous version. - Docker Engine, CLI and BuildKit (Apache-2.0) and Podman (Apache-2.0) are external engines. CI pins Docker 29.9.2 with RootlessKit 3.3.0, and Ubuntu's Podman 4.9.3+ds1-1ubuntu0.2. - The release image bundles Debian's Docker and nftables clients as separate programs, with their Debian source versions and licences in the runtime inventory. - The AppArmor profile derives from moby/profiles at `4b8214f` (Apache-2.0); AppArmor's parser (GPL-2.0-or-later, library LGPL) stays an external program. - fuse-overlayfs 1.18 (GPL-3.0-or-later; its source headers permit GPL-2.0-or-later) is a CI diagnostic only, never in a product bundle. ### Process and wasm tiers - agentOS 0.4.7 sidecar (Apache-2.0, source `a4c049b`), verified against its published SHA-512, with its notice in `deploy/agentos.NOTICE`. Its V8 binding and V8 keep their BSD-3-Clause and component notices, and its bundled OpenSSL (Apache-2.0), rustls (Apache-2.0 OR ISC OR MIT), AWS-LC (Apache-2.0 AND ISC), rusqlite (MIT) and SQLite (public domain) keep theirs. - bubblewrap 0.13.1 (LGPL-2.0-or-later, used under 2.1-or-later; conda-forge `haf0a511_0`) with libcap 2.78 (under its BSD-3-Clause option), for x86_64 and aarch64, run unmodified and never setuid. - python-build-standalone release 20261110, CPython 3.12.16 (PSF-2.0 and its dependency notices; the build project is MPL-2.0 and none of its scripts are used). Its optional Berkeley DB extension keeps Sleepycat's corresponding-source terms. - Node.js 24.22.1 official Linux tarball (MIT, with npm and dependency notices). - Chrome Headless Shell 158.0.8127.18 (BSD, with its LGPL and MPL third-party notices), found through Playwright Core 1.65.0's browser manifest. - Puppeteer Core 25.17.0 (Apache-2.0) and ws 8.22.1 (MIT) for CDP and WebSocket handling, with their 25 locked packages under Apache-2.0, MIT, ISC and BSD-3-Clause. - conda-forge library and font archives pinned in `templates/process-tools/`, with PCRE2 10.47 (BSD-3-Clause WITH PCRE2-exception), SLJIT (BSD-2-Clause) and Noto Emoji 2.034 (OFL-1.1) notices taken from upstream sources; LGPL, MPL, GPL and GCC runtime-exception notices are kept. - micromamba 2.10.0 (BSD-3-Clause AND MIT AND OpenSSL) is a build-time package extractor only and is never shipped. zstd (under its BSD-3-Clause option) is a build-time decoder only. - The process desktop stages Debian's Xvfb 21.1.7-3+deb12u13 (MIT/X11), xdotool 3.20160805.1-5 (BSD-3-Clause), xauth and xkbcomp, Chromium 156.0.8078.79-1~deb12u1, scrot 1.8.1-1, x11vnc 0.9.16-9 (GPL-2.0), OpenSSH 9.2p1-2+deb12u10, NSS 3.87.1 (MPL-2.0) and libsqlite3-0 3.40.1-2+deb12u2 (public domain; Debian packaging GPL-2+), with their libaudit, libcap-ng, libgcrypt, libgpg-error and libsystemd libraries (LGPL-2.1). - noVNC 1.7.0 (MPL-2.0, with BSD, MIT and OFL assets) and websockify 0.13.0 (LGPL-3.0-only), run unmodified with only their Unix-socket and token-file features. ### Interpreter, browser, desktop and tool templates - Interpreter bases: CPython 3.12.14 (PSF-2.0), Node.js 24.22.1 (MIT) and Debian bookworm packages, whose LGPL and GPL system packages stay unmodified image dependencies. - Jupyter protocol 5.5: jupyter_client 8.10.0 and ipykernel 7.4.0 (BSD-3-Clause). - Python kernel libraries: numpy 2.5.4 (BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0), pandas 3.1.1, scipy 1.18.1 and scikit-learn 1.9.1 (BSD-3-Clause), matplotlib 3.11.2 (LicenseRef-Matplotlib AND PSF-2.0), requests 2.34.2 (Apache-2.0), pillow 13.0.0 (MIT-CMU), ptyprocess (ISC) and certifi (MPL-2.0, unmodified data), each wheel pinned by SHA-256. - JavaScript kernel: IJavascript 5.2.1, jp-kernel 2.0.0, jmp 2.0.0 and NEL 1.3.0 (BSD-3-Clause); uuid 3.4.0, cmake-ts 1.0.2 and node-addon-api 8.9.2 (MIT); zeromq 6.8.0 (MIT AND MPL-2.0, its libzmq unmodified). - Charts: Chart.js 4.6.1 and @kurkle/color (MIT) on @napi-rs/canvas 1.1.0 (MIT), whose Skia (`b94213a`, BSD-3-Clause, with Chromium's BSD notice) and 129 Cargo dependencies keep their notices. - Container native tools: Debian bookworm's Xvfb, JWM (MIT), x11vnc (GPL-2.0), xdotool, scrot, rxvt-unicode and OpenSSH 9.2p1 (BSD-style, ISC and MIT), each archive hash-verified and inventoried. - Mountpoint for Amazon S3 1.24.0 (Apache-2.0, signature verified) and rclone 1.76.0 (MIT, its 269 vendored modules recorded, with ginkgo v1.16.5 and goconvey v1.8.1 MIT notices). - Browser template: the official Playwright 1.65.0 image (Apache-2.0) with Chromium headless shell 158.0.8127.18 and FFmpeg (LGPL-2.1), and http-proxy 1.18.1 (MIT) for HTTP and WebSocket transport. - Desktop template Python: websockify 0.13.0, jwcrypto (LGPL-3.0, external) and NumPy. browser-use 1.0.8 (MIT), on the same pinned headless shell. - Desktop stack: jlesage/baseimage-gui v4.15.0 (MIT build recipes) with TigerVNC 1.16.2, JWM 2.4.3 and rxvt-unicode as separate GPL programs. ### VM tier - Firecracker 1.18.0 (Apache-2.0), built from source at `eaf83bb`, and its jailer. Its 167-package Cargo graph uses Apache-2.0, MIT, BSD and ISC alternatives with Unicode notices. - The monitor's static build uses Bootlin's x86-64 glibc stable-2026.08-1 toolchain: GCC 15.3.0 (GPL-3.0-or-later with the runtime exception), glibc 2.44 (LGPL-2.1-or-later) and Buildroot recipes (GPL-2.0-or-later). The toolchain is a separate build input and is never redistributed; the monitor ships with its sources, notices and relinking instructions. libseccomp 2.5.5 (LGPL-2.1) is a build-time system library, never linked into `hermitboxd`. - Guest kernel: Kata Containers 4.3.1's published `vmlinux-6.18.56-208` (GPL-2.0), unchanged, with its complete source archive kept. - The Firecracker Go SDK (Apache-2.0, `ef254567cf5d`) and logrus 1.9.3 (MIT) are used by the VM acceptance programs. - gvisor-tap-vsock 0.9.0 (Apache-2.0) in the packet helper, with mdlayher/vsock 1.3.0 and mdlayher/socket (MIT), golang.org/x/sys 0.45.0 (BSD-3-Clause), vishvananda/netlink 1.3.1 (Apache-2.0), insomniacslk/dhcp (MIT, Apache-2.0 and BSD notices), josharian/native 1.1.0 and mdlayher/packet 1.1.2 (MIT), and google/nftables 0.3.0 (Apache-2.0). - CNI plugins 1.10.0 and CNI 1.3.1 (Apache-2.0) for root's TAP; their dependency filepath-securejoin 0.7.0 has BSD-3-Clause and MPL-2.0 files and stays in the external TAP program. - Alpine 3.24 filesystem tools, run unchanged through their own loader: erofs-utils 1.9.1-r0 (GPL-2.0-or-later), e2fsprogs 1.47.4-r0 (GPL-2.0, LGPL-2.0, BSD and MIT), libblkid and libuuid 2.42.3-r1 (LGPL-2.1-or-later and BSD-3-Clause), musl 1.2.6-r3 and libeconf 0.8.3-r0 (MIT), lz4-libs 1.10.0-r1 (BSD-2-Clause) and zlib 1.4-r0 (Zlib). - Guest firewall: nftables 1.1.6 (GPL-2.0; its embedded mini-GMP under GPL-2.0-or-later), libnftnl 1.3.1 (GPL-2.0-or-later) and libmnl 1.0.5 (LGPL-2.1-or-later), built as a separate program from musl-dev, Linux 7.0.0-r1 UAPI headers (GPL-2.0 WITH Linux-syscall-note) and flex 2.6.4-r8 (BSD-2-Clause). - apk-tools 3.0.9-r0 (GPL-2.0-only) from the pinned Alpine 3.24.4 image verifies package signatures; that image's OpenSSL 3.5.9-r0 is Apache-2.0. - Go 1.27.3 (BSD-3-Clause) builds the separate Go programs and is not a host prerequisite. - BusyBox (GPL-2.0-only) runs only as a guest test executable. ### Control, edge and services - PostgreSQL 17.12.0 from theseus-rs/postgresql-binaries (PostgreSQL licence), pinned by its published SHA-256s for x86_64 and aarch64 and run as a separate supervised program; its archive carries its Debian runtime libraries with their copyright files. The server preset's PostgreSQL image is `postgres:17.12-alpine`, pinned by index digest. - RustFS 1.0.0 (Apache-2.0), pinned by its multi-architecture index digest, listening on loopback. - Caddy v2.11.9 (Apache-2.0) serves API TLS; Pebble v2.10.3 (MPL-2.0) is a CI-only ACME server. - Tini 0.19.0 (MIT) runs host-bundle services with parent-death signalling. - util-linux's setpriv (GPL-2.0-or-later) drops credentials as a separate program, and systemd (LGPL-2.1-or-later) supervises user and system services. - Bun 1.4.5 (MIT, with its bundled notices) runs control, edge and the CLI; control's lifecycle lock uses the SQLite embedded in Bun. - Control uses Hono (MIT), Zod 4 (MIT), http-status-codes 2.3.0 (MIT) and tar-stream 3.2.2 (MIT). - The input mirror's Worker (`infra/cache/`) uses http-status-codes 2.3.0 (MIT) and jose 6.2.15 (MIT) from the root install. - asn1js 3.1.0 (BSD-3-Clause), already locked under @peculiar/x509, reads an ML-DSA release key's PKCS#8 (`control/src/release-signature.ts`), because Bun's crypto reads only RFC 9881's seed form and OpenSSL's genpkey writes the `both` form; the seed is taken and the expanded key left aside, so no ASN.1 is parsed by hand. - @prometheus-io/client 0.16.1 (Apache-2.0); OpenTelemetry JavaScript API 1.9.0, core, context-async-hooks and sdk-trace 2.12.0, and the OTLP HTTP trace exporter 0.223.0 (Apache-2.0). - MCP TypeScript SDK 1.32.2 (MIT), negotiating MCP revision 2025-11-25. ### SDKs and integrations - TypeScript SDK types: openapi-typescript 7.13.0 (MIT). Python SDK: websockets (BSD-3-Clause), 17.4 normally and 15.0.1 under the Google ADK extra, and OpenTelemetry Python API and SDK 1.45.2 (Apache-2.0). - AI SDK adapters: Vercel AI SDK 7.0.181 (Apache-2.0); OpenAI Agents SDK for TypeScript 0.22.0 (MIT) with zod-to-json-schema 3.25.1 (ISC); Anthropic TypeScript SDK 1.14.0 and Python SDK 2.14.0 (Apache-2.0); jsonschema 4.26.0 (MIT); openai-agents 0.26.0 (MIT); pydantic-ai-slim 2.74.0 (MIT). - Agent framework adapters: langchain-core 1.8.4, LangChain 1.5.2 and LangGraph 1.2.24 for Python, and @langchain/core 1.5.1, langchain 1.6.8 and @langchain/langgraph 1.7.5 for TypeScript (MIT); @mastra/core 1.86.0 (Apache-2.0); llamaindex 0.12.1, @llamaindex/core 0.6.22 and llama-index-core 0.14.26 (MIT); CrewAI 1.15.45 (MIT); Google ADK 2.15.1 (Apache-2.0). - The Claude Agent SDK adapter uses the caller's installed TypeScript SDK 0.3.332, supplied under its publisher's commercial terms and never bundled. - RivetKit 3.0.1 (Apache-2.0); sandbox-agent 0.5.5 (Apache-2.0); celld v0.6.3 (Apache-2.0), built with rusty_v8 152.1.0 (MIT, with V8's notices); sandbox-adapter 0.5.6 (Apache-2.0) types as a development dependency only; OpenOrange 1.0.2 (Apache-2.0). None is bundled. The coding-agent example uses the OpenAI SDK 7.50.0 (Apache-2.0). - Coding-agent recipes install, from their publishers' packages: Codex, Gemini CLI, Goose, Cline, Continue CLI, Aider, Qwen Code and Mistral Vibe (Apache-2.0); OpenCode, Kilo, OpenHands and Pi (MIT); Crush (FSL-1.1-MIT); and Claude Code, Amp, GitHub Copilot, Auggie, Cursor Agent and Factory Droid under their publishers' commercial terms. ### Stack templates - Node starters run on the pinned Node.js 24.22.1 image. These are MIT: Next.js 16.4.6, React and React DOM 19.3.1, Vite 8.3.8 and its official plugins, Vue 3.5.46, Vue Router 5.5.1, Nuxt 4.7.0, Astro 7.4.13, SvelteKit 3.4.0 with Svelte 5.59.1, its Vite plugin 7.3.2 and Node adapter 6.0.5, React Router 8.5.3, SolidStart 2.2.3 with Solid 1.9.20 and Nitro 3.0.261103-rc, Express 5.3.0, Hono 4.13.22 with its Node adapter 2.1.11, Fastify 5.12.8, NestJS 12.6.2 with Nest CLI 12.0.15, Angular 22.3.0 with AnalogJS's Vite Angular plugin 3.0.0, Expo 58.0.26 with Metro runtime 58.0.17 and babel-preset-expo 58.0.26, React Native 0.88.1, React Native Web 0.21.4, httpxy 0.5.6 and Node typings 24.19.4. - RxJS 7.8.2, reflect-metadata 0.2.2 and TypeScript 6.0.3 (Apache-2.0), tslib 2.9.1 (0BSD) and isbot 5.2.4 (Unlicense). Next.js's optional Sharp and libvips keep Apache-2.0 and LGPL-3.0-or-later. Bun 1.4.5 and Deno 2.9.6 install through their MIT-licensed npm packages. - Python starters run on the pinned Python 3.12.14 image: Flask 3.1.3, Django 6.1.3, Uvicorn 0.54.0, HTTPX 0.28.1 and Starlette 1.10.0 (BSD-3-Clause); FastAPI 0.165.0 and watchfiles 1.3.0 (MIT); JupyterLab 4.6.6, Jupyter Server 2.21.1 and nbclient 0.11.0 (BSD-3-Clause); DuckDB 2.0.1 (MIT) and SQLite (public domain). - Retrieval starters: LangGraph 1.2.24 and LlamaIndex Core 0.14.26 (MIT), with the vector servers Qdrant 1.20.2 and Chroma 1.5.9 (Apache-2.0). - Go 1.27.4 (BSD-3-Clause); Ruby 4.0.10 (Ruby or BSD-2-Clause) with WEBrick 1.9.2 (Ruby or BSD-2-Clause), Rails 8.1.4.1, Rackup 2.3.1 and tzinfo-data 1.2026.6 (MIT); PHP 8.5.13 (PHP License 3.01) with Laravel 13.44.1 and Composer 2.11.3 (MIT); Rust 1.99.1 with tiny_http 0.12.0 (MIT or Apache-2.0), Axum 0.8.9 and Tokio 1.54.1 (MIT); Elixir 1.20.5 on OTP 29 with Phoenix 1.8.17 and Bandit 1.15.0 (MIT) and Jason 1.4.5 (Apache-2.0). - Eclipse Temurin OpenJDK 21.0.13.1+2 (GPL-2.0-only with the Classpath exception) with Spring Boot 4.2.0, Apache Maven 3.10.2 and Maven Wrapper 3.3.4 (Apache-2.0); the .NET SDK 10.0.404 with .NET and ASP.NET Core 10.0.15 (MIT). - Databases: PostgreSQL 17.12 from the release's pins (PostgreSQL licence) with pgvector 0.8.7 (PostgreSQL licence) and nss_wrapper (BSD-3-Clause); Redis 7.0.15 from Debian bookworm and Redis 7.2.17 from Alpine (BSD-3-Clause); MySQL Community 8.4 (GPL-2.0-only with additional permissions); MongoDB Community 8.0 (Server Side Public License v1), whose image the operator's node pulls and Hermitbox does not ship. - Local model starters: the llama.cpp CPU server b12723 (MIT) with the Q4_K_M quantization of SmolLM2-135M-Instruct (Apache-2.0) from a pinned upstream revision, checked by its GGUF digest. - The stacks' private service supervisor uses the official Node 24.22.3 Alpine image, with Node's notices and the GCC runtime libraries' GPL-3.0 and Runtime Library Exception. ### Build, test and documentation tools - Rust 1.99.1 toolchain (MIT OR Apache-2.0). clang-18 and llvm-18 (Apache-2.0 WITH LLVM-exception) compile the BPF programs against libbpf-dev 1.3.0's headers (LGPL-2.1-only OR BSD-2-Clause, used under BSD-2-Clause) and linux-libc-dev's UAPI headers (GPL-2.0 WITH Linux-syscall-note); only declarations and macros reach the object. - actionlint 1.7.12 (MIT) and ShellCheck 0.11.0 (GPL-3.0, a separate program, never shipped). - sccache 0.18.0 (Apache-2.0), installed by taiki-e/install-action (Apache-2.0 OR MIT); actions/download-artifact 8.0.2 (MIT); GitHub CLI v2.103.3 (MIT). - docker/setup-buildx-action 4.4.1 and docker/build-push-action 7.4.0 (Apache-2.0) build the release image with BuildKit's GitHub Actions cache. - Booted-host tests: Incus 6.0.0 (Apache-2.0) with Debian 13, Ubuntu 24.04, Fedora 44 (MIT compilation licence) and Alpine 3.24 images; QEMU 8.2.2 (GPL-2.0), cloud-utils 0.33 (GPL-3.0), genisoimage 1.1.11 (GPL-2.0) and cloud-init 26.2 (GPL-3.0 or Apache-2.0) for the cloud-init boot matrix, all separate CI programs. - Diagnostics run as separate programs and are never shipped: GNU readelf 2.44 (GPL-3.0-or-later), strace (LGPL-2.1-or-later), GNU coreutils (GPL-3.0-or-later), util-linux mount (GPL-2.0-or-later, libmount LGPL-2.1-or-later), curl (curl licence) and OpenSSL 3 (Apache-2.0). - Ajv 8.20.0 and ajv-formats 3.0.1 (MIT) validate platform templates against their owners' schemas. - The documentation site uses the Hermitbox design system's `tokens.css`, `components/bundle.css`, `components/bundle.js` and fonts, vendored unchanged under `site/public/design-system/` and pinned by SHA-256 in `site/design-system.lock.json` (`site/tools/design.ts` fails the build on any other byte); the fonts are Redaction, Departure Mono and Schibsted Grotesk, all OFL-1.1 (`LICENSES/OFL-1.1.txt`, served beside them). - The docs' copy buttons use `site/src/copy.js`, not the design system's `bindCopy`, which shows "copied" even when the clipboard refuses: Hermitbox's copy handler reports "copied" only after the write succeeds and otherwise shows the full text selected to copy by hand. - The docs take the design system's docs parts ("quiet water") through Starlight's component overrides in `site/src/components/` (the frame, header, search, theme switch, tree, title block, depth gauge, pager and footer), so Starlight keeps the routing, sidebar data, contents list and search index while the markup is the design system's own classes. - The docs' code is Astro's Shiki with a theme in the design system's four code tokens and a transformer that puts each block in the design system's code frame (`site/src/markdown.ts`), not Expressive Code: its frames bring window dots, rounded corners and their own colours, which the design system's frame has none of. - The docs' search is the design system's dialog over Pagefind's own JavaScript API and the index Starlight builds, not Pagefind's default UI, whose markup can't take the design system's prompt, tree-row results or empty state. - The docs start the design system's scenes and depth gauge one by one (`site/src/design.ts`), not with `Hermitbox.mount`, whose copy buttons report "copied" when the clipboard refuses and whose theme switch keeps the choice nowhere; the theme switch writes Starlight's own `starlight-theme` store. - The docs Worker serves `_astro/` and `design-system/` files as `public, max-age=31536000, immutable` and everything else (pages, Markdown twins, `llms*.txt`) as `public, max-age=0, must-revalidate`, so a click never refetches a font or a stylesheet. Astro names `_astro/` files by their hash; the pages link `tokens.css`, `bundle.css` and `bundle.js` with `?v=` and the first 12 hex digits of their digest in `site/design-system.lock.json`. The fonts keep plain names because `tokens.css` links them relatively and is never edited, so a font refresh needs a new file name or a Hermitbox version bump (the version is in every address). - The docs navigate with Astro's client router: the header and the tree persist as the same nodes, only the article and the rail are swapped, links prefetch on hover, and the theme is set on the incoming page before it is shown. Every script binds once on the document or runs again on `astro:page-load`, and the outgoing page's scenes and depth gauge (`Hermitbox.depth(nav).destroy()`) are stopped in `astro:before-swap`, so their window listeners don't pile up. - The docs sidebar gives every section, subsection and page the 12px pixel icon the design system's map names (`site/src/tree-icons.ts`, paths copied verbatim) or a product logo (`site/src/logos.ts`); a page the map doesn't name takes its section's icon, and the site build fails on a section, a top-level page or an icon name that resolves to neither, or a mapped entry the sidebar no longer lists. - Product logos in the docs sidebar are each product's official vector mark, in one colour, at icon size, used to name the product; any brand's request to change or remove its mark is honoured. - The product logos live in the docs' own `site/logos/` and `site/src/logos.ts`, not in the vendored design system, which is unchanged; they take the sidebar's ink, and coral on the current page, like its icons. - `site/tools/logos.ts` writes `site/src/logos.ts` from each pinned source in `site/logos/`: the mark's elements (all, or those `site/logos/sources.json` names), with transforms applied, rects, circles and polygons as paths, a stroked rect as its outline, fill rules kept and path data otherwise as published, light shapes over the mark cut out of it in one evenodd path, and the mark's bounds as the viewBox. The site build and `control/test/site.test.ts` regenerate it and fail on a changed source digest or output. - Claude logo (Claude page): the Claude Spark, from https://www.anthropic.com/press-kit (https://assets.claude.com/ae59ca4ca194dac9c9dc3bc78c5829468cb0e8af.zip, sha256 c68ac92df86c825f95177e24016fcc9a8863a3fd4ca344fe6f0700b2c1e07151), Anthropic media resources/Anthropic logos/Claude logos/3 Claude Spark/SVG/Claude Spark - Clay.svg; kept as `site/logos/claude.svg` (sha256 `6d53db4be375e899c937c26cf16684a80d6e869b1928d72b37748bef2560e219`). - Cursor logo (Cursor page): the cube, from https://cursor.com/brand (https://ptht05hbb1ssoooe.public.blob.vercel-storage.com/assets/brand/cursor-brand-assets.zip, sha256 97488a7751914e60f9ff532bc33810cdeaebdddc017548abe6ca2bc29bbc3928), General Logos/Cube/SVG/CUBE_2D_LIGHT.svg; kept as `site/logos/cursor.svg` (sha256 `c483c02f78eb2619778fdd959e72a9adfac4844854472cd2653d4cbfd60e4d71`). - VS Code logo (VS Code page): the icon's outline (the mask that shapes it), from https://code.visualstudio.com/brand (https://code.visualstudio.com/assets/branding/visual-studio-code-icons.zip, sha256 04c5292a117bbc619f1ce574cc59b6c5e2e26374d6e64b92619e848612f2d9cb), visual-studio-code-icons/vscode.svg; kept as `site/logos/vscode.svg` (sha256 `74ad401c6487a0dc5af1f6b2935556ab2d3553ae45effc7e1697b4d117d046b6`). - OpenAI logo (Codex and ChatGPT pages): the Blossom, from https://openai.com/brand/ (https://cdn.openai.com/brand/openai-logos.zip, sha256 c54e85ab5884228f89f0230dd8effa8d588cad78166fe954135f4afa553222db), OpenAI-logos/SVGs/OAI_OpenAI-Blossom_Black.svg; kept as `site/logos/openai.svg` (sha256 `75c1e9fffa5e8c437bec1d67197a73992bca45d166c6ff23215185dea8fae92a`). - GitHub logo (GitHub Actions page): the Invertocat, from https://brand.github.com/foundations/logo (https://brand.github.com/GitHub_Logos.zip, sha256 e2a67d6cc51d990a52c46c1cf6bcab688db4830982174bca50e0be7a5c2f3194), GitHub Logos/SVG/GitHub_Invertocat_Black.svg; kept as `site/logos/github.svg` (sha256 `693d7abe6f899646cc2e96856723b45e95f71885a54910b2749f6decdf7e1ee1`). - Rivet logo (Rivet, Rivet agent harness and agentOS pages): the Rivet icon's tile with its ring and letter cut out, from https://rivet.dev/brand/ (https://rivet.dev/rivet-brand-kit.zip, sha256 d44c367345b226713d17683fe6dad5060c15176515dc9e77bb6669fcccdce529), rivet-icon.svg; kept as `site/logos/rivet.svg` (sha256 `9c5f26fa6277633e5b3a5ca98e22660166539a15b93664972f727efbc4af1e19`). - Railway logo (Railway page): the Railway mark, from https://railway.com/brand/logo-dark.svg; kept as `site/logos/railway.svg` (sha256 `a09b7759ca3e50156117f9eb3843a4a5dd8eb727d379fa60dd20315797b390a9`). - Render logo (Render page): the Render logomark, from https://render.com/newsroom Brand Kit (https://cdn.sanity.io/files/hvk0tap5/production/40134cba8baae95e988e65d2a0675c2521e9c731.zip, sha256 052739f3bca966cd23326284e1eb7d402c53ae6f5d597a15523cccb7200805fc), Render Brand Kit/Logos/Black/Render logomark - Black.svg; kept as `site/logos/render.svg` (sha256 `c5f3790ed18ab18658cffae2bab49cc7e699955f534de013107f14f2f8398aed`). - Fly.io logo (Fly.io page): the balloon, hills and sun of the Fly.io brandmark with its light shapes cut out, without its tinted ground, from https://docs.fly.io/about/brand (https://mintcdn.com/fly-io/v-XOGeVK6s4rQ-4y/images/brand/brandmark-dark.svg); kept as `site/logos/fly.svg` (sha256 `c0db1160612daace64e76fca4664bd90e9d24dd1c9ca9c5d47bc767b6f2e73b0`). - Koyeb logo (Koyeb page): the Koyeb logomark, from https://www.koyeb.com/brand (https://www.koyeb.com/static/images/logos/koyeb-logomark-dark.svg); kept as `site/logos/koyeb.svg` (sha256 `cda6e1a23bb3426733e8486b48cf04debafff1aa75d24160b3d3f2689cca1432`). - Coolify logo (Coolify page): the monochrome Coolify logo, under Apache-2.0 (its text in `site/notices/product-logos.txt`), from https://github.com/coollabsio/coolify/blob/f55221789d0f39a1157de2e4728b5538cb916d33/public/coolify-logo-monochrome.svg; kept as `site/logos/coolify.svg` (sha256 `798599776bda5ab04512ba16311dc6ff9e17a94f0f20deb35d51907977dbacb9`). - DigitalOcean logo (DigitalOcean page): the mark of the horizontal logo, from https://www.digitalocean.com/press/brand (https://web-platforms.sfo2.cdn.digitaloceanspaces.com/DO%20Logo%20Assets.zip, sha256 b9849e9e15a4b4036094edba372e72b5191b62e42d0ee46636c44ee8bb8c317b), DigitalOcean-Logos/Logos-RGB/Horizontal/svg/logo-horizontal-black-RGB.svg; kept as `site/logos/digitalocean.svg` (sha256 `f46c7f2bd019a4cf4d35635fa1dca94ff27b3ce10f1cc6090b63ae80c495c955`). - Docker logo (release image page): the Docker mark, from https://www.docker.com/app/uploads/brand/logo/docker-mark-ether.svg; kept as `site/logos/docker.svg` (sha256 `1dc3f65bc4255375fc6c2c6fc7ab6159eb7083b372ff5925d63e0ce28676c7d5`). - Every docs page in `get-started/`, `guides/`, `integrations/` and `hosting/` that has steps carries a "let your agent do it" prompt in its `agent:` frontmatter, shown under its title in the design system's compact agent panel and copied with the address of the page's Markdown twin; the twin carries it under its title. A page has steps when it has an ordered list or a shell, TypeScript, JavaScript or Python block, and the site build fails on one without a prompt (`site/tools/sources.ts`). The canonical prompt stays on the docs home and at the end of every other page. - The agent panel's ChatGPT target reads "not yet ChatGPT" and links to its section of the agents page: ChatGPT reaches only a public MCP endpoint, so there is nothing to add to it yet. - Each pull request from this repository that touches the documentation uploads a preview version of `hermitbox-docs` (`.github/workflows/docs-preview.yml`, `infra/docs/preview.sh`), served at `pr--docs.priv.hbx.sh` and `-docs.priv.hbx.sh` and linked in one comment on the pull request; uploading never changes production, the job is not a required check, and fork pull requests get no preview because they have no secrets. - The README carries the design system's GitHub art (header, states strip, divider, feature sprites, add-to-agent badges), copied unchanged into `.github/assets/` and shown dark or light through ``; its first and last TypeScript blocks stay the quickstart and the container example that acceptance runs. - Wrangler 4.169.0 (MIT OR Apache-2.0) deploys the Workers in `infra/`, run with `bunx` at that version and never shipped. - Documentation site: Astro 7.4.12, Starlight 0.43.1 and Pagefind 1.6.0 (MIT), with the Svelte MIT notice for Pagefind's 4.2.1-based UI; parse5 8.1.1, gray-matter 4.0.3 and mdast-util-from-markdown 2.1.0 (MIT) for export and link checks; github-slugger 2.0.0 (ISC), the slugger Astro's own heading ids use, for the heading anchors. - The user preset accepts a group-writable directory under the home only when its group is the owner's private group (primary group, no other member or account, per /etc/passwd and /etc/group), the rule Debian's OpenSSH uses: umask 002 is the default on Debian and Ubuntu, and refusing it broke the one-command install there; a group the files don't list stays refused. - hermitboxd accepts a group-writable directory or file on the paths it trusts only when its group is the owner's private group (runtime/peers.rs), the same rule as the CLI and Debian's OpenSSH, and never for a path with an extended ACL (whose group bits are the ACL's mask), with the account files read at each check: with umask 002 the process agent's, wasm distribution's and VM bundle's ancestries all failed, so a default Debian or Ubuntu user's install had no isolation tier. - Code is formatted multi-line for reading: Biome 2.6.9 (MIT OR Apache-2.0) at 80 columns, rustfmt's defaults at 100. The same logic spans more lines that way, so the structure limits rise with it: 1250 lines per file and 750 per block (set on the pinned upstream check in CI), and clippy's too_many_lines to 190. - C is formatted by clang-format 23.1.5 (Apache-2.0 WITH LLVM-exception), run from PyPI in CI and never shipped, in .clang-format's readable style (4 spaces, 80 columns, braces on every block, conditions broken before && and ||, one argument per line once a call wraps); the BPF objects are rebuilt from the reformatted source with the pinned toolchain, and only their line information moves. - Each CLI command's parser names the verbs and flags it reads in an exported list, read through a typed reader (`flags` in `cli/src/sandbox.ts`) so a flag outside the list fails the typecheck, and `cli/test/help.test.ts` fails when a page leaves one of them out: the help had fallen behind the parsers by dozens of verbs and flags with nothing to notice. --- # Connect your agent > Let your agent do it: Connect yourself to Hermitbox on this machine. If `~/.local/bin/hermitbox` is missing, run `curl -fsSL https://hbx.sh | sh` as my ordinary user, never with sudo. Add `hermitbox mcp` to your own MCP settings by its absolute path, with the command or entry for your client. It reads the credentials the installer saved, so never copy a key into a config file or this chat. Then create a sandbox, run `echo hello` in it, show me the output and delete it. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/agents.md. Give Hermitbox to your AI agent with one prompt, or add `hermitbox mcp` to the agent yourself. On the machine where you ran the installer, `hermitbox mcp` reads the saved credentials, so no key goes in any agent's config. ## Ask your agent Any agent that can run commands on your machine can do the whole setup from this prompt: ```text Install Hermitbox on this machine and connect yourself to it. Run `curl -fsSL https://hbx.sh | sh` as my ordinary user, never with sudo. Then add `hermitbox mcp` to your MCP settings by its absolute path (~/.local/bin/hermitbox). It reads the credentials the installer saved, so never copy a key into a config file or this chat. For anything else, follow https://docs.hermitbox.dev/llms.txt. Prove it works: create a sandbox, run `echo hello` in it, show me the output, then delete it. ``` The ordinary-user install puts the CLI in `~/.local/bin/hermitbox`, and a root install puts it in `/usr/local/bin/hermitbox`. Agents started from a desktop might not have either on `PATH`, so each command below names the full path. ## Claude Claude Code adds the server for your user with one command: ```sh claude mcp add --transport stdio --scope user hermitbox -- ~/.local/bin/hermitbox mcp ``` Check it with `claude mcp get hermitbox`. A Claude Desktop extension is not published yet, so in Claude Desktop, give Claude the prompt above. To reach a remote install, see [Claude](https://docs.hermitbox.dev/v0.2.1/integrations/claude.md). ## Cursor Open [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=hermitbox&config=eyJjb21tYW5kIjoiJHt1c2VySG9tZX0vLmxvY2FsL2Jpbi9oZXJtaXRib3giLCJhcmdzIjpbIm1jcCJdfQ==) and confirm in Cursor, or add this server to `~/.cursor/mcp.json` under `mcpServers.hermitbox`. Cursor expands `${userHome}` itself. ```json { "command": "${userHome}/.local/bin/hermitbox", "args": ["mcp"] } ``` To reach a remote install, see [Cursor](https://docs.hermitbox.dev/v0.2.1/integrations/cursor.md). ## VS Code VS Code adds the server to your user profile with one command: ```sh code --add-mcp "{\"name\":\"hermitbox\",\"type\":\"stdio\",\"command\":\"$HOME/.local/bin/hermitbox\",\"args\":[\"mcp\"]}" ``` Copilot's agent mode lists the Hermitbox tools after a reload. To reach a remote install, see [VS Code](https://docs.hermitbox.dev/v0.2.1/integrations/vscode.md). ## Codex Codex adds the server with one command: ```sh codex mcp add hermitbox -- ~/.local/bin/hermitbox mcp ``` It lands in `~/.codex/config.toml` as `[mcp_servers.hermitbox]`. To reach a remote install, see [Codex](https://docs.hermitbox.dev/v0.2.1/integrations/codex.md). ## ChatGPT ChatGPT on the web connects to a public MCP endpoint over HTTPS. Hermitbox's MCP server listens only on this machine, so there is nothing for ChatGPT to add yet. Give the prompt to an agent that runs on your machine, or use Codex. See [ChatGPT](https://docs.hermitbox.dev/v0.2.1/integrations/chatgpt.md). ## Any MCP client Add a stdio server whose command is `~/.local/bin/hermitbox` with the argument `mcp`. Each client names its settings file and variable syntax differently. [Any MCP client](https://docs.hermitbox.dev/v0.2.1/integrations/mcp.md) shows the configuration for a remote install. ## What the server offers [MCP tools](https://docs.hermitbox.dev/v0.2.1/reference/mcp.md) lists the tools, the loopback HTTP transport and their limits. Host admission enforces [tier limits](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md), so an agent cannot grant a capability the host lacks. --- # Connect the CLI > Let your agent do it: Connect the Hermitbox CLI and prove it works. Install the CLI with the one-command installer as my ordinary user, never with sudo, if it isn't installed. Export `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the shell's private environment, and `HERMITBOX_IMAGE=alpine:3.22` only if the install defaults to `container`. Never copy the key into a file or this chat. Run the page's block, which prints hello and removes its sandbox, and show me the output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/cli.md. Run a one-shot command in a sandbox from your shell with the Hermitbox CLI. 1. Install the CLI with the [one-command installer](https://docs.hermitbox.dev/v0.2.1/get-started/install.md). 2. Export `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately. If your install defaults to `container`, also export `HERMITBOX_IMAGE=alpine:3.22`; leave `HERMITBOX_IMAGE` unset for `process` or `wasm`. 3. Run this block. It prints hello and removes its sandbox. ```sh # A container host needs an image; process and Wasm hosts must not get one. if [ -n "${HERMITBOX_IMAGE:-}" ]; then hermitbox run --image "$HERMITBOX_IMAGE" -- echo hello else hermitbox run -- echo hello fi ``` Images need the container tier and its engine. Process and Wasm refuse them, and the block keeps that refusal. A server install's welcome page also prints an exact block for its configured tier. See [host boundaries](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees). --- # Choose a caller Call Hermitbox from your code, your shell, your agent or your CI. Every caller needs your API URL and key in its private environment as `HERMITBOX_API_URL` and `HERMITBOX_API_KEY`. | Caller | Use it for | Guide | | --- | --- | --- | | TypeScript | A Node or Bun backend, including serverless functions | [TypeScript](https://docs.hermitbox.dev/v0.2.1/get-started/typescript.md) | | Python | A Python application, sync or async | [Python](https://docs.hermitbox.dev/v0.2.1/get-started/python.md) | | CLI | Your shell and scripts | [CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) | | HTTP | Any language, with `curl` or your HTTP client | [HTTP](https://docs.hermitbox.dev/v0.2.1/get-started/http.md) | | MCP | An AI agent, through `hermitbox mcp` | [Any MCP client](https://docs.hermitbox.dev/v0.2.1/integrations/mcp.md) | | GitHub Actions | A command in a sandbox from a workflow step | [GitHub Actions](https://docs.hermitbox.dev/v0.2.1/integrations/github-actions.md) | | Webhooks | Sandbox lifecycle events sent to your HTTPS endpoint | [Webhooks](https://docs.hermitbox.dev/v0.2.1/guides/webhooks.md) | On the machine where you installed Hermitbox, the CLI and `hermitbox mcp` read the saved credentials, so they need no variables. To connect an agent there, see [Connect your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md). ## Find the URL and key The installer prints the API URL and key and saves them privately. `hermitbox config key` prints the saved key again. A server or platform install also serves a welcome page with an example for each caller and its default tier. Keep the key on the server side: a browser bundle must never contain a project key. ## Default tier A request that names no tier runs on the host's default tier. A container request needs an image and an engine, and `process` and `wasm` refuse container images. See [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md) and [Tiers in depth](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). --- # Connect with plain HTTP > Let your agent do it: Read my Hermitbox project over the HTTP API with `curl`. Use the API URL and project key the installer printed, or a server install's welcome page, and set them as `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the shell's private environment. If you can't find them, ask me to set them; never copy the key into a file or this chat. Run the page's request and tell me the install's default tier. It only reads, so create no sandbox. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/http.md. Call the Hermitbox HTTP API directly with `curl` and a project bearer token. 1. Copy the API URL and project key the installer printed (or from a server install's welcome page). 2. Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in your shell's private environment. 3. Run this to read your project and the install's default tier. ```sh curl --fail --silent --show-error "${HERMITBOX_API_URL%/}/v1/project" \ --header "Authorization: Bearer $HERMITBOX_API_KEY" ``` This reads configuration; it does not create a sandbox. Create requests must respect the reported tier: images need containers, while process and Wasm refuse them. The [API reference](https://docs.hermitbox.dev/v0.2.1/reference/api.md) describes lifecycle operations, capabilities, errors and webhook signing. --- # Install Hermitbox > Let your agent do it: Install Hermitbox on this Linux machine. Run `curl -fsSL https://hbx.sh | sh` on `x86_64` or `aarch64` as my ordinary user, never with sudo, unless I ask for the server or node preset. If I want to see the plan first, run `hermitbox up --check`. Then run `~/.local/bin/hermitbox run -- echo hello` and show me the output. The installer saves the API URL and key privately, so never copy the key into a config file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/install.md. Install and start Hermitbox with one command on Linux (`x86_64` or `aarch64`), as your own user, with no root and no Docker. The installer asks nothing, prints the API URL and key, and saves them privately. ```sh curl -fsSL https://hbx.sh | sh ``` Check that it works: ```sh ~/.local/bin/hermitbox run -- echo hello ``` The installer detects the host and takes its preset. `hermitbox up --check` prints the plan without changing anything. `--preset user|container|server|node` overrides what the installer detected. ## User preset An ordinary account gets the user preset, with no sudo, Docker or system manager. The release bundle is signed with the ML-DSA-65 release keys. It includes PostgreSQL, RustFS, control, edge, `hermitboxd` and its agent. The installer takes the release built for the host's machine. On `aarch64`, `wasm`, `vm` and the native process tools are off and say why: their pinned agentOS sidecar, VM bundle and tool bundle are built for `x86_64`. Data, configuration, state and runtime sockets follow absolute XDG paths below home. The defaults are: - `~/.local/share/hermitbox` - `~/.config/hermitbox` - `~/.local/state/hermitbox` - `~/.cache/hermitbox-runtime/hermitbox` Hermitbox refuses an XDG path that escapes home. The runtime falls back below home when `/run/user` is outside it. The service listens on loopback port 7331, or on another free unprivileged port when 7331 is busy. Sandboxes use authenticated path aliases, so a domain is optional. Process isolation needs enforceable Landlock ABI 3. On compatible GNU hosts without it, the user preset selects and reports Wasm instead. Hermitbox refuses any unsupported backend you request by name. When systemd user services and linger are available, Hermitbox installs and starts `~/.config/systemd/user/hermitbox.service`. Otherwise it stays in the foreground and prints how to keep it running after logout. In a second terminal, run `~/.local/bin/hermitbox run -- echo hello`. New POSIX shells find `hermitbox` through a managed `PATH` block. Read-only, unsafe or symlinked shell profiles stay untouched. The absolute path works in the current shell. Process sandboxes share your UID, so use them for work you trust. The setup summary reports whether the managed service supports [process memory and CPU limits](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md#limits). ### Upgrade or remove - `hermitbox upgrade` authenticates the latest release and keeps state and credentials. Under foreground supervision it stays attached to the upgraded service. Deployment requirements stay in place across user-manager restarts and upgrades. A backend change needs an explicit data migration. - `hermitbox down` stops the service and its retained compute, and keeps data. - `hermitbox down --purge` also removes the managed bundle, configuration, state, cache, bootstrap, CLI shortcut, exact `PATH` block and user unit. It prints the removed paths. It reverses linger only when this installation enabled it. Save backups before purging. ## Server with root Root on a systemd host, outside a container, gets the server preset. For a public domain, point a DNS A record at the server and allow inbound TCP 443 for HTTPS and certificate validation. The edge needs local TCP ports 80 and 443 for its HTTP and TLS fronts. ```sh curl -fsSL https://hbx.sh | sudo HERMITBOX_DOMAIN=sandboxes.example.com sh ``` A systemd host gets Docker, nftables, persistent Docker volumes for the database and object store, control and edge units, and its enrolled local node. Debian and Ubuntu can install missing packages automatically. Other distributions need Docker and nftables installed first, and the installer names them before it provisions anything. Server sandbox placement needs private network and PID namespaces and enforced CPU and memory limits. The main daemon's unit hardening stays in force. The API is available at `https://sandboxes.example.com` with an automatically renewed certificate. Omit `HERMITBOX_DOMAIN` to install a local server with loopback port 7331 and path aliases. Existing domains stay immutable. See [Host on a server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md) for the full setup, and [operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for DNS, TLS, server upgrades and explicit data removal. ## Inside a container ```sh curl -fsSL https://hbx.sh | sh ``` An ordinary account still gets the user preset. Root in a container gets the container preset, with managed files under: - `/opt/hermitbox` - `/etc/hermitbox-local` - `/var/lib/hermitbox` - `/run/hermitbox-local` Embedded PostgreSQL drops to its dedicated nonzero UID. Process confinement must actually pass. Missing kernel syscalls cause a refusal that says what to change. A mounted Docker socket alone does not establish correct host bind paths or firewall coverage, so use the server preset on the engine host for image workloads. ## Platform that runs images ```sh docker run -p 8080:8080 -v hermitbox:/var/lib/hermitbox ghcr.io/hermitbox/hermitbox:0.2.1 ``` The same supervisor runs inside the release image. The first key appears once in its log. Keep the named volume, and configure a trusted TLS terminator for remote access. See [Deploy the release image](https://docs.hermitbox.dev/v0.2.1/hosting/container.md) for Render, external stores and image tiers, and [Hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md) for each platform. ## Node joining a fleet ```sh export HERMITBOX_JOIN_TOKEN='' curl -fsSL https://hbx.sh | \ sudo --preserve-env=HERMITBOX_JOIN_TOKEN HERMITBOX_PRESET=node sh ``` The token stays in the environment, which only the account that set it and root can read. A token in a command's arguments is visible to every account on the host while the command runs. The node preset uses the existing root and systemd fleet join. It installs the verifier and uses the supplied fleet token. It verifies the signed daemon and agent bootstrap independently of the fleet before joining. The token is an operator credential: keep it out of shell history and CI output. On first enrollment the node denies all container images by default. To allow selected images, add `HERMITBOX_NODE_ALLOW_IMAGES='alpine:,registry.example/team/'` beside `HERMITBOX_PRESET=node` in the command above. Separate entries with commas. Each means the same as one `hermitbox node join --allow-image` value: - A repository ending in `:` permits its tags. - A namespace ending in `/` permits images under it. - A complete SHA-256 image reference permits that digest alone. Repeat enrollment keeps the node's saved policy. See [operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for issuing a token and node policy, [Nodes and fleet](https://docs.hermitbox.dev/v0.2.1/concepts/fleet.md) for how nodes and control work together, and [Add machines](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md) for machine providers. ## Install options Set `HERMITBOX_NO_UP=1` on the installer process to install only the CLI. Preview builds are signed with a separate ML-DSA-65 identity and cannot replace production release keys. Local installations use every supported tier by default. To serve one backend, set `HERMITBOX_RUNTIME` to `container`, `process` or `wasm` when installing. Restarts and upgrades use the saved runtime, and each workload keeps its chosen tier. The container tier needs a supported engine running on the same host, so an installation inside a container keeps that tier off. `hermitbox doctor` and `hermitboxd doctor` report tier availability. --- # Connect Python > Let your agent do it: Connect a Python program to Hermitbox. Install the `hermitbox` package in the program's Python environment, and set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in that process's private environment, never in a file or this chat. Run the page's example with the same interpreter: it uses the install's default tier, adds an image only for containers, prints hello and deletes its sandbox. Show me the output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/python.md. Create a sandbox, run a command, and delete it from Python with the Hermitbox SDK. 1. Install `hermitbox` in your application's Python environment. 2. Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in that process's private environment. 3. Run this with the same Python interpreter. ```python from hermitbox import Hermitbox # Connect with HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment. with Hermitbox() as hb: # Use the install's default tier. A container also needs an image. isolation = hb.project()['defaults']['isolation'] image = {'image': 'alpine:3.22'} if isolation == 'container' else {} box = hb.sandbox(isolation=isolation, **image) try: # Run a command and stop if it failed. result = box.run('echo hello') if result.code != 0: raise RuntimeError(result.stderr) print(result.stdout) # hello finally: # Delete the sandbox, even when something failed. box.delete() ``` This names the reported default tier and adds an image only for containers. An unavailable named tier is refused. See [tier limits](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) and the [sync and async SDK reference](https://docs.hermitbox.dev/v0.2.1/sdk/python.md). --- # Quickstart > Let your agent do it: Install Hermitbox on this machine and run a first sandbox. Run `curl -fsSL https://hbx.sh | sh` as my ordinary user, never with sudo, then check it with `~/.local/bin/hermitbox run -- echo hello`. Create a sandbox with the CLI, run `echo hello` in it and delete it. If I want TypeScript or Python, install that SDK from the release, export `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` as the page shows, and run its example. Never copy the key into a file or this chat. Show me each output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/quickstart.md. Install Hermitbox, create a sandbox, run `echo hello` in it and delete it. Do it from the CLI first, then the same steps from TypeScript or Python. ## Install Hermitbox Run the installer as your own user. Linux (`x86_64` or `aarch64`), no root, no Docker. ```sh curl -fsSL https://hbx.sh | sh ``` The installer starts Hermitbox and prints a JSON summary. `apiUrl` is your API URL, and `apiKey` is your key, printed on the first install only. Both are also saved privately for the CLI and `hermitbox mcp`. ## Check it works ```sh ~/.local/bin/hermitbox run -- echo hello ``` It prints: ```txt hello ``` `hermitbox run` creates a sandbox, runs one command in it and deletes it. New shells find `hermitbox` on your `PATH`. In the shell you installed from, use `~/.local/bin/hermitbox`. ## Use the CLI The CLI reads the credentials the installer saved. This block uses `jq` to read the new sandbox's ID. ```sh # Create a sandbox and save its ID. SANDBOX_ID=$(hermitbox sandbox create | jq -r .id) # Run a command in it. hermitbox sandbox exec "$SANDBOX_ID" -- echo hello # Delete it when you're done. hermitbox sandbox rm "$SANDBOX_ID" ``` `hermitbox sandbox create` prints the new sandbox as JSON. With no tier named, the sandbox runs on the host's default tier. On a host that serves only containers, add `--image alpine:3.22` to `create`. ## Set the URL and key The SDKs read `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` from the environment. Use the `apiUrl` the installer printed. `hermitbox config key` prints the saved key. ```sh export HERMITBOX_API_URL='' export HERMITBOX_API_KEY="$(hermitbox config key)" ``` Keep the key in your process's private environment, never in a file you share. ## Use TypeScript Install the TypeScript SDK from the release: ```sh npm install https://github.com/hermitbox/hermitbox/releases/download/v0.2.1/hermitbox-0.2.1.tgz ``` Save this as `quickstart.ts`: ```ts import { Hermitbox } from 'hermitbox' // Read HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment. const hb = new Hermitbox() // Create a sandbox on the host's default tier. const box = await hb.sandbox() // Run a command in it. const result = await box.run('echo hello') console.log(result.stdout) // hello // Delete it when you're done. await box.delete() ``` Run it with Bun or your project's TypeScript runner: ```sh bun quickstart.ts ``` ## Use Python Install the Python SDK from the release, on Python 3.12 or later: ```sh pip install https://github.com/hermitbox/hermitbox/releases/download/v0.2.1/hermitbox-0.2.1-py3-none-any.whl ``` Save this as `quickstart.py`: ```python from hermitbox import Hermitbox # Read HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment. hb = Hermitbox() # Create a sandbox on the host's default tier. box = hb.sandbox() # Run a command in it. result = box.run('echo hello') print(result.stdout) # hello # Delete it when you're done. box.delete() ``` Run it: ```sh python3 quickstart.py ``` ## Default tier These examples name no tier and no image, so Hermitbox picks `process` or `wasm`. On a host that serves only containers, or whose default tier is `container`, pass an image to `hb.sandbox()`: `{ image: 'alpine:3.22' }` in TypeScript, `image='alpine:3.22'` in Python. See [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md). ## Next steps - [Connect your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md): paste one prompt into your agent, or add `hermitbox mcp` to it yourself. - [Concepts](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): sandboxes, their lifecycle, isolation tiers and templates. - [Hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md): run Hermitbox on a server, a platform that runs images, or a fleet of machines. --- # Connect a TypeScript backend > Let your agent do it: Connect my Node or Bun backend to Hermitbox. Install `hermitbox` with the backend's package manager, and set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the backend's private environment, never in a browser bundle, a file or this chat. Run the page's module with the project's TypeScript runner: it uses the install's default tier, adds an image only for containers, prints hello and deletes its sandbox. Show me the output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/typescript.md. Create a sandbox, run a command, and delete it from a Node or Bun backend with the TypeScript SDK. 1. Install `hermitbox` in your Node backend with its package manager. 2. Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the backend's private environment. 3. Run this module with your application's normal TypeScript runner or build. ```ts import { Hermitbox } from 'hermitbox' // Connect with HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment. const hb = new Hermitbox() // Use the install's default tier. A container also needs an image. const { defaults } = await hb.project() if (!defaults) throw new Error('The install did not report its default tier') const { isolation } = defaults const box = await hb.sandbox( isolation === 'container' ? { isolation, image: 'alpine:3.22' } : { isolation }, ) try { // Run a command and stop if it failed. const result = await box.run('echo hello') if (result.code !== 0) throw new Error(result.stderr) console.log(result.stdout) // hello } finally { // Delete the sandbox, even when something failed. await box.delete() } ``` Keep this on the server: browser bundles must never contain a project key. On serverless platforms, await work inside the request lifetime or use a supported background worker; the platform can stop an unawaited promise when the request ends. Long streams need a runtime that permits their duration. The host tier still controls [capabilities and isolation](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). [SDK reference](https://docs.hermitbox.dev/v0.2.1/sdk/typescript.md). --- # Machine providers # Machine providers Machine providers let Hermitbox acquire and release Linux fleet hosts automatically on Hetzner, Boat, or manually managed SSH machines. Control records an acquisition identity before contacting any provider, so a lost reply never rents a second host. A lost create reply becomes uncertain: reconciliation finds its deployment/acquisition labels before any further action. If nothing is visible, it waits rather than risking another paid host. Boat additionally receives its native Idempotency-Key. Manual SSH uses a root-owned acquisition marker and strict host verification. Only the enrollment token control minted binds a node to an acquisition; labels confer no trust. One-time join secrets are derived with HMAC-SHA256 from an environment key and the acquisition UUID; only their hashes reach Postgres. Provider tokens are never stored in Postgres or exposed by operator responses. ## Hetzner Hetzner attaches an existing private network and firewall and runs cloud-init with the join line. Its dynamic x86 catalog and gross hourly/monthly quotes come from the provider's server-types and pricing endpoints. Quotes cover the server, not extra public IP charges, traffic, taxes specific to an account, or other extras. Prices are preserved with acquisition/release events, never private business constants. See [Hetzner API](https://docs.hetzner.cloud/reference/cloud). ## Boat Boat exposes VM creation, file and command endpoints, but its published API has no geographic region selector or live price catalog. The operator supplies a logical region and explicit shape/price catalog. A bootstrap first proves Docker and a working systemd, then installs the configured private network and verifies a private address before joining. Boat support has not been verified on a live Boat VM. Credentials go through its authenticated file endpoint into a 0600 bootstrap file, never the command-history string; the file is deleted after execution. See [Boat API](https://docs.boat.dev/openapi/boat-v1.yaml). ## Manual hosts Manual hosts require a private IP, an SSH key and a pretrusted `known_hosts` entry. They are joined with the same token flow but are never returned by control. Unknown provider hosts are reported as orphans and retained. Failed, unused acquisitions can be cancelled through the operator API/CLI; cancellation revokes enrollment under a row lock before deleting a known rental. Joined hosts must use the ordinary drain/release path. ## Fly Machines No Fly Machines adapter is shipped. Fly Machines have an exec API and private networking, but whether a Machine image supports the Docker daemon, kernel controls and systemd that `hermitboxd` uses as a fleet node is unverified. See [Machines API](https://fly.io/docs/machines/api/) and [remote builders](https://fly.io/docs/reference/remote-builder/). ## Releases Releases preserve all live local archive copies in the object store before removing a placement, not only the latest snapshot. Active sandboxes keep a draining host alive. Lost/quarantined nodes, manual nodes, unknown observed copies, insufficient healthy regional minimums, and missing stored copies prevent release. Provider deletion is tracked through uncertainty and retried by the same host identity; Hetzner waits for its GET to return not-found. No provider timeout declares a node lost. ## Join measurements A join is measured from the durable acquire timestamp to the first authenticated, reconciled, runtime-up, nonduplicate heartbeat accepted by Postgres. The trigger binds through the consumed enrollment token, and CI logs `acquireToHealthySeconds` with its sample count. Percentiles need repeated independent runs; none are published yet. ## How this is tested CI's live Hetzner test reads the repository secret `HERMITBOX_HETZNER_TOKEN` only on pushes to `refs/heads/main`. Branch pushes and pull requests run the other suites without provider credentials, and the step skips visibly when the secret is absent. The test creates a temporary network, firewall and SSH keys, restricts public ingress to the runner's SSH address, and uses strict known-host tunnels for bootstrap, node API and snapshot storage. It acquires and releases the host with the operator CLI and runs a real sandbox through the public SDK, with an edge on the runner forwarding the sandbox's agent port through the tunnel. Cleanup deletes only resources the test created. The rented host installs the released CLI and joins only on a release-signed bootstrap offer, so a change to the join script or `daemon.json` takes effect in this test after the next release. A commit that raises the version skips it with a notice until its release exists. --- # Native tools > Let your agent do it: Set up Hermitbox's native tools on this host. Run `hermitbox doctor` and tell me which tiers and tools are on, and why any are off. On the container tier, create the prepared templates with `hermitbox template create desktop`, `hermitbox template create browser` and `hermitbox template create tools`. Host changes such as the seccomp profile need root: show me those commands and run them only after I confirm. Then use the page's TypeScript calls for the browser, desktop or SSH I ask for. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md. Run headless browsers, X11 desktops, SSH sessions, and S3 bucket mounts inside container and process sandboxes. Each tool wraps a maintained open-source program, with scoped routes owned by the agent and access owned by the edge. ## A browser and a kernel ```ts // A process sandbox on a host that can run the sandboxed browser. const box = await hb.sandbox({ isolation: 'process', require: ['browser-sandbox'], }) // Take a screenshot, or drive the browser over CDP. const page = await box.browser.screenshot('https://example.com') const { url: cdp } = await box.browser() // Run Python in the same box. const python = await box.python() const answer = await python.run('6 * 7') console.log(answer.text) // 42 ``` The **container** tier provides desktops, browsers, SSH and bucket mounts as the sandbox user. The **process** tier provides browsers, Python and Node kernels, desktops and SSH through a separately verified tool bundle when the host meets each tool's prerequisites; mounts keep their capability refusal. Wasm refuses native tools. Measurements are in [speed](https://docs.hermitbox.dev/v0.2.1/reference/speed.md). `toolsVersion` is separate from the stable agent API version. ## Process tools A release carrying `process-tools.json` beside its installed agent supplies a digest-pinned runtime and a separate corresponding-source release asset. Neither enters the base installation. Without kernel network policy, the first browser or kernel request fetches the runtime over verified HTTPS, checks its archive and complete file inventory, and publishes a read-only per-user cache outside sandbox data. With kernel network policy, the node acquires that pinned runtime into its protected host cache before launching the supervisor, so a workload's egress rules cannot block trusted runtime setup. Consumers still verify the complete immutable cache; their downloads and scratch stay private to their UID and retain their existing retirement. Older agents that cannot verify a sealed host-owned cache report native tools unavailable on policed hosts until upgraded. Their ordinary per-user cache behavior remains supported. Placement and capability probes never fetch tools. Source-only builds without the descriptor name the missing artifact and keep these tools off. ### Host requirements The upstream builds are python-build-standalone CPython 3.12.16 (20261110), Node's official 24.22.1 tarball and Chrome Headless Shell 158.0.8127.18. Small launchers select the bundle's libraries and use **host glibc**, without rewriting binaries or shipping a private glibc. The complete dependency set requires x86_64 Linux with glibc **2.34** or later; the probe reports the actual host version and names the minimum on an older host. Pinned inputs, complete notices and corresponding-source directions are described in the [bundle documentation](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/process-tools/README.md). Private IPC requires enforced Landlock ABI 6 abstract-socket scopes and fresh signed proof from every live managed supervisor. Legacy or unverified peers keep tools off with a reason; unknown process history on the current boot requires a host restart. Ordinary process commands remain available. Process tools currently refuse `network: none` rather than loosening its socket restrictions. The process browser additionally requires usable unprivileged user namespaces under the host's security policy. It always keeps Chromium's sandbox, with bubblewrap providing private mount, PID, IPC and temporary-file namespaces. Its debugging pipe and scoped Unix proxy expose the same expiring browser capability through the edge; no browser TCP listener is added. `require: ['browser-sandbox']` requires both host readiness and the copy's observed launch policy. An operator can enable namespaces in the host policy; the user installer changes no sysctl, LSM profile or container policy. ### Process desktops and SSH The full desktop/OpenSSH component requires x86_64 Linux with host glibc **2.36** or later, usable unprivileged user namespaces and the private IPC/history checks above. The core browser and kernels keep their **2.34** minimum. `hermitbox doctor` reports `process-desktop` and `process-ssh` with the observed requirement when either is off. The installer does not change host policy. Xvfb and headful Chromium run with software rendering in a private PID, IPC and temporary-file view; Chromium keeps its own sandbox. Each sandbox has its own display. VNC, websockify and the desktop command adapter use scoped Unix sockets; no shared host display or VNC TCP port is exposed. The same desktop methods and expiring noVNC URL work through the HTTP edge. No window manager runs by default. ```ts // A process sandbox whose host can prove the desktop and SSH tools. const box = await hb.sandbox({ isolation: 'process', units: 4, requiredTools: ['desktop', 'ssh'], }) // Take a screenshot, then click, type and press a key. const png = await box.desktop.screenshot() await box.desktop.click(100, 100) await box.desktop.type('hello') await box.desktop.key('Return') // Open SSH with hermitbox sandbox ssh , or access.connect() with an SSH client. const access = await box.ssh() // Revoke the SSH lease when you're done. await box.ssh.revoke() ``` Optional `requiredTools` requires the verified native desktop/SSH capability during placement and again before wake. A node or tier that cannot prove it is refused by name. Omitting it keeps native service startup on demand; policed process hosts prepare the runtime archive before supervisor launch as described above. Existing container templates and calls keep their behavior; they do not claim the native process bundle's capability. `network: none` refuses these native tools while preserving its egress restrictions. Native OpenSSH serves accepted Unix connections as the sandbox's own user, with its normal authentication, host keys and command/PTY behavior. The HTTP-only user preset carries those bytes over the authenticated agent WebSocket using OpenSSH ProxyCommand. Private client keys stay in memory, and authorization stays outside persistent sandbox data. Lease capacity, expiry, revocation, wake and neighbour isolation apply to this transport too. Startup measurements comparing the process and container tools are in [speed](https://docs.hermitbox.dev/v0.2.1/reference/speed.md). ## Container tools ```sh hermitbox template create desktop hermitbox template create browser hermitbox template create tools ``` Use a released version of the three prepared images, or `--image` for your built image. The native-tools image contains OpenSSH, Mountpoint S3 and rclone, and the desktop dependencies; the desktop image selects its X11 start command. The browser image uses the official Playwright image as a donor, retaining only its open-source headless shell and FFmpeg, and publishes a sanitized flattened filesystem. No published layer contains the donor's proprietary Widevine module. Templates retain complete upstream notices and source URLs; the licence inventories are [native tools](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/native-tools-debian.json), [browser](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/browser.json), [Playwright](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/playwright.json), [desktop Python](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/desktop-python.json) and [rclone](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/rclone-modules.json). The container browser also runs under the default container policy. Its inner Chromium sandbox requires user namespaces and the approved native-tool policy; `hermitbox doctor` reports whether the caller can use them. The public `browser-sandbox` guarantee additionally requires the node's native-tool policy. A missing guarantee can be required at creation and causes placement refusal. See [host capabilities](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md) for the distinction between false and unknown. FUSE additionally requires the real `/dev/fuse` character device. Install the [host profile](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/native-tools-seccomp.json) as a protected root-owned file: ```sh sudo install \ -m 600 \ deploy/native-tools-seccomp.json \ /etc/hermitbox/native-tools-seccomp.json ``` ```toml [docker] native_tools_seccomp = "/etc/hermitbox/native-tools-seccomp.json" native_fuse = true # On AppArmor hosts, load the provided profile in enforcing mode first. native_tools_apparmor = "hermitbox-native-tools" ``` On an AppArmor host, also load `deploy/hermitbox-native-tools.apparmor` with `sudo apparmor_parser -r deploy/hermitbox-native-tools.apparmor`. It is derived from Docker's Moby profile and retains its other denials. The node requires the selected name to already be in enforcing mode; `unconfined` and complain-mode profiles are refused. On hosts without AppArmor, omit `native_tools_apparmor`. The default policy is unchanged. The host seccomp profile wraps Playwright 1.65.0's Apache-2.0 seccomp profile and explicitly permits mount/unmount and chroot syscalls. Chromium chroots inside its own user namespace; the kernel still requires that namespace's CAP_SYS_CHROOT, which ordinary commands do not have. FUSE uses a nested user/mount namespace; the sandbox never receives SYS_ADMIN in the host or original Docker namespace. Only a mount worker retains that capability inside its own namespace, sharing only the approved target. Ordinary commands/PTYs drop it. A bounded 16-MiB private `/mnt` tmpfs holds mountpoint metadata while the image root stays read-only. Native FUSE requires a non-root sandbox user; the prepared native templates use UID 1000. Namespace setup runs only for native templates or creates with mounts. Ordinary images, including root images, keep their normal bootstrap on a host that approves FUSE. Default hosts keep all capabilities dropped, read-only root, no-new-privileges and their existing seccomp policy. A request cannot select a host profile or a device. Hosts without this opt-in do not advertise `native-fuse-mounts`, so placement refuses mounted requests before starting compute. The host must permit nested user namespaces under its own LSM/AppArmor policy; this setting does not turn off an LSM. A host that refuses that operation must be configured by its operator. The node binds the container browser's inner-sandbox choice to its observed host policy through the actual agent executable's announced bootstrap support. With no approved profile, the browser uses the container's existing outer isolation and reports `browser-sandbox` off. A request that requires that guarantee is refused. Legacy agents remain strict. The process browser always requires Chromium's sandbox and refuses a host that cannot provide it. ### Desktop ```ts // A sandbox from the desktop template. const box = await hb.sandbox({ template: 'desktop', units: 2 }) // Get the noVNC URL and a screenshot. const { url } = await box.desktop() const png = await box.desktop.screenshot() // Click, type, press a key, move the pointer and scroll. await box.desktop.click(100, 100) await box.desktop.type('hello') await box.desktop.key('Return') await box.desktop.move(120, 100) await box.desktop.scroll(0, 1) ``` The display defaults to 1280×720; set `HERMITBOX_DESKTOP_WIDTH`/`HERMITBOX_DESKTOP_HEIGHT` between 64 and 8192 in the template environment. The ready-to-run desktop uses TigerVNC and JWM. The standalone Hermitbox desktop image uses Xvfb and x11vnc. Both disable the X11 TCP listener, restrict VNC to loopback and bind websockify to loopback on 6080. `desktop()` exposes noVNC with a fresh random capability in the URL fragment, valid for at most five minutes and no longer than the agent token. Minting another URL rotates access. The WebSocket must present that token; websockify's TokenFile adapter also checks wall-clock expiry. Requests are not logged with tokens. An authenticated MCP caller can use `screenshot`, `click`, `type` and `key`; screenshots are native PNG image content. ### Browser ```ts // A sandbox from the browser template. const box = await hb.sandbox({ template: 'browser', units: 4 }) // Connect with Playwright using chromium.connectOverCDP(cdp). const { url: cdp } = await box.browser() // Or take a screenshot directly. const page = await box.browser.screenshot('https://example.com') ``` In containers, CDP remains on loopback 9222. The exposed 9223 HTTP/WebSocket proxy requires a random expiring capability, delegates forwarding to http-proxy, and rewrites discovery for the edge URL prefix. Keep the returned URL private. New connections fail after expiry/rotation. Existing browser/VNC WebSockets can live until disconnection, as other authenticated streaming sessions do. Screenshots require HTTP(S) URLs without embedded credentials and return bounded PNG bytes. The browser's network access is the sandbox's own network policy. ### SSH ```ts // A sandbox from the tools template. const box = await hb.sandbox({ template: 'tools', idle: '10m' }) // Pin hostKey and pass key to an SSH client in memory. const { host, port, user, key, hostKey } = await box.ssh() // Revoke the SSH lease when you're done. await box.ssh.revoke() ``` `hermitbox sandbox ssh ` wraps OpenSSH, loads the one-time private key into a dedicated local ssh-agent over stdin, pins the returned host key, and revokes on exit. It never writes the client private key. Each call creates an independent Ed25519 key and listener. Raw SSH is routed through the edge's hold/wake front with a session-bound preface. Raw slots are absent from HTTP previews and disk-restored assignments. Revocation retires routes and closes sessions. Keys expire at the earlier of the scoped capability, five minutes and **idle from issue**; this conservative bound ensures a sandbox that sleeps past idle cannot revive access. OpenSSH checks wall-clock public-key expiry even immediately after wake. A stop/new agent invalidates old raw slots; request a new lease. Only public lease metadata reaches control. Ordinary serialization of SDK SSH handles omits `key`. New leases can also advertise `webSocketUrl` and `transport`. The CLI uses OpenSSH's ProxyCommand through the authenticated HTTP edge when its live advertisements report an HTTP-only deployment; an available raw front remains the default. Both paths use the same lease, host key, expiry, revocation and epoch checks. TypeScript `access.connect()` and Python `access.connect()` open the authenticated binary WebSocket for an SSH client; await the Python call in async mode. The connection carries OpenSSH bytes without interpreting them. Registration requires a live edge advertising a transport the agent can serve. ### Bucket mounts ```ts // Mount a bucket prefix at /mnt/data. const box = await hb.sandbox({ image: 'ghcr.io/hermitbox/hermitbox-tools:', mounts: [ { bucket: 's3://my-bucket/prefix', path: '/mnt/data', readOnly: false, credentials: { accessKeyId: process.env.S3_ACCESS_KEY!, secretAccessKey: process.env.S3_SECRET_KEY!, region: 'us-east-1', endpoint: 'https://storage.example.com', }, }, ], }) // Lists source, path, backend and state, never the credentials. console.log(await box.mounts()) ``` A mounts-only create uses the prepared tools image when no source is supplied; production operators should pin the released image explicitly. Mountpoint S3 is preferred; an image with rclone but without Mountpoint uses rclone mount. Both require working FUSE and obey the same host policy. Their normal filesystem semantics apply: Mountpoint does not promise full POSIX behavior; rclone buffers writes in a bounded private temporary cache. The agent refuses unsupported tiers and unavailable workers instead of emulating a mount. Paths must be below `/mnt` or persistent data and pass the descriptor-relative no-follow walk. Roots and agent state cannot be covered. Control seals credentials with Node's AES-256-GCM and the operator seal key, binding ciphertext to sandbox/project. Specs, logs, listings, operation responses and data archives contain no mount credentials. The agent receives them over its scoped transport and passes them only in mount worker environment, with ambient AWS config/metadata providers disabled. It serves health while holding the entrypoint until all initial mounts are ready. A failed create is deleted; a dead worker is reported and requires an explicit restart, never an implicit remount. The running-state hook initializes mounts on start/wake, and mounted-only maintenance handles autonomous agent restarts. Ready agents receive no repeated credential delivery. Mounted snapshots require explicit credentials to fork. Deletion erases sealed credentials. Preserve the operator seal key across control restarts. Mount workers run as the sandbox's own uid, so the image installs `mount-s3`, `rclone` and `fusermount3` execute-only (mode 0111). The kernel then leaves a worker non-dumpable after exec, and sandbox commands, which hold no capability, cannot read its `/proc` environment or memory or trace it; the credentials never appear in its command line. The agent execs each worker from a sealed, execute-only copy of itself in memory, so the worker is not dumpable from its first instruction either, while `/.hermitbox-agent` stays readable. A worker refuses to start a readable helper, so a custom image that installs one readable fails its mount instead of exposing the credentials. This does not hold against a same-uid process with `CAP_SYS_PTRACE`, which no sandbox command is given. Python exposes the same callable handles in sync and async clients: `box.desktop()`, `box.desktop.screenshot()`, `box.browser()`, `box.browser.screenshot(url)`, `box.ssh()`, `box.ssh.revoke()` and `box.mounts()`; await them in an async context. Credentials use the public camelCase mount fields inside the `mounts` list. See [speed](https://docs.hermitbox.dev/v0.2.1/reference/speed.md) for measured readiness. ## How this is tested CI's ordinary-user acceptance exercises real application input, screenshots and noVNC through the edge, plus SSH commands, HTTP wake, the installed CLI and both Python SDK modes. --- # Code interpreters > Let your agent do it: Run code in a Hermitbox sandbox with a persistent interpreter. Warm the templates with `hermitbox template create python-interpreter` and `hermitbox template create node-interpreter`, then run `hermitbox sandbox python -c 'print(2+2)'` and show me the output. When I want code from a program, use the page's TypeScript calls: a sandbox from the `python-interpreter` template, then a context that keeps its variables between runs. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md. Run persistent Python and JavaScript code contexts inside a container or process sandbox. Variables survive across calls, and plots return as PNG bytes. ```sh # Warm the Python and Node interpreter templates. hermitbox template create python-interpreter hermitbox template create node-interpreter # Run Python in a sandbox from the warmed template. hermitbox sandbox python -c 'print(2+2)' ``` The CLI without a sandbox ID creates and deletes a sandbox from the warmed Python template. With an ID it attaches to that sandbox. Without `-c` it keeps a multiline REPL; Jupyter's `is_complete` reply decides when to submit input. Ctrl-C interrupts the kernel. ## Run code in a context ### Start a context ```ts // A sandbox from the warmed Python template. const box = await hb.sandbox({ template: 'python-interpreter', isolation: 'container', }) // The default Python context, already warming. const py = await box.python() ``` ### Run code ```ts await box.write('sales.csv', 'sales\n10\n20\n') // Variables live on between calls. const summary = await py.run(` import pandas as pd df = pd.read_csv('sales.csv') df.describe() `) console.log(summary.text) ``` `summary.html` and `summary.json` hold the other representations. ### Save a chart ```ts import { writeFile } from 'node:fs/promises' // Plots come back as PNG bytes. const chart = await py.run(` import matplotlib.pyplot as plt plt.plot([1, 2, 3]) plt.show() `) await writeFile('chart.png', chart.png!) ``` ### Stream output ```ts // Events arrive while the code runs. for await (const event of py.stream('for i in range(3): print(i)')) { console.log(event) } ``` ### Use another context ```ts // A named context keeps its own variables. const analysis = await box.python({ context: 'analysis' }) await analysis.close() ``` ### Interrupt, restart and close ```ts // Interrupt running code, restart the kernel, then close the context. await py.interrupt() await py.restart() await py.close() // Delete the sandbox when you're done. await box.delete() ``` Python has the same handles in synchronous and asynchronous client contexts. `result.png` is `bytes`; TypeScript returns `Uint8Array`. Python `kernel.run` in an asynchronous context starts an eager task, so an interrupt can be issued while awaiting that task. `stream` yields events as they arrive. Every MIME bundle and its metadata remains available in `result.results` and `result.events`; the convenience views search the last representation of each MIME type. `stdout`, `stderr` and structured `error = {name, value, traceback}` remain separate. ## Agent contract The interpreter templates start warming the default context at agent startup, and `box.python()` or `box.javascript()` reuses it and waits for its Jupyter-ready handshake. HTTP health stays responsive while scientific imports warm. Named contexts are independent. A context is a supervised process: it appears in `box.processes()`, and its ID and PID appear in `box.kernels()`. The [Rust-owned agent document](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/agent/openapi.json) advertises `kernelsVersion: 1` on health, independently of agent API version 2. Public control and node protocols are unchanged. | Request under `/_hermitbox/kernels` | Effect | | --- | --- | | `POST {language: "python" or "javascript", context?: string}` | Start/reuse a context; return id, language, context, processId, pid, state. | | `GET` | List contexts, including dead contexts. | | `POST /{id}/execute {code, timeout?: seconds}` | NDJSON, one event per line, ending in `done`. | | `POST /{id}/interrupt` | Signal the supervised kernel group independently of its execution queue. | | `POST /{id}/restart` | Stop and reap the old kernel, then start a fresh process with the same context id. | | `POST /{id}/complete {code}` | Jupyter input-completeness reply, for the REPL. | | `DELETE /{id}` | Stop the context and remove it; idempotent after removal. | | Event `type` | Other fields | | --- | --- | | `stream` | `stream: stdout or stderr`, `text` | | `result` | `data` (all MIME representations), `metadata`, `executionCount` | | `display` | `data`, `metadata`, nullable `displayId`, `update` | | `error` | `name`, `value`, `traceback: string[]` | | `done` | Nullable `executionCount`, `status` (`ok`, `error`, or an explicit transport/timeout state). | Language errors are result data. Missing completion or a broken transport is an unknown outcome; neither SDK retries code. A dead context stays dead until explicitly restarted. Executions are serialized per context; interrupt/close do not wait on the execution mutex. Queues and capture are bounded, timeouts enforce capability limits, and timeout kills the kernel instead of allowing its code to continue silently. The default timeout is 30 seconds, or the token's lower ceiling when a project sets one; the SDKs send a timeout only when the caller names it, so the agent's default applies otherwise. Each sandbox holds at most 16 contexts. MCP tools `run_python` and `run_javascript` use these same owners and return image MIME output as MCP image content, alongside text events. Connection files are mode 0600 in a private temporary directory outside persistent data. Container Jupyter channels use a random HMAC key on sandbox-local loopback. Process kernels use abstract Unix sockets inside the supervisor's enforced Landlock ABI 6 scope; they add no TCP listener. A plain pathname socket is insufficient for shared-UID isolation. The owner's connection succeeds while a separate same-UID agent cannot connect. Fresh signed scope proof from every managed peer is required; unverified legacy peers or unknown process history keep native tools off with a reason. The agent launches kernel executables directly, never a `jupyter` command. Container images run as the sandbox user with existing resource limits. Process kernels lazily fetch the [verified upstream bundle](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md#process-tools), using its unchanged Python/Node builds, bundle-owned libraries and host glibc >=2.34. They currently refuse `network: none` because private channels cannot yet be prebound under that policy; ordinary egress denial remains enforced. Wasm refuses native contexts. Startup measurements are in [speed.md](https://docs.hermitbox.dev/v0.2.1/reference/speed.md). Snapshots preserve data, not live Python variables; waking a stopped sandbox starts a fresh kernel. Live state exists only while that kernel survives. ## Versions and licences | Template/tool | Pinned version | Licence | | --- | --- | --- | | Python image | CPython 3.12.14, Debian bookworm | PSF-2.0 and historical grants; Debian package notices retained. | | ipykernel | 7.4.0 | BSD-3-Clause | | NumPy | 2.5.4 | BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0; wheel notices include numerical runtimes. | | pandas | 3.1.1 | BSD-3-Clause | | matplotlib | 3.11.2 | Matplotlib permissive agreement and PSF-2.0; this is not Mozilla MPL. | | SciPy | 1.18.1 | BSD-3-Clause and bundled numerical-library notices. | | scikit-learn | 1.9.1 | BSD-3-Clause | | requests | 2.34.2 | Apache-2.0 | | Pillow | 13.0.0 | MIT-CMU | | Node image | Node 24.22.1, Debian bookworm | MIT and bundled notices; Debian package notices retained. | | IJavascript / jp-kernel / NEL | 5.2.1 / 2.0.0 / 1.3.0 | BSD-3-Clause | | Chart.js / napi-rs canvas | 4.6.1 / 1.1.0 | MIT; bundled Skia/Chromium BSD-3-Clause notices retained. | | ZeroMQ.js | 6.8.0 | MIT AND MPL-2.0, official v5 compatibility API for jmp. | | Rust jupyter-zmq-client / jupyter-protocol | 3.0.1 / 2.0.3 | BSD-3-Clause | | Rust zeromq | 0.7.0 | MIT | The [Python](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/python-interpreter/README.md) and [Node](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/node-interpreter/README.md) image descriptions list layer notices and source availability. The resolved [Python](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/python-interpreter.json), [Node](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/node-interpreter.json) and [base-package](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docs/licences/interpreter-base.json) inventories record every version and licence; Rust dependency licences are enforced by cargo-deny ([deny.toml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deny.toml)). SHA-256 wheel hashes, npm integrity hashes and base manifest digests are pinned. The Python lock targets Linux x86_64 / CPython 3.12, matching release builds. Jupyter messaging 5.5 was read at jupyter_client 8.10.0 commit `978361b3785dcd9cba6c733f4555e833e88fc0df`; the adapter uses the upstream Rust client. IJavascript 5.2.1 is pinned to published commit `7011c92ebcb858d1aca4edca3adb4e0ea64db174`. Neither evaluated JavaScript kernel has a recent core release. TSLab 1.0.22 is not used because it emits values and errors as console text. IJavascript provides Jupyter rich results and errors; its legacy ZeroMQ dependency is routed to the current official compatibility API without copying upstream code or implementing a wire server. Python preloads NumPy, pandas and pyplot, renders inline PNG/SVG with Agg, and registers JSON representations for scalar values and DataFrame rows. Other installed scientific packages load on demand. Measurements and their limits are in [speed.md](https://docs.hermitbox.dev/v0.2.1/reference/speed.md). ## How this is tested CI runs both installed kernels through the TypeScript and sync/async Python SDKs, including state, charts, errors, interrupt and restart. The [acceptance suite](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/e2e/interpreter.e2e.test.ts) covers both templates, both SDK modes, state, named contexts, PNG, traceback, interrupt, restart, dead processes, MCP and the CLI. --- # celld engines and the Docker socket experiment # celld engines and the Docker socket experiment A patched celld runs its containers as Hermitbox sandboxes through the public API, beside its default Docker engine. The native seam is in [integrations/celld/upstream](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/integrations/celld/upstream/README.md), based on public celld 0.6.3 at `8702f6d186c77698dbfb30cf29e3b1922a88f008`. It keeps celld's coordinator and default Docker implementation and adds a Hermitbox public-API implementation. The native backend supports celld's single-node development store. Distributed ownership is refused until a remote fencing protocol is designed and proven. Host policy owns isolation; local runtime/DNS overrides, root signals and exec are explicit unsupported operations. Creation is sent once, with its key durably recorded first; an uncertain reply blocks replacement. Existing remote compute must be deleted and absent before a replacement. The project key stays only in the service environment and memory. Production images must already be available through a permitted registry reference; local CI shares the dev image store. ## Native comparison CI measures 30 starts and first HTTP requests for each engine on the same host, from the same patched celld 0.6.3 executable built with the development profile, debug information and incremental compilation disabled. The Worker, Python server, Dockerfile and class configuration are unchanged from the public release. Each cell's cleanup is outside its timer. On one two-core Intel Xeon Platinum 8370C host running Linux 7.0.0-1017-azure, with n=30 for every row and backend (p50 is the sorted upper median, p90 the nearest-rank observation): | Operation | Local engine p50 / p90 ms | Native Hermitbox p50 / p90 ms | | --- | --- | --- | | backend start | 142.00 / 154.00 | 215.00 / 233.00 | | start through first HTTP response | 1881.78 / 1889.72 | 1274.87 / 1284.34 | | warm HTTP response | 5.50 / 5.72 | 5.74 / 7.24 | The native backend adds 79 ms to backend-start p90 and 1.52 ms to warm-response p90 on this host. Its start-through-first-response sample is lower; that includes celld's readiness and polling sequence, and is not attributed to an isolated transport or kernel optimization. These figures are for this host only. ## Docker socket experiment The separate [Unix socket spike](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/integrations/celld/src/docker-api-spike.ts) is unshipped and absent from node features and package exports. It implements `_ping` and `version` discovery using API version facts read from the baseline engine. Unsupported operations answer 501 explicitly. It does not import arbitrary image tars, start privileged fence containers or relax host policy. celld's engine builds and loads images and installs a privileged host-network fence; those operations have no public sandbox API equivalent, and a Unix listener alone cannot safely make that engine compatible. CI runs the unchanged release and its own example with `DOCKER_HOST` pointed at the private mode-0600 socket. Discovery passes; the release then fails building its example image, because BuildKit's POST `/grpc` and its buildkit-container inspection receive explicit 501 replies, and it exits 1. This route has no start or first-request samples. No `docker-api` node feature is advertised. ## How this is tested CI builds the patched public source and runs celld's own container example through both its local engine and the native Hermitbox backend; all 30 samples complete for both engines. CI keeps every sample, failed cohorts included, in `celld-native-measurements.json`. The socket experiment's requests, exit status and output are kept in `docker-api-spike.json`. --- # Operate Hermitbox > Let your agent do it: Help me operate my Hermitbox fleet from a trusted operator host. Export `HERMITBOX_OPERATOR_API`, `HERMITBOX_OPERATOR_TOKEN` and `HERMITBOX_OPERATOR` from the protected control environment, never copying the token into this chat, then run `hermitbox node ls` and summarize each node's state. To add a node, issue a token with `hermitbox node token ` and give me the join command to run on that node, with the token in the environment and never in sudo's arguments. Ask me before you drain, retire or mark a node lost. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/operate.md. # Operate Hermitbox The operator API owns node identity, lifecycle, placement and history; the public API owns sandbox lifecycles. Nodes never choose assignments. For an ordinary account, follow [installation](https://docs.hermitbox.dev/v0.2.1/get-started/install.md). Local upgrades and purge keep their files below home. Use the same guide to install on a Linux systemd server. `hermitbox up --check --domain sandboxes.example.com` shows the server install plan when run as root. Debian and Ubuntu install missing Docker from Docker's own repository and nftables from apt. Other systemd Linux hosts need Docker and nftables installed first. The release installer checks the first download against the SHA-256 digest built into the script for that asset and architecture. It keeps Postgres and the S3 store in persistent Docker volumes, runs control and edge as systemd units, enrolls the local daemon and explicitly allows alpine images unless `--allow-image` is given. A repeated run retains credentials, data, binaries and files already matching the desired state. The domain is immutable until existing public address assignments are migrated deliberately. ## One-box layout and TLS Control, operator, node endpoint, Postgres and S3 bind to loopback in the one-box setup. Public HTTP/TLS/raw fronts belong to edge. On a server installed with a domain, edge forwards TLS for that exact hostname to the local `hermitbox-api-tls` unit. The unit obtains and renews the API certificate via ACME on TCP 443 and keeps its account and certificate keys in private service state. Point the API hostname's DNS A record at the server and keep TCP 443 reachable for renewals. The API certificate covers that hostname. Check `journalctl -u hermitbox-api-tls` if certificate validation fails. Upgrades preserve existing named installations' transport, including operator-configured TLS proxies. New named server installations use managed TLS. Each sandbox owns its own TLS certificate and uses separately configured DNS. The API key printed once by up configures public clients: ```sh # Use the initial key, printed once. export HERMITBOX_API_URL=https://sandboxes.example.com export HERMITBOX_API_KEY= hermitbox run --image alpine:3.22 -- echo hello ``` Control/edge/operator/store/Postgres credentials generated by up are in root-owned 0600 unit environment files under `/etc/hermitbox`. Storage containers source a read-only mount of that file; Docker's saved container configuration contains no generated password. The daemon's existing identity format requires private certificate keys under its root-only `/var/lib/hermitboxd/identity` and a one-time enrollment token file, removed after enrollment; both are mode 0600. Do not copy an enrolled state directory into an image. If up stops between marking the initial key printed and displaying it, create another with the operator API; `hermitbox up` does not print it again. ## Add nodes and daily operations Join control, edge and nodes through a private network (for example WireGuard). Configure the node endpoint's names/addresses and firewall before joining remote hosts. Only control reaches `hermitboxd`'s mutual-TLS management API; only edge reaches edge-audience ports. Images are explicitly allowed by host policy, never by a public request. Use `hermitbox node token ` with `HERMITBOX_OPERATOR_API` and `HERMITBOX_OPERATOR_TOKEN` on a trusted operator host. Install the current Hermitbox CLI independently from the project's release distribution on the joining node, then run the returned command (`export HERMITBOX_JOIN_TOKEN='' && sudo --preserve-env=HERMITBOX_JOIN_TOKEN hermitbox node join`) as a user who can use sudo, and append `--allow-image ` for each permitted image. Never pass the token as `sudo HERMITBOX_JOIN_TOKEN= hermitbox …`: that puts it in sudo's own arguments, which every account on the host can read while the join runs. The local CLI verifies the bootstrap's ML-DSA-65 signature with compiled release keys; the fleet CA authenticates transport only. The authenticated script pins both executable digests before any installation or execution. `--verify-only` checks the artifacts without installing them. Unsigned preview builds cannot bootstrap remote hosts. Provider cloud-init installs the verifier from the independent project distribution before joining; no verifier key comes from the fleet. One-box installs publish the daemon and its detached signatures under `/opt/hermitbox/fleet`, readable by control. The daemon's identity and active binary stay under root-only `/var/lib/hermitboxd`; exposing public release artifacts does not grant control access to that tree. Use `--address` when the host has multiple possible private addresses. Then `hermitbox node ls` shows active/healthy and placement begins. XFS reflink makes snapshots cheap until data changes; ext4 works with full copies and needs extra disk space. ```sh # Use the operator token from the protected control environment. export HERMITBOX_OPERATOR_API=http://127.0.0.1:8081 export HERMITBOX_OPERATOR_TOKEN= export HERMITBOX_OPERATOR=operator hermitbox node ls hermitbox node get hermitbox node events hermitbox node summary hermitbox node drain hermitbox node undrain ``` Prometheus can scrape `/metrics` on the operator listener with its existing bearer token. Configure the scraper's authorization credentials file on the trusted operator host. Control reports HTTP request counts by registered route, method and status, response latency histograms, and open, idle and waiting counts for the query and lock pools. A long-lived stream reports the time to its response headers. The public sandbox API continues to expose each sandbox's own measurements. Run `hermitbox sandbox top ` to follow CPU, memory, disk and network observations without waking the sandbox. A missing counter is `null`. To print retained minute samples and exit, use `hermitbox sandbox top --since 2026-11-01T00:00:00Z --once`. The TypeScript method `sandbox.top({ since, follow: false })` and Python method `sandbox.top(since=since, follow=False)` iterate the same samples in time order. A live sandbox keeps its history across stops and wakes. Run `hermitbox sandbox logs --follow` to follow application output. Each line identifies the process and its stdout or stderr stream. The sandbox journal retains bounded output from the entrypoint, commands, shells and terminals across agent restarts. Process arguments, input, environment and internal tool transfers stay outside the journal. Run `hermitbox sandbox why ` or call `sandbox.why()` in either SDK to read the last 100 recorded lifecycle decisions, newest first. Each decision includes its timestamp, cause and explanation. The history distinguishes idle sleep, requested sleep, edge wake, recovery and scheduler refusals. The same response includes recent destinations seen by the sandbox's hostname gateway. HTTP and TLS entries marked `reached` identify a verified upstream TCP connection. A `denied` entry records a DNS, HTTP or TLS policy refusal. Each entry gives the host, service and last observed time. The gateway summarizes its latest 64 distinct destinations per sample, and control retains the latest 128 host, service and outcome combinations across placements. `truncated` records evictions or a shortened sample. Nodes send up to 256 KiB of observations per heartbeat after reserving space for required state. Successive heartbeats take turns across sandboxes. Direct traffic outside the gateway has no hostname observation. `coverage: unavailable` means the sandbox has never reported a gateway sample. Use `hermitbox doctor --fleet` on a trusted operator host to check the control measurements. It reads `HERMITBOX_OPERATOR_API` with `HERMITBOX_OPERATOR_TOKEN`. Use `hermitbox doctor --metrics ` for a node or edge metrics listener. Both commands accept `--json` and exit with status 1 when a reported signal needs attention. They read the service directly. For Grafana, import the [host dashboard](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/observability/host.json) or the [fleet dashboard](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/observability/fleet.json). Select a Prometheus data source and a scrape target. The host dashboard reads the node ops listener. The fleet dashboard reads one control instance at a time so shared archive and lease records are counted once. Add [alerts.yml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/observability/alerts.yml) to the Prometheus `rule_files` list and reload Prometheus. The rules report sustained node reconciliation issues, unavailable control metrics, failed uploads and a stale edge route feed. The edge rule uses the edge metrics listener. Run `promtool test rules deploy/observability/alerts.test.yml` to check incident and recovery cases. Drain stops new placement and upkeep moves assigned sandboxes when another node has room. It can interrupt applications; schedule maintenance appropriately. With nowhere to move, data stays on the old node. A full node refuses new work; a sleeping sandbox can move before wake when memory elsewhere is needed. Snapshot upload must complete before the last local copy is released. Inspect sandbox events and node issues before retrying failures. ## Unresponsive hosts Defaults become suspect after 15 seconds and unavailable after 45 seconds; health is measured using database time. Inspect `hermitbox node get`, the provider console/network, `journalctl -u hermitboxd` and `hermitboxd doctor`. A daemon restart leaves containers running; a host reboot resumes only after control authorizes it. A network partition never authorizes another live copy by itself. When the host is permanently lost, first fence it so it cannot run: power it off through a provider that guarantees it stays off, boot rescue, or remove it from the private network and edge's reach. Then use an operator confirmation, for example: ```sh hermitbox node lost --fenced-by power-off --reason 'disk failure' ``` The operator API accepts power-off, provider, network or none as the proof category; record the actual action in the reason. A beating host is refused unless explicitly forced. Upkeep rebuilds under a new epoch from the newest uploaded snapshot when capacity exists. Work after that snapshot exists only on the lost host. With no uploaded snapshot, do not invent an empty rebuild. If a lost host returns, old copies are fenced and retained; the edge closes stale connections. Inspect `fork.detected`, recover requested data out of the fenced directory before deleting it, and reinstate only after resolving which copy is authoritative. If no rebuild happened yet, `hermitbox node reinstate ` restores its assignments. Retire only once placements have moved: `hermitbox node retire `. Retirement revokes credentials; wipe the host before reuse. ## Certificates and upgrades Nodes renew automatically before expiry. An expired/lost identity requires an operator token naming its existing node id, via `POST /fleet/v1/tokens` with region and node, then the usual join line. That re-enrolls the same node without discarding its placements. A failed re-enrollment restores the prior identity where possible; inspect its journal. Replacing a compromised fleet CA cuts nodes off until each re-enrolls under the new CA; dual CA trust is not implemented. Deploy the daemon, control, edge and clients from one release. Every signature a release carries (`hermitboxd.sig`, the join bootstrap's, the host bundles' and the server asset manifests') is ML-DSA-65 (FIPS 204). `release.yml` makes them with Bun (`control/tools/release-sign.ts`), since the runners' OpenSSL has no ML-DSA, from the `release` environment's `HERMITBOXD_RELEASE_KEY`: an ML-DSA-65 PKCS#8 private key, in the seed form or the seed-and-expanded form `openssl genpkey` writes, whose public half is in `deploy/release-keys.pem`, or the release stops. Control serves the signed daemon release to enrolled nodes; one healthy node per region upgrades at a time. A node keeps `hermitboxd.prev` and rolls back if its new daemon cannot reconcile and get an accepted heartbeat. Regions stop on a failed rollout. `HERMITBOX_UPGRADES=off` stops offers. Verify release attestations and `SHA256SUMS` as described in README. Never push tags by hand; the release workflow creates them after CI. For a manual release, select the `main` branch after its push CI has passed on the commit to publish. The release jobs build and tag that verified commit. Repository owners should configure the GitHub `release` environment’s deployment rules to allow only the `main` branch, with no tag rules, so GitHub also enforces the restriction on access to signing credentials. ## Disk, duplicates, observation and undo Watch free disk near the configured floor, snapshot/upload failures, multipart uploads left in the store, certificate expiry, unavailable nodes, duplicate identities, fork.detected and placement errors. Delete incomplete multipart uploads with a bucket lifecycle rule. Do not drop local copies whose only store copy is missing. Deleted data stays in daemon trash for its configured retention; `release` and `destroy` are deliberate operations. A duplicated enrolled disk image becomes quarantined. Find and stop the duplicate, remove its identity, then `hermitbox node clear-quarantine `. Templates must have an empty machine-id before first boot. Keep metrics private: `hermitboxd`'s ops listener, edge's metrics listener and the operator summary. No event or metric is a reason to declare a host lost by a timer. Up prints its undo commands. Stop and disable `hermitbox-api-tls` if installed, then `hermitbox-edge`, `hermitbox-control`, `hermitboxd`, `hermitbox-store` and `hermitbox-postgres`. Remove their managed unit files and reload systemd. Keep `/etc/hermitbox`, `/var/lib/private/hermitbox-api-tls` and Docker volumes until credentials, backups and data are saved. Removing the `hermitbox-postgres` and `hermitbox-store` volumes and `/var/lib/hermitboxd` permanently deletes data and is always a separate explicit operator action. Docker, nftables and Docker's `daemon.json` remain installed; existing Docker settings are merged, and running containers cause a reload rather than an automatic restart. ## CLI installation and client credentials The release includes `install.sh` in SHA256SUMS and the release attestation. On Linux x86_64 and aarch64 the script verifies the server CLI before invoking it, or the bootstrap archive before extracting it. An alternate release mirror must serve bytes matching the same digest. For the server preset, the CLI then verifies the asset manifest's ML-DSA-65 signature with its compiled release keys. The signed manifest identifies the CLI's release and architecture and pins the service binaries, signature files, control archive, namespace helper archive, and VM descriptor when included, and the release image's multi-architecture index digest. For a local install with `--from-dir`, put `hermitbox-server-assets-linux-.sha256` and its `.sig` file beside the release assets, using `x64` or `arm64` for ``. After installation, up writes the public API URL and key for the invoking user to the file the CLI reads (0600, private directory): `$XDG_CONFIG_HOME/hermitbox/client.json` when `XDG_CONFIG_HOME` is absolute, else `~/.config/hermitbox/client.json`. The local CLI reads that file without manual exports. sudo usually drops `XDG_CONFIG_HOME`, so the CLI also reads `~/.config`'s file when the XDG one is absent. All root operations finish before up drops groups/gid/uid to write that file. `HERMITBOX_CONFIG` can select another owned/private client file, and is then the only file read; an environment API URL never borrows a saved key for a different endpoint. `HERMITBOX_API_KEY` explicitly overrides saved credentials. CA, operator and store credentials remain root-only. Up prints the initial key once; repeated up prints a `hermitbox config key` command reference instead. That explicit command reads the user's key when shell setup is wanted. Up's final output is three export lines followed by the next command. The bootstrap policy allows official Alpine and Node images; repeat `--allow-image` to replace it. The operator scrape also reports placement evaluations and bounded refusal reasons. A refused evaluation increments each distinct reason that excluded its candidates once. Archive upload gauges count local, uploading and failed copies. Store lease gauges count current placement records and distinguish those with a matching fence. These records describe control's view of the lease. A timed-out or failed database read omits the queue and lease gauges and sets `hermitbox_control_fleet_metrics_available` to zero. HTTP and connection-pool metrics remain available. ## Tracing Control returns a W3C `traceparent` header on both listeners. The TypeScript SDK exposes its trace ID as `HermitboxError.traceId`. Python exposes `HermitboxError.trace_id` in both synchronous and asynchronous calls. The CLI prints the ID on an HTTP failure. Control passes the active context to its node requests. `hermitboxd` records the trace ID in its structured request logs and returns its child trace context with each API response. The edge HTTP relay sends a child context to control, the sandbox agent and exposed applications. Its refusal and error responses carry the same trace ID as its relay logs. An operator can export control, node and edge spans to an OTLP/HTTP receiver by setting `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` to its full trace URL, or `OTEL_EXPORTER_OTLP_ENDPOINT` to its base URL. Spans contain route patterns, methods and response status. With both variables unset, no spans are exported. ## Audit history Authenticated project requests and operator API requests have a PostgreSQL audit history. Read your project's records at `GET /v1/audit`. Operators can read `GET /operator/v1/audit` on the private listener and filter by `project`. Both return the newest records first. Set `limit` to 1–100 and pass the last record's ID as `before` for the next page. Each record identifies the actor, project, key and sandbox when known, the HTTP method and route, the admission time and the response status. A null status means completion could not be recorded. Control returns the original response after an admitted operation and logs the audit ID if the completion write fails. The source is the direct peer address, including the proxy address when one is in use. Headers, request bodies and query strings are excluded. Control retains records for `HERMITBOX_AUDIT_RETENTION_DAYS` days (90 by default) and removes older records during upkeep. --- # Templates from code > Let your agent do it: Make a Hermitbox template from my project, so new sandboxes start with it ready. Write a `hermitbox.template.ts` that calls `hb.template()` with a name, a base image, a copy of the project and its install command, as the page's first example does, and follow the page's section for my framework if it has one. Build it with `hermitbox template build -f hermitbox.template.ts`, then create a sandbox from the template and show me that the project is there. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/templates-from-code.md. A template is a sandbox prepared once and saved, so every sandbox made from it starts ready. ```ts // Copy the project in, install its dependencies, and save the result. const template = await hb.template({ name: 'my-api', from: 'node:22', copy: [['./', 'app']], run: ['cd /data/app && npm ci'], }) // Each sandbox from it starts with the dependencies installed. const box = await hb.sandbox({ template: 'my-api' }) ``` `hb.template({ name, from, copy, run, env, user, require, workdir, ready, start, sparePorts })` prepares a sandbox with the files and process APIs, snapshots it, and registers an immutable version. `copy` stays local; only the build plan and the finished snapshot reach control. A failed build cleans up its sandbox, and `template.rebuild()` creates the next version. The Python sync and async clients accept the same fields. Each `run` and `ready` command has up to ten minutes, and a failed one says how it ended. `hermitbox template build -f hermitbox.template.ts` runs that builder from the CLI. `hermitbox template create` supplies built-in plans for `python-interpreter`, `node-interpreter`, `desktop`, `browser` and `tools`; `--image` selects an operator-built image. Creating from a ready template clones its snapshot and never repeats the install. See [interpreters](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md) and [native tools](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md) for their dependencies, host prerequisites and limits. ## Next.js project Request `nextjs` on a host serving containers. The first request prepares a project snapshot on an eligible node and waits for its locked dependencies and tests. The node's image policy must admit the pinned Node image. Concurrent requests share that preparation. Each sandbox forks a copy from an eligible node in its requested region and starts its own development server. The fleet also warms copies on other eligible nodes. To select a different pinned image or build explicitly, use `hermitbox template create nextjs`. ```ts const box = await hb.sandbox({ template: 'nextjs' }) console.log(box.previewUrl) ``` Creation waits for the development server to answer before exposing its port. Edit `app/page.jsx` to see hot reload at the returned URL. Python clients expose the same URL as `box.preview_url`. If readiness fails, the error identifies the sandbox so you can inspect its logs or delete it. ## Vite projects Choose `vite-react` for React or `vue` for Vue. Both use the same pinned Node runtime and require a container-capable node. Their first build installs the locked dependencies and tests the production build. Each fork serves its own Vite development preview on port 5173. Edit `src/App.jsx` or `src/App.vue` in the fork to see updates in the browser. ## Node HTTP APIs Choose `express`, `hono` or `fastify` to fork a working HTTP API on a container-capable node. Each starter uses the same pinned Node image as Next.js. The first build installs its locked dependencies and tests the root JSON route over HTTP. Each fork starts its own server on port 3000 and returns its preview URL once the route answers. Edit `app.mjs` to change the response at that URL. Run `npm test` to exercise the routes and `npm run build` to check the JavaScript entry points. ## SvelteKit Choose `sveltekit` for a SvelteKit web project. The warm build serves the production Node adapter's output over HTTP to check the home page. Each fork starts Vite on port 5173 and returns the ready preview URL. Edit `src/routes/+page.svelte` to see the page update. Use `npm run build` and `npm start` to run the production server. ## Databases and caches Request `hb.sandbox({ template: 'nextjs', services: ['postgres'] })` to start the project with its own PostgreSQL database. Its application receives `DATABASE_URL`. Each fork owns the database files under `/data` and PostgreSQL listens on container loopback. The plain starter has a separate snapshot. Preparing the composed starter verifies the PostgreSQL archive for the project image’s architecture and C library before extracting it. Choose `services: ['redis']` for a fork with its own loopback cache. Its application receives `REDIS_URL`. The server waits for that fork’s Redis process to answer before launching the application. Its append-only log lives in the fork’s persistent data directory. The same field works with the catalog’s Node and Python projects, Alpine language projects, local model server and desktop. Each composed project warms its own snapshot. An explicit application entrypoint still starts after its service is ready. Repositories imported on one of these pinned images can request the same service by template name or ID. The service uses the project’s published snapshot and start command. Publishing a new version warms a separate composed snapshot on first use. Keep the reserved service directory at `/data/.hermitbox/services` available for the installer. ## Start a Git repository `hermitbox template from ` prepares the current commit of an HTTPS repository or a local Git checkout and starts a fork. It prints the commit, selected image, install and start commands, port, sandbox ID and preview URL. A local import uses the committed files, and the build runs inside a sandbox. The importer recognizes: - Node projects, through their npm scripts and lockfile. - Python projects, through their `pyproject.toml` or `requirements.txt`; Django, FastAPI and Flask have starter commands. - Go modules, Rack applications and PHP public document roots. - Cargo binary projects, honoring a checked-in lockfile. - Java projects, through their committed Maven wrapper or a standalone `Main.java`. A configured Spring Boot plugin and launcher select its development server. - .NET projects, selecting a single executable or web project and binding ASP.NET Core to the requested port. Supply `--start` for libraries and ambiguous entry points. The importer reads development-container image and port settings and a Dockerfile's base, exposed port and command. Use `--image ` for a custom built image. Override individual guesses with `--port`, `--install`, `--start` and `--check`. Python commands run in a virtual environment under `/data`. The project needs an HTTP entry point and container service, and the node's image policy must admit the selected image. Imports follow the project's resource defaults; use `--units` to request a specific CPU and memory allocation. ## Astro Choose `astro` to fork a static site whose production home page has already passed its build test. Each fork starts Astro on port 4321. Edit `src/pages/index.astro` to reload the page at the preview URL. Run `npm run build` to write the production site to `dist/` and `npm run preview` to serve it. ## Nuxt and React Router Choose `nuxt` to fork a Nuxt application with a ready preview on port 3000. Edit `app/app.vue` for Vue hot reload. Run `npm test` to build and exercise its Nitro Node server, or use `npm run build` followed by `npm start` for the production site. Choose `react-router` for server-rendered React Router in framework mode. Edit `app/routes/home.jsx` for Fast Refresh and `app/routes.ts` to declare routes. The build tests the production route handler. Run `npm start` to serve its output. ## Angular Choose `angular` for an Angular standalone component served with Vite. Edit `src/app.html` or `src/app.ts` for component updates. Run `npm test` to compile and check the site, `npm run build` to write `dist/` and `npm run preview` to serve the production output. ## SolidStart Choose `solidstart` for a server-rendered Solid application. Edit `src/app.jsx` to update the interactive page. Run `npm test` to build and exercise its Nitro Node server, or `npm run build` followed by `npm start` to serve the production output. ## Expo for web Choose `expo-web` to start an Expo SDK app for the web. Edit `App.jsx` to change its React Native Web components. Run `npm test` to check the Metro production export and `npm run build` to write the static site to `dist/`. ## Python projects Use `python` for the standard-library web server, or choose `flask`, `fastapi` or `django` for a running application. Each serves a preview on port 8000 and includes a runnable unittest. Edit `public/index.html` in the Python starter or `app.py` in a framework project. Framework forks include their installed virtual environment and reload Python edits. ## Embedded databases Choose `sqlite` or `duckdb` for a seeded database and a JSON preview on port 8000. Edit `query.sql` in the fork and refresh the preview to see up to 100 rows. The preview opens a read-only connection. Local project scripts can open the same database for writing, and each fork keeps its own database file. ## Node and standalone data services Choose `node` for a Node project using the built-in HTTP server, test runner and file watcher. Edit `store.mjs` to update its preview on port 3000. Choose `postgres` or `redis` to start a fork-local database with the same JSON preview. Updating row 1 of PostgreSQL’s `messages` table or Redis’s `message` key changes the next preview response. Each project’s `AGENTS.md` includes its client command. ## TypeScript runtimes and APIs Choose `bun` or `deno` for a TypeScript HTTP project running on the selected runtime. Edit `app.ts` to update the response. Both projects include native tests and a watched preview on port 3000. Choose `nestjs` for a TypeScript NestJS API. Run `npm test` to check the API and `npm run build` to compile it. Each fork starts Nest in watch mode. ## Native HTTP projects Choose `go`, `ruby` or `php` for a native HTTP project on a container host. Edit `main.go`, `message.rb` or `public/index.php` and reload the preview. The Go project rebuilds automatically. Each project has tests and an `AGENTS.md` with its run and build commands. Choose `rust` or `axum` for a Rust HTTP service with a locked Cargo build, source tests and an editable preview. ## Other web frameworks Choose `java`, `dotnet` or `aspnet` to run the JDK HTTP server, a .NET socket server or an ASP.NET Core API. Edit `Main.java` or `Program.cs` to update the running project. Choose `spring-boot` for a Java MVC API. Each fork includes a warmed Maven project, a controller you can edit and a development server. Choose `rails` for a Ruby MVC API. Edit the greeting controller and Rails reloads it on the next request. Its checksummed bundle includes both Linux architectures. Choose `laravel` for a PHP API. Edit `app/Http/Controllers/GreetingController.php` to change the preview. Run `php .hermitbox/composer.phar --no-plugins test` for the project tests and `php artisan optimize` to build the production configuration. Choose `phoenix` for an Elixir web project. Edit the controller in `lib/` and reload the preview. Run `mix test` for the suite or `MIX_ENV=prod mix release --overwrite` to build the release. ## JupyterLab Choose `jupyter` for a running JupyterLab with NumPy, pandas, Matplotlib, SciPy and scikit-learn. Read the fork’s login token with `await box.read('.hermitbox/jupyter/access-token')` and paste it into the preview’s login form. Edit `sales.csv` and rerun `analysis.ipynb` to update the chart. The warm build executes the notebook and checks both the total and the plot. ## Local document search Choose `langgraph` for a search graph backed by SQLite FTS5, or `llamaindex` for a vector index using local TF–IDF embeddings. Each starts a search page and a JSON endpoint. Edit `documents.json` to change the results, or `pipeline.py` to change how the project retrieves them. Both run without a provider account. ## CPU model server Choose `llama-cpp` for a local chat preview and an OpenAI-compatible `v1/chat/completions` endpoint. The initial preparation fetches and verifies the 105 MB SmolLM2 model. Forks use the warmed model and run inference on the CPU. Edit `public/index.html` to change the chat page. ## Vector stores Choose `qdrant` or `chroma` to start a persistent vector database with an editable similarity-search page. The sample compares three coordinates for each point. Edit `vectors.json` to update the starter points on the next request. You can also use the native database API from the fork. Qdrant listens on loopback port 6333 and Chroma on 8001. The preview returns a point’s title when supplied and otherwise its native ID. ## Relational and document databases Choose `mongodb` on a self-hosted node to pull the pinned upstream MongoDB Community image and prepare a local snapshot. Edit `query.json` to filter, project or sort the fork’s inventory documents. The database listens on a private Unix socket. Choose `mysql` for a fork-local MySQL database and an editable SQL preview. Edit `query.sql` and refresh to see up to 100 result rows. The MySQL client connects over the private Unix socket described in the project's `AGENTS.md`. Choose `pgvector` for PostgreSQL’s native vector extension. The JSON preview executes `query.sql` against the fork-local database. Change its coordinates and refresh to see the new nearest point, or connect with the bundled `psql` client to add your own data and indexes. ## Chat starters Choose `ai-sdk-chat`, `mastra`, `openai-agents` or `crewai` for chat through the selected SDK. Each runs the CPU model in the same fork and returns its application’s preview. The project reads `instructions.txt` for each message and serves edits to `public/index.html` on refresh. ## Browser automation Choose `playwright`, `puppeteer` or `browser-use` on a container node that reports the Chromium sandbox guarantee. Edit `page.html` and select **Run browser test** in the preview. The selected SDK drives the sample page in Chromium, clicks its counter and returns the screenshot. The browser and the browser-use controller run inside the fork as an ordinary user. ## Graphical desktop Choose `desktop` for the editable graphical note and terminal. The project serves the note's contents in its preview, while `box.desktop()` opens the graphical session with an expiring access URL. Edit `notes.txt` through the file API or save it from the graphical editor. ## Coding agents Run `hermitbox create codex` to open Codex in a sandbox. `hermitbox create --list` prints the agent names. Hermitbox tries VM, gVisor, container and process in that order, reports the tier that accepted the sandbox, and installs the recipe in that sandbox. The sandbox needs outbound access to the package registry on its first build. On the process tier Hermitbox fetches the checksum-pinned Node or Python runtime into sandbox data. When a private cache is available, the CLI saves the ID of a snapshot taken before the agent starts. Later sessions on this machine can use it for the same endpoint, project and recipe. A concurrent cold start can install its own copy. Sign in at the agent's own prompt, or use `hermitbox create codex --env OPENAI_API_KEY` with the variable already set in your environment. Hermitbox forwards its value directly to the interactive process. With forwarded keys, creation chooses gVisor, container or process so a VM memory snapshot cannot retain a key. Pass fresh keys at creation, or sign in interactively inside the sandbox. Reattaching a running process keeps its environment. Agent sign-in files stay in the sandbox's data, and leaving the agent keeps the sandbox running until its idle deadline: - `hermitbox connect ` wakes it and opens another agent session. A disconnected terminal can be reattached with the printed process ID. - `hermitbox fork ` forks a snapshot. - `hermitbox sandbox stop ` stops the sandbox. Generic installations accept a pinned npm or pip package and its executable, such as `hermitbox create npm:opencode-ai@1.19.6 --bin opencode`. An HTTPS release takes the URL of a Linux executable, `--bin ` and `--sha256 ` for the sandbox architecture. --- # Virtual machines > Let your agent do it: Run a Hermitbox sandbox on the `vm` tier. First run `hermitbox doctor` and show me whether `tier.vm` is on, with its reason. If it is off, tell me what the page says would turn it on, and stop. If it is on, run `hermitbox run --isolation vm --image alpine:3.22 -- uname -r` and show me the guest's kernel version. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md. # Virtual machines The `vm` tier runs each sandbox as a virtual machine with a Linux kernel of its own, made from an ordinary OCI image. [Firecracker](https://github.com/firecracker-microvm/firecracker) is the monitor and KVM runs the guest. The sandbox's agent runs inside the guest and serves exec, files, logs, stats and ports as on every other tier. Ask for it by name, `isolation: "vm"` in the SDKs or from the CLI, or require one of its guarantees: ```sh hermitbox run --isolation vm --image alpine:3.22 -- uname -r ``` A `vm` request is placed only on a node that announces the tier; where none does, it is refused with `no_room` naming `vm`. It is never run on another tier. A request that leaves the tier open and has an image goes to a container first, then a VM, in control's default order ([tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md)). A VM sandbox reports these [guarantees](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md): | Guarantee | On a VM | Why | | --- | --- | --- | | `own-kernel` | Yes | The guest boots its own kernel, Linux 6.18.56 | | `memory-limit` | Yes | The guest's RAM is the admitted memory | | `cpu-limit` | Yes | The guest has exactly the admitted number of vCPUs | | `private-network` | Yes | The guest has its own network stack, or none | | `private-pids` | Yes | The guest kernel sees only its own processes | | `memory-sleep` | As an ordinary user, once its start test passes | Sleep writes the guest's memory beside its disk; wake restores it on a host of the same class | | `separate-users`, `host-firewall`, `browser-sandbox` | No | These name process and container mechanisms | ## What a host needs `hermitbox doctor` prints `tier.vm` as on or off, with the reason and what would change it. The tier is on when all of these hold: - **x86_64 Linux.** The published monitor and kernel are x86_64 only. Images must be `linux/amd64`. - **KVM this user can open.** `/dev/kvm` opens read/write for `hermitboxd`'s user, and a VM can be created on it: the probe runs a one-page guest that halts, and `hermitboxd` creates a VM at start. A device file alone is not enough. Nothing falls back to emulation. - **An ordinary user, or root's VM worker.** `hermitboxd` running as root serves the tier only through the separate `hermitboxd-vm-worker.service`; without it, a container's root included, the tier is off with "The root VM worker is not serving". See [As root](#as-root). - **Landlock ABI 3,** fully enforced, as for the process tier: it confines the monitor. - **A signed installation.** It carries `vm-bundle.json`, a small read-only descriptor, beside its `hermitbox-agent`, and `hermitboxd` finds it there; `[vm] bundle = ""` names another place. The descriptor and agent must be owned by `hermitboxd`'s user or root, in directories no other user can write. A build from source has no descriptor and leaves the tier off. The descriptor pins one release asset by size, SHA-256 and inventory. The asset is fetched on first use and cached under `hermitboxd`'s state directory; installing asks nothing more. Every file in it is checked against the inventory (size, digest and mode) before any of its programs runs. A mismatch refuses the work and runs nothing. ### What the bundle holds | Part | Version and source | Licence | Does | | --- | --- | --- | --- | | Monitor | Firecracker 1.18.0, built by the release recipe from its source at `eaf83bb` | Apache-2.0 | Runs the guest on KVM | | Jailer | Firecracker 1.18.0's published `jailer` | Apache-2.0 | Confines the monitor as root | | Kernel | Kata Containers 4.3.1's published `vmlinux-6.18.56-208`, unchanged | GPL-2.0 | The guest's kernel | | Filesystem tools | Alpine 3.24's erofs-utils 1.9.1 and e2fsprogs 1.47.4, unchanged | GPL-2.0, with LGPL, BSD and MIT parts | Build EROFS layers and ext4 disks | | Packet helper | gvisor-tap-vsock 0.9.0 in Hermitbox's `network-proxy` | Apache-2.0 | The ordinary user's guest network | | Guest firewall | nftables 1.1.6, in the read-only bootstrap image | GPL-2.0 | Guest rules set before image code | | Root TAP | CNI plugins 1.10.0's `tap` | Apache-2.0, one MPL-2.0 dependency | Root's TAP device | | Guest init and agent | The static `hermitbox-agent`, also the host launcher | AGPL-3.0-only | PID 1 and the sandbox supervisor | Each licence was recorded in [decisions](https://docs.hermitbox.dev/v0.2.1/decisions.md) before use. The kernel and every GPL program are separate files, never linked into `hermitboxd`. The monitor is built from source so that its C library matches the launcher's confinement. It keeps Firecracker's own restrictive seccomp policy; only the libc-specific thread-signal, wait, terminal, file-open and file-metadata rules are translated (`openat` where the published policy allows `open`, `statx` where it allows `stat`, both met first in snapshot creation), and a read of its own PID is added ([how to rebuild it](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/vm-tools/monitor-REBUILD.md)). The kernel is pinned in [kernel-selection.json](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/vm-tools/kernel-selection.json) with the built-in options the guest needs: EROFS, overlayfs, ext4, virtio block and MMIO, vsock and devtmpfs mounting. Its source is Linux 6.18.56 from [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.56.tar.xz), pinned in [kernel-source.json](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/vm-tools/kernel-source.json), with its configuration and patches in Kata's [tools/packaging/kernel at 4.3.1](https://github.com/kata-containers/kata-containers/tree/4.3.1/tools/packaging/kernel). A release publishes the complete corresponding source, `hermitbox-vm-sources.tar.gz`, beside the runtime asset; the runtime's `notices/source-distribution.json` names it by digest. Hermitbox builds no kernel. ## How an image becomes a disk There is no image daemon. `hermitboxd` runs `hermitbox-vm-image`, a separate helper from the bundle: 1. It pulls the manifest and layers with [oci-client](https://crates.io/crates/oci-client), anonymously, and checks each layer against its digest and its uncompressed `diff_id`. Layers are gzip or plain tar, at most 13 of them: each is a disk of the guest, and the monitor has interrupts for no more. An image with more is refused before it is fetched. 2. `mkfs.erofs --tar` turns each layer into a read-only EROFS file, keeping its owners, modes and times. Files are cached by layer digest and shared by every sandbox that uses them. A cached layer counts only once its file is complete and its record written. No layer is fetched, expanded or converted past the host's free-space floor (`min_free_disk_mb`). Short of room, the layers that no VM on the node needs go first, and the preparation is tried once more. A VM, asleep or stopped included, keeps every layer of the manifest it was first started on, and a starting VM the image it is preparing, so a fork whose parent is gone still boots on its own. A local snapshot alone keeps none: forked or restored once its layers went, it fetches that image again, as on another node. 3. The sandbox gets `vm.ext4`, a sparse file the size of its storage, made by `mke2fs`. It holds the overlay's writable layer and the data directory. The guest boots from a fixed read-only bootstrap image. Its PID 1 is the static agent, which receives its configuration and secrets over vsock into memory, never onto a disk. It mounts the layers and the ext4 disk, joins them as an overlay, binds the data directory at the mount path, and mounts `/tmp`, `/run` and `/dev/shm` at the spec's temporary size. It sets the hostname and the guest's PID limit and applies the guest firewall. Only then does it start the agent as the spec's non-root user with the image's environment, entrypoint and working directory. The host's `allowed_images` policy applies as on the container tier. ## Reach the guest `hermitboxd` reaches the agent over vsock, through the monitor's Unix socket. Exec, files, logs and stats go there, authenticated as on other tiers. Declared TCP ports are forwarded by host-owned relays over the same socket to the guest, and the edge reaches them as on any tier; the host-side listeners are private. UDP ports are refused. A VM's declared and spare ports share 64 simultaneous connections; one more is closed at once, and the guest never sees it. The binding `hermitboxd` marks as reserved, the agent's own, has 64 of its own that no public connection can use, so exec, files and stats keep working while a public port is full. While a VM is stopped or asleep, its files and logs are still readable and writable: `hermitboxd` boots a short-lived file-only guest on the same disk, with fresh credentials, no network and no workload, and shuts it down after. ## Network ### As an ordinary user The guest has no TAP device on the host and needs no user namespace or root. A virtual interface inside the guest carries Ethernet frames over vsock to the packet helper, an unprivileged gvisor-tap-vsock process that makes outbound connections as `hermitboxd`'s user. - **The default network** reaches public IPv4 addresses. DNS goes to a host-owned gateway. Non-public IPv4 ranges, private, loopback, link-local and metadata among them, are dropped, as is IPv6. - **A hostname allowlist** (`egress`) lets out HTTP, TLS and DNS only, through host-owned gateways that apply the names; everything else is dropped. The node announces `egress-hostnames` for the `vm` tier itself, so control sends a VM request's policy even when the node's first tier (usually process) has no such gateways, and refuses it for a tier that doesn't announce it. - **`network: none`** gives the guest no network device and starts no packet helper. Its firewall allows loopback alone. The trusted init installs the guest rules before any image code runs. The workload runs as a non-root user with no capabilities, so it cannot change them, and every process it starts is refused new vsock sockets, so it cannot reach the packet transport around them. The packet helper itself runs under the launcher's Landlock and seccomp policy: it can open outbound Internet sockets and routing netlink sockets, which only read how the host routes, and no listeners, other netlink families or Unix sockets. The packet helper also decides on the host, so a guest kernel that drops its own rules does not widen them. Before it dials any TCP, UDP or ICMP flow it refuses loopback, link-local and metadata, private, multicast and broadcast destinations, and any address the host itself would receive. It dials from the host's own network, so it asks the kernel how each new flow's destination is routed when the flow asks. It refuses one the kernel would deliver locally: the host's own addresses on every interface, public ones included, as the container tier's firewall refuses a workload's connections to its host. `hermitboxd` passes every guest's egress policy, and the helper refuses to start without one. So it also reaches the gateway address only at the gateway ports `hermitboxd` names (HTTP, TLS and DNS under a hostname allowlist, DNS alone otherwise). It refuses the agent's other non-public networks, and on a hostname allowlist refuses every public address. The ordinary user's helper runs no resolver of its own, so its guest's DNS reaches only `hermitboxd`'s gateway. As root, the bridged packet stack gets the same policy with no gateway port; its guest resolves at the stack's own gateway, which answers from the host's resolvers. ### As root As root, the tier is served by a separate service, `hermitboxd-vm-worker.service`, which `hermitboxd join` writes beside `hermitboxd`'s unit and `hermitboxd`'s unit wants. `hermitboxd`'s own unit keeps its sandbox (no devices, no namespaces, four capabilities). The worker runs `hermitboxd vm-worker` as root, holds the VM authority and answers `hermitboxd` over two private root-owned sockets in `hermitboxd`'s state directory. It serves one `hermitboxd` at a time: when that `hermitboxd` stops, the VMs it served stop with it, and the worker starts again for the next one. On a host without the tier it skips itself, and `hermitboxd` reports the tier off with its name. Each guest gets a TAP device in its own anonymous network namespace behind default-drop nftables rules, read back before the monitor starts. Hostname policy uses the same gateways, listening inside that namespace; the default network crosses a filtered bridge into a confined ordinary packet stack. The host's own routes, forwarding settings and firewall are not changed. A release lists `vm-bundle.json`, and the server preset (`sudo hermitbox up`) installs it beside the root agent, where the worker finds it; the runtime it pins is fetched on the first VM create. An install that names no `--allow-image` then admits, besides `alpine:` and `node:`, exactly the images the bundle is proven with ([image-inputs.json](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/templates/vm-tools/image-inputs.json)), each by its full digest reference, which admits that digest and no other. They are ordinary `allowed_images` entries in `/etc/hermitboxd/hermitboxd.toml`: an operator who removes them or narrows the list narrows the tier with it, and adds prefixes there for other images, as for containers. ## Lifecycle and snapshots - **Sleep with memory**, for an ordinary user's tier. At start, `hermitboxd` sleeps and wakes a file-only guest on a scratch disk; once that passes, the tier reports `memory-sleep` and control's sleep suspends instead of stopping. A suspend asks the guest's init, with a request signed for that boot, to freeze (`cgroup.freeze`) its workload's cgroup, flush its disk and hold a connection to the host. Firecracker then pauses the guest's vCPUs, the monitor writes a full snapshot of its state and memory, and it exits. The workload runs again only once a resume has stepped the clock, reseeded it and brought its network back, or once the host gives the sleep up. The two files go into `hermitboxd`'s private state for the VM tier, owned by `hermitboxd`'s user and readable by no one else, as the disk is; they never go into a snapshot, an export, a rest or a transfer. - **Wake with memory** restores that snapshot on the same node, when the host's class still matches: the CPU model and its features, the host kernel and the monitor's build, all recorded at sleep, and the disk is the very file the sleep left. Processes, terminals and `/tmp` carry on. The monitor's vsock reset ends init's held connection. Init then takes a signed resume from the host, steps the wall clock to the host's, mixes host entropy into its pool, and points its redirects at the gateways this wake listens on (their ports are new, and the resume names them). It starts its network helper again and reopens its sleep listener. Open TCP connections don't survive. A host of another class, a changed disk or a restore that fails is never retried: the memory is discarded, the guest boots from its disk with everything written before the sleep, and the start answers `resumed: false`. Memory never leaves its node, so a wake anywhere else is a cold boot. - **Sleep** without memory (root's VM worker, or before the start test passes) stops the guest and keeps its disk. **Wake** boots it again from that disk, on an API call or a held edge connection. A suspend request is refused, and control takes the stop path without asking. - A file session or a cold boot of a guest asleep with memory discards that memory first; stopping it ends the memory as a kill would. A snapshot or an export of it copies its disk as the sleep flushed it, unrepaired (a boot of the copy checks it first), and leaves it asleep with its memory. Removing a sandbox removes its memory, and `hermitboxd`'s start removes any memory file no sandbox's record names. Differential snapshots are not used: their upstream calls them a preview. - **Fork with memory**, on one node: a guest asleep with its memory gives a new sandbox a copy of its disk and the same memory file, and the fork wakes running the source's processes under its own sandbox, agent key, boot nonce and hostname, which its resume hands it before its agent serves anything. Its init then has the kernel rekey its random generator from host entropy, so each fork draws random bytes of its own (the pinned kernel has no VM generation ID driver). A fork keeps everything of its source's spec the memory holds: image, sizes, mounts, user, network, variables, secrets and ports. Through the APIs it is a fork from a snapshot. Control snapshots a sleeping VM sandbox without waking it (the snapshot names the memory), and places a fork from that snapshot on the node that holds it when that node has room. The node's restore (`fork`, feature `local-forks`) takes the memory too while the source still sleeps with it and the fork's spec differs only in what is each sandbox's own; the fork's first start then resumes (`resumed: true`). Any other fork, and every fork on another node, copies the disk and boots it. - **Stop** sends the guest's init a signed request over vsock, carrying the spec's stop grace. Init stops the workload with SIGTERM or SIGINT (other stop signals are refused), gives it that whole grace before killing what remains, remounts its disks read-only and flushes them, then writes a signed record, bound to that boot, of the clean disk and the exit status; `hermitboxd` reads it from the console. `hermitboxd` waits the grace plus 15 seconds for that; a guest still running then is killed and reported as killed, and one that exits without that record has an unknown exit. - **Snapshot, fork, export, restore and move** copy the stopped disk with the same file walk the other tiers use, preserving holes. A running VM is stopped for the copy and booted again after it. Export can't exclude paths, since it carries a disk image. - **Recovery.** Every start first checks the existing disk read-only. Checks never write to it. A disk that needs repair is repaired on a staged copy, which replaces the original only after an independent check; one that needs more than automatic repair is refused, and the original is left as it was. ## Confinement of the monitor As an ordinary user, the monitor is started by the static launcher, which takes the sandbox's lifetime lease and then confines it: - **Landlock**, fully enforced: read only its own program, the kernel, the bootstrap image, the image's layers, its configuration and a few `/proc`, `/sys` and `/dev` entries; write only its disk, its boot directory, `/dev/kvm` and `/dev/null`. - **seccomp**: the process tier's dangerous-syscall denials, plus no network sockets, no signals or resource-limit changes for other processes, no io_uring, and no way to close or unlock its lease. Firecracker's own filter stays on; `--no-seccomp` and `--seccomp-filter` are refused. - **Landlock's abstract-socket scope**, where the kernel has it (Landlock ABI 6): no abstract Unix socket outside its own domain. - It is not dumpable, and the kernel kills it when `hermitboxd` exits. Its one-shot bootstrap socket hands the guest's secrets only to a peer with the monitor's own PID. As root, the monitor runs under Firecracker's unchanged jailer, as a non-root uid and gid of its own: each VM takes the lowest free pair of a range the host reserves (`[vm] monitor_uid`, `monitor_gid` and `monitor_ids`, 1024 pairs from 60001 by default), keeps it across boots and lets it go when it is removed, so no two VMs share one and no workload chooses one. Its TAP and its root packet stack are that pair's too. It runs in a chroot holding only its staged inputs, under the same lease and signal bounds, inside the root worker above. The filesystem programs (`mke2fs`, `e2fsck`, `mkfs.erofs`) read disks a guest wrote and layers a tenant chose, so the same launcher confines them too, as root or not: Landlock reads of their own component and inputs and writes of one pre-created output and a private directory only; no socket of any kind; no capability, even as root; no core dump; and no file written past the output's admitted size. ## Limits - No KVM, no tier: there is no emulation, and the tier is x86_64 only. - Root nodes serve the tier only through the VM worker. - Memory sleep is for an ordinary user's tier, restored only on the same node and host class. Snapshots and exports of a running VM restart it. A fork copies the disk, and takes the memory too only from a snapshot of a VM asleep with it, on that VM's node. - CPU is whole vCPUs: `cpuMillis` must be a multiple of 1000, and one vCPU is given without it. CPU weights are refused. - Memory is whole MiB, the guest's RAM. The monitor's own memory on the host is outside it. - The disk's size is fixed when it is made; a changed storage size is refused. - Only TCP ports are forwarded. The guest network is IPv4. - Images are pulled anonymously; registry credentials are not used on this tier. - The workload runs as a non-root numeric user. `packages` (the Wasm tier's registry packages) are refused. - When `hermitboxd` stops or crashes, its guests stop with it; their disks are kept and checked. - Bucket mounts are refused. Desktop and SSH are not announced on this tier, and the browser and interpreter tools are not tested on this tier. Software in the image runs as in any image. ## Where KVM exists Hermitbox measures the host; a provider's name decides nothing. - **Bare-metal x86_64 servers and Linux laptops or desktops** whose CPU has Intel VT-x or AMD-V turned on in firmware: the `kvm_intel` or `kvm_amd` module creates `/dev/kvm`. A `vmx` or `svm` flag in `/proc/cpuinfo` shows the CPU offers it. - **Who can open it** comes from the distribution's udev rules, often a `kvm` group. `hermitbox doctor` shows whether `hermitboxd`'s user can. - **A virtual machine** has KVM only when its hypervisor exposes nested virtualisation. It is opt-in on AWS (some Intel families), Google Cloud and Azure, and absent on Hetzner Cloud and on arm64 virtual machines. Bare-metal cloud instances expose it directly. - **GitHub's hosted `ubuntu-24.04` runners** have `/dev/kvm`; Hermitbox's VM CI runs on them, granting the runner's user access in the job, on every pull request that changes VM code. - **A container** can be given `/dev/kvm` with `--device /dev/kvm`, without `--privileged`; `hermitboxd` inside must run as an ordinary user for this tier. - **arm64 hosts** keep the tier off. ## How this is tested CI's VM job runs on real KVM. It covers the runtime as an ordinary user on Alpine 3.24.4 and Debian trixie-slim (create, exec, files, logs, stats, stop, cold wake, copy and fork, the loss of `hermitboxd`, both network policies), strict monitor shutdown, the confined filesystem programs, root jailer boots, the root lifecycle with both network policies, and the node API over mutual TLS: the tier's discovery in auto mode, its announced guarantees, snapshot and restore. The installed acceptance (`deploy/vm-installed-acceptance.ts`) runs against the signed installation, as an ordinary user and as root through the server preset and its VM worker (`deploy/server-vm-acceptance.sh`, on the node configuration as the install wrote it). Through both SDKs and the edge, on Alpine and Debian, it covers run, a file round trip, a declared port through the edge, sleep and cold wake from the edge, snapshot, a fork with its own edge port, and delete. It also covers the default network's firewall (a public address answers, a listener on the host's own address does not), and one hostname egress rule that control sends to the vm tier of a node whose first tier is process. Its guarantee checks are that a guest can't read a host-only file, can't signal `hermitboxd`, and reports a kernel other than the host's; the root lifecycle runs them too (`src/runtime/vm/instance/root_acceptance.rs`). The ordinary user's run ends with a purge. On a host without KVM, a `vm` create is refused with `no_room` naming it (`control/bench/mixed-tiers.ts`). Thirty-sample create measurements are in [tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md#vm-tier-measurements). On a minimal fixture, launch to a validated guest report takes 717 ms at p50 (30 samples); that is a boot, not a sandbox create. Not tested: a move between two VM nodes. A start right after a stop has failed twice in about sixty samples; it has not recurred in about 360 installed starts since, and its cause is not known. --- # Connect webhooks > Let your agent do it: Register my HTTPS receiver for Hermitbox sandbox lifecycle events. Ask me for the receiver's URL and a new file path, in an existing private directory, for its signing secret. Set `HERMITBOX_API_URL`, `HERMITBOX_API_KEY`, `HERMITBOX_WEBHOOK_URL` and `HERMITBOX_WEBHOOK_FILE` privately, install `hermitbox` in a Node program, and run the page's block once. Never print the signing secret or copy the key into this chat; tell me only that it registered. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/guides/webhooks.md. Register an HTTPS endpoint for sandbox lifecycle events and save its signing secret to a private file. 1. Prepare your HTTPS receiver and choose a new file in an existing private directory for its signing secret. 2. Set `HERMITBOX_API_URL`, `HERMITBOX_API_KEY`, `HERMITBOX_WEBHOOK_URL` and `HERMITBOX_WEBHOOK_FILE` privately; install `hermitbox` in the Node program that registers the receiver. 3. Run this once. Keep the saved file private: the signing secret is returned only at registration. ```ts import { writeFileSync } from 'node:fs' import { Hermitbox } from 'hermitbox' // The receiver and the secret's file come from the environment. const receiver = process.env.HERMITBOX_WEBHOOK_URL const file = process.env.HERMITBOX_WEBHOOK_FILE if (!receiver || !file) { throw new Error('Set HERMITBOX_WEBHOOK_URL and HERMITBOX_WEBHOOK_FILE') } // Connect with HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment. const hb = new Hermitbox() // Register the receiver for sandbox creation and deletion. const hook = await hb.webhook({ url: receiver, kinds: ['created', 'deleted'] }) try { // Save the signing secret once, to a new private file. const saved = JSON.stringify({ id: hook.id, secret: hook.secret }) + '\n' writeFileSync(file, saved, { mode: 0o600, flag: 'wx' }) } catch (error) { // Without the saved secret the registration is useless, so remove it. await hook.delete() throw error } console.log('Webhook registered') ``` The file is created without overwriting an existing path; the block never prints the secret. Verify timestamp and HMAC on the exact received bytes, deduplicate delivery IDs and acknowledge promptly. [Signing, retries and dead letters](https://docs.hermitbox.dev/v0.2.1/reference/api.md#lifecycle-webhooks) describe the receiver contract. Private destinations need the host's allowlist; a caller cannot relax it. Events still reflect the selected [tier's lifecycle limits](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). --- # Deploy the release image > Let your agent do it: Run the Hermitbox release image on this container host. Start it with `docker run`, publishing port 8080 and keeping a named volume at `/var/lib/hermitbox`, as the page shows. Have me read the initial API key from the container's log on its first start, then set `HERMITBOX_API_URL=http://localhost:8080` and `HERMITBOX_API_KEY` in the shell's private environment, never in a file or this chat. Run `hermitbox run -- echo hello` and `hermitbox doctor`, and show me the output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/container.md. Run the all-in-one Hermitbox release image with Docker or any container host. # Deploy the release image Run the all-in-one Hermitbox release image with Docker or any container host. The image bundles control, edge, the node daemon, embedded Postgres and an S3-compatible store. ```sh docker run -p 8080:8080 ghcr.io/hermitbox/hermitbox:0.2.1 ``` ## First start Open the public root address for the welcome page and caller examples. If `HERMITBOX_BOOTSTRAP_API_KEY` is set, it supplies the first key and is never logged. Otherwise the first successful start prints the initial API key once. Set `HERMITBOX_API_URL` to `http://localhost:8080` and `HERMITBOX_API_KEY` to that key in the CLI or SDK environment, then run a command with the bundled userland: ```sh hermitbox run -- echo hello ``` `hermitbox run --image alpine:3.22 -- echo hello` is refused on the process tier, with the image error in [process tier](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md). See [hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md) for platform files and exact validation boundaries. ## Tiers in the image The image serves process and agentOS VMs together where their probes succeed, and container workloads where the host engine is usable. Control chooses an eligible tier for a request that names none, and reports the result. A request with `isolation` fixes its tier, and a missing runtime is refused by name. `hermitbox doctor` lists what this host supports and why a tier is off. Priority and single-backend overrides are in [tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). Wasm refuses an image and accepts optional `packages` registry names instead. See [tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) for the measured default and capabilities, and [agentOS](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md) for persistence and ingress limits. The process tier is Linux-only and requires the kernel policy in [process tier](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md). The image fails closed when the platform can't enforce it. Container-tier installations add a usable host Docker socket and the host firewall policy. They need an operator's host permissions and don't change the ordinary-container process proof. The [one-command installer](https://docs.hermitbox.dev/v0.2.1/get-started/install.md) runs the same supervisor as an ordinary user, or provisions a systemd server as root. ## Storage and Compose Docker creates the image's state volume automatically. For a named persistent volume: ```sh docker run \ --name hermitbox \ -p 8080:8080 \ -v hermitbox:/var/lib/hermitbox \ ghcr.io/hermitbox/hermitbox:0.2.1 ``` `docker compose up --build` uses the root [docker-compose.yml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/docker-compose.yml) with a named state volume. `docker compose logs hermitbox` shows the initial key on first start. A fresh image can run with `--user 1000:1000`. It then reports shared UID isolation and keeps that user's state in its own directory in the volume. Restart with the same UID and volume. The process tier needs no privileged flag, engine socket or seccomp override. Embedded Postgres requires its private password on both TCP and Unix sockets. ## Network and public URLs The only public listener is HTTP port `8080`, or `PORT`. Set `HERMITBOX_PUBLIC_URL` to the externally reachable HTTP or HTTPS origin behind your platform's TLS terminator. Agent URLs use an authenticated `/sandboxes//_hermitbox/` alias. Exposed application ports use public `/sandboxes//ports//` aliases. Applications behind those aliases must support their URL prefix. Declared HTTP ports use the public hostnames the API returns. Configure DNS, and preserve the Host header through the TLS terminator. The `HERMITBOX_PUBLIC_URL` hostname stays reserved for control routing, even when a declared hostname collides with it. TLS and raw TCP fronts are off in the image. Standalone host edges can still use wildcard DNS, certificates and raw fronts, as [sandbox agent](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md) documents. New image state derives its private node listener pool below the kernel's outgoing ephemeral range, without changing sysctls. A restart keeps the stored pool, including older implicit pools. The image honours the edge's `HERMITBOX_EDGE_*` admission and greeting settings and keeps embedded service listeners private. Normal limits remain the defaults. ## External Postgres and S3 Without `DATABASE_URL`, the image starts private Postgres in the volume. With `DATABASE_URL`, it uses that Postgres and applies Hermitbox's migrations. Without `S3_ENDPOINT`, it starts a private S3-compatible store in the volume. To use external S3, set `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY` and `S3_SECRET_KEY` together. Normal TLS certificate checks stay on. Keep the state volume even with external stores. It also holds fleet identity, private credentials and local sandbox data. Back up the database, object store and state together. ## Managed platforms Render builds this image from the repository Dockerfile with the root [render.yaml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/render.yaml) Blueprint: an ordinary Docker web service, a persistent state disk and managed Postgres. [Host on Render](https://docs.hermitbox.dev/v0.2.1/hosting/render.md) has the steps. Every other platform is in [hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md). ## Run under systemd On a fresh Linux host, `sudo hermitbox up --image --domain sandboxes.example.com` installs the same release image as a systemd service. It pulls, copies from and runs that image only by the index digest in the release's signed server manifest. It refuses a cached image under any other digest. An explicit image reference can follow `--image`, or be set in `HERMITBOX_IMAGE`. It is used as given, and the install output's `imageSource` says which of the two ran. The one-box binary preset starts PostgreSQL and RustFS by index digest too. This operator path installs the host Docker and firewall policy and mounts the engine socket. Its container needs `NET_ADMIN` to apply that policy. It is separate from the ordinary process start above. A repeated installation keeps its credentials. Stop an existing binary installation and migrate its data first; the installer refuses an active binary deployment. The host installation reserves its configured workload ports in Linux's `ip_local_reserved_ports`, keeping existing reservations and writing a sysctl drop-in. Outgoing connections then can't take a stopped sandbox's published port. For an existing manually installed node, run: ```sh sudo hermitboxd reserve-ports --config /etc/hermitboxd/hermitboxd.toml ``` --- # Host on Coolify > Let your agent do it: Deploy Hermitbox on my Coolify installation. Add a Docker Compose Empty service with the page's `compose.yaml`. If you can't act in Coolify yourself, walk me through each step. Have me find the key as `SERVICE_PASSWORD_64_HERMITBOX` in the service's environment variables, check that `/healthz` answers `"status":"ok"`, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately for the CLI, and run `hermitbox run -- echo hello`. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/coolify.md. Deploy Hermitbox as a Docker Compose service on a host where you already run Coolify. Paste the [Compose service](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/coolify/compose.yaml) into Coolify. Coolify's service catalog doesn't list Hermitbox yet, so you add it as an empty Compose service. ## Add the service 1. In your Coolify installation, add a **Docker Compose Empty** service. 2. Paste [compose.yaml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/coolify/compose.yaml) and deploy it. Coolify assigns the proxy domain and generates the bootstrap key. 3. Find the key as `SERVICE_PASSWORD_64_HERMITBOX` in **service → Configuration → Environment Variables**. ## Verify the service ```sh curl -fsS https:///healthz ``` It answers with `"status":"ok"`. Point the CLI at the service with its key and run `hermitbox run -- echo hello`, as [Connect after deployment](https://docs.hermitbox.dev/v0.2.1/hosting.md#connect-after-deployment) shows. ## Coolify notes `SERVICE_URL_HERMITBOX_8080` asks Coolify to assign the proxy domain, and the service uses it as `HERMITBOX_PUBLIC_URL`. `SERVICE_PASSWORD_64_HERMITBOX` generates the bootstrap key. The file also gives the service a health check on `/healthz` and restarts it unless you stop it. The generated URL follows your Coolify installation's domain and TLS policy. Configure HTTPS there before you deploy. Keep the named volume, the image user, the writable container root and Docker's ordinary security policy. Coolify runs on your host, so Landlock and seccomp availability comes from that host. No engine socket, privilege or KVM device is passed to Hermitbox; see [Tiers and guarantees](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees). [Compose](https://coolify.io/docs/services/configuration/docker-compose), [generated variables](https://coolify.io/docs/services/configuration/environment-variables), [pricing](https://coolify.io/pricing/). --- # Host on DigitalOcean > Let your agent do it: Deploy Hermitbox on a DigitalOcean Droplet. Create it from Ubuntu 24.04 or 26.04, with at least two vCPUs and 4 GiB of memory and the page's `user-data.yaml` as its user data. If you can't act in my DigitalOcean account, walk me through each step. Once it is up, connect over SSH, check that `curl -fsS http://127.0.0.1:8080/healthz` answers `"status":"ok"`, and follow the own-machine guide to the welcome page. Never copy the API key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/digitalocean.md. Deploy Hermitbox on a DigitalOcean Droplet with the shipped [cloud-init user data](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/cloud-init/user-data.yaml). Its state stays on the Droplet's disk across restarts. Hermitbox has no DigitalOcean Marketplace image or App Platform button. App Platform has no persistent volumes, so it can't keep a complete install. ## Create the Droplet 1. Create a Droplet from Ubuntu 24.04 or 26.04, the releases CI boots this file on. Give it at least two vCPUs and 4 GiB of memory, the size CI tests. 2. Paste [user-data.yaml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/cloud-init/user-data.yaml) as the Droplet's user data. It runs once as root and installs Hermitbox with the release image. 3. Connect over SSH once the Droplet is up, and follow [Host on your own machine](https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md#verify-and-connect) to reach the welcome page. ## Verify the install On the Droplet: ```sh curl -fsS http://127.0.0.1:8080/healthz ``` It answers with `"status":"ok"`. ## DigitalOcean notes None of App Platform's three storage paths keeps a whole install: - Managed Postgres leaves sandbox data ephemeral. - Postgres with Spaces still loses local fleet identity. - Keeping all state in the instance loses it on replacement. For that reason Hermitbox ships no App Platform button or stateless app spec. A Droplet keeps all state. The Droplet path installs Docker and its host firewall policy, and attaches no KVM device. Container admission must enforce that policy. See [Host on your own machine](https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md) for the rest of the setup. [Storage limitations](https://docs.digitalocean.com/products/app-platform/how-to/store-data/), [app specification](https://docs.digitalocean.com/products/app-platform/reference/app-spec/), [pricing](https://www.digitalocean.com/pricing/app-platform). --- # Host on Fly.io > Let your agent do it: Deploy Hermitbox on Fly.io. Copy the page's `fly.toml` into an empty directory, change `primary_region` only if I ask, and run `fly launch`, keeping the existing configuration. Check that `https://.fly.dev/healthz` answers `"status":"ok"`, have me read the `apiKey` the image prints once in the app's logs, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately for the CLI, and run `hermitbox run -- echo hello`. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/fly.md. Deploy Hermitbox on one Fly.io Machine with a persistent state volume. The [Fly Launch configuration](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/fly/fly.toml) names the release image, the `hermitbox_state` volume, port `8080` and the `/healthz` check. ## Launch the app 1. Copy [fly.toml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/fly/fly.toml) into an empty directory. Change `primary_region` from `ams` if you want another region. 2. Run `fly launch` in that directory and keep the existing configuration. Fly Launch assigns the app a unique name and attaches `hermitbox_state` to one Machine. 3. Read the `apiKey` the image prints once in **app → Monitoring → Logs** on its first successful start. ## Verify the app ```sh curl -fsS https://.fly.dev/healthz ``` It answers with `"status":"ok"`. Point the CLI at the app with its key and run `hermitbox run -- echo hello`, as [Connect after deployment](https://docs.hermitbox.dev/v0.2.1/hosting.md#connect-after-deployment) shows. ## Fly.io notes Keep one Machine. Don't scale to a second Machine, since it would get an independent state volume. Fly's secrets store accepts values you supply, but the launch configuration generates none, so the key appears only in the log. `FLY_APP_NAME` gives the HTTPS origin, `https://.fly.dev`. The configuration asks for a `shared-cpu-2x` Machine with 2 GB of memory, a 10 GB volume, forced HTTPS and a Machine that stays running. Fly runs the image in a Machine with a writable root filesystem and its persistent `/var/lib/hermitbox` mount, and the image user stays root. This configuration adds no Docker daemon or KVM device. The process policy must pass on the actual guest kernel; see [Tiers and guarantees](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees). [Configuration](https://fly.io/docs/reference/configuration/), [volumes](https://fly.io/docs/volumes/overview/), [pricing](https://fly.io/docs/about/pricing/). --- # Choose where to host Hermitbox > Let your agent do it: Help me choose where to host Hermitbox, then deploy it there. Ask me which platform I use, or whether I have a Linux machine of my own, and follow that platform's guide. Once it is up, check that `https:///healthz` answers `"status":"ok"`, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the shell's private environment, never in a file or this chat, and run `hermitbox run -- echo hello`. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting.md. Compare the platforms Hermitbox runs on and pick one, from a managed service to a Linux server of your own. # Choose where to host Hermitbox Run Hermitbox on a managed platform or on a Linux machine of your own. Each option keeps one state volume and serves Hermitbox on port `8080`, with readiness at `/healthz`. | Platform | What it deploys | Guide | | --- | --- | --- | | Render | The repository Dockerfile with a state disk and managed Postgres | [Host on Render](https://docs.hermitbox.dev/v0.2.1/hosting/render.md) | | Railway | The release image with one volume, from a published template | [Host on Railway](https://docs.hermitbox.dev/v0.2.1/hosting/railway.md) | | Fly.io | The release image on one Machine with a persistent volume | [Host on Fly.io](https://docs.hermitbox.dev/v0.2.1/hosting/fly.md) | | Koyeb | The release image with a volume you create first | [Host on Koyeb](https://docs.hermitbox.dev/v0.2.1/hosting/koyeb.md) | | Coolify | A Docker Compose service on your Coolify host | [Host on Coolify](https://docs.hermitbox.dev/v0.2.1/hosting/coolify.md) | | DigitalOcean | A Droplet with cloud-init, since App Platform has no volumes | [Host on DigitalOcean](https://docs.hermitbox.dev/v0.2.1/hosting/digitalocean.md) | | Own machine | The release image under systemd from cloud-init, with Docker and its firewall policy | [Host on your own machine](https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md) | | Server with root | The server preset: Docker, nftables, systemd units and, with a domain, managed TLS | [Host on a server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md) | | Any container host | The release image with `docker run` | [Deploy the release image](https://docs.hermitbox.dev/v0.2.1/hosting/container.md) | The templates name the release image by version, `0.2.1`. Render builds the repository Dockerfile, so its button uses the source directly. The platform documentation linked from each guide was checked on 2026-11-14; see each platform's own pricing link. ## How to choose Pick a managed platform when you want HTTPS and a public address without running a machine. Sandboxes there run on the process tier, and on Wasm where its probe passes. Pick a machine you control when you need images or virtual machines. A container engine turns on images, and KVM turns on virtual machines; no managed platform template attaches either. ### Render Render deploys from the repository with one Blueprint, including managed Postgres. [Deploy on Render](https://render.com/deploy?repo=https://github.com/hermitbox/hermitbox), then follow [Host on Render](https://docs.hermitbox.dev/v0.2.1/hosting/render.md). ### Railway Railway runs the release image from its published template. [Deploy on Railway](https://railway.com/deploy/hermitbox), then follow [Host on Railway](https://docs.hermitbox.dev/v0.2.1/hosting/railway.md). ### Fly.io Fly.io runs the release image on one Machine from a launch configuration. See [Host on Fly.io](https://docs.hermitbox.dev/v0.2.1/hosting/fly.md). ### Koyeb Koyeb runs the release image once you create its volume in the dashboard. See [Host on Koyeb](https://docs.hermitbox.dev/v0.2.1/hosting/koyeb.md). ### Coolify Coolify runs a Compose service on a host where you already run Coolify. See [Host on Coolify](https://docs.hermitbox.dev/v0.2.1/hosting/coolify.md). ### DigitalOcean App Platform App Platform has no persistent volumes, and none of its three storage paths keeps a whole install. Use a Droplet instead, as [Host on DigitalOcean](https://docs.hermitbox.dev/v0.2.1/hosting/digitalocean.md) explains. ### A machine of your own Any Linux machine that accepts cloud-init user data runs the release image under systemd, with Docker and its firewall policy. See [Host on your own machine](https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md). To install the server preset instead, see [Host on a server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md). ## Connect after deployment Open the service's HTTPS address to find its key location and connect. Enter the key to see this install's caller examples; the page keeps it only for the current request in this tab. Check that the service is ready: ```sh curl -fsS https:///healthz ``` It answers with `"status":"ok"`. Then run a command through the [CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md): ```sh # Point the CLI at the service. export HERMITBOX_API_URL=https:// export HERMITBOX_API_KEY= # Run a command in a new sandbox. hermitbox run -- echo hello ``` Examples reference `HERMITBOX_API_KEY`, never its value. Keep your state volume across replacements. The image exposes only port `8080` (`PORT` overrides it), with readiness at `/healthz`. For other callers, see [Connect to your install](https://docs.hermitbox.dev/v0.2.1/get-started/connect.md). ## Tiers and guarantees On managed platforms (Coolify, Fly.io, Koyeb, Railway and Render), the image uses the process policy where the kernel enforces Landlock and seccomp. The platform files attach no nested engine or KVM. On an ordinary container, the default process tier requires Landlock and seccomp. The image refuses to start when it cannot enforce that floor. Root gives per-sandbox UIDs; an ordinary service user gives shared UID isolation, which is weaker and is reported. Shared UID workloads must trust each other. Internet-enabled process workloads share host networking, even with separate UIDs. User namespaces and writable cgroups are not assumed. See [process tier](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md). No platform name proves a kernel capability. The welcome page reports the configured default isolation and says that it does not show the host probe report. Node admission refuses requests it cannot enforce. These templates add no privilege, engine socket, device or host policy override. The image chooses from what it can use; no preset flag is required. The process path has no container images and no browser or desktop templates. Process sleep keeps memory while the supervisor survives; after a platform restart, a sandbox starts a fresh process from its retained files. Wasm runs on `x86_64` beside the process tier where its probe passes, and `HERMITBOX_RUNTIME=wasm` serves it alone. It has a virtual kernel, a shared sidecar and [its limits](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md), and it never substitutes for a requested process policy. The container tier needs an engine and the host firewall, which these managed-service templates lack. No template attaches a KVM device, so the `vm` tier is off on them. A provider can change its kernel without changing a template. Only a live probe establishes Landlock ABI, seccomp, user namespaces and cgroup delegation there. ## How this is tested CI runs the image built from the checkout in six container envelopes: one per managed platform above and one as an ordinary user (`1000:1000`). Each has a writable root filesystem, one state volume, 2 GiB of memory and no added privilege. Each envelope passes the welcome page's secrecy, the authenticated details, all six caller blocks, and key retention across a restart without logging the key again. The envelopes reproduce each platform's container settings under Docker; they don't test a provider's kernel. CI also runs each platform's own validator where one works without an account (`control/tools/hosting-validate.ts`). These files create no account and publish no template, button or catalog entry; where a platform needs a published template, its owner publishes it. | Platform | Validation in CI | Live deployment | | --- | --- | --- | | Render | Render's own JSON Schema, the image envelope and the six caller blocks | Not tested | | Railway | The container envelope and caller blocks; the published template deployed and answered `/healthz` on Railway on 2026-11-29 | Deployed once | | Fly.io | The TOML parse, the container envelope and caller blocks, which do not emulate a Fly microVM; Fly's remote validator needs an app and an account ([its source](https://github.com/superfly/flyctl/blob/master/internal/command/config/validate.go)) | Not tested | | DigitalOcean App Platform | None: App Platform has no stateful image to test | Not tested | | Koyeb | The ordinary container envelope and caller blocks, which do not test Koyeb's kernel; no account-free service validator is documented | Not tested | | Coolify | Docker Compose's own config validator with generated values, the container envelope and the caller blocks | Not tested | | Own machine | cloud-init's own schema, and a boot of the checksum-pinned Ubuntu 24.04 and 26.04 images ([inventory](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/cloud-init/images.json)) under QEMU, each with two virtual CPUs and 4 GiB of memory, through boot, install, welcome, authentication and a hello sandbox | Not tested | --- # Host on Koyeb > Let your agent do it: Deploy Hermitbox on Koyeb. Create a persistent volume in the service's region, then one web service from the image the Koyeb service fields name, with the volume at `/var/lib/hermitbox` before the first start and the other values from the same file. If you can't act in my Koyeb account, walk me through each step. Have me read the `apiKey` from the service's logs, check `/healthz`, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately for the CLI, and run `hermitbox run -- echo hello`. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/koyeb.md. Deploy Hermitbox on Koyeb as one web service with a persistent volume you create first. The [Koyeb service fields](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/koyeb/template.md) list every value to enter. Koyeb's deploy button can't attach a volume, so there is no Hermitbox button for Koyeb. Create the service in the Koyeb dashboard. ## Create the service 1. Create a persistent volume in the region where the service will run. 2. Create one web service from the image the [Koyeb service fields](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/koyeb/template.md) name. Attach the volume at `/var/lib/hermitbox` before the first start, and enter the port, route, health check, instance count, memory and variables from the same file. 3. Deploy, then read the `apiKey` the image prints once in **service → Logs** on its first successful start. ## Verify the service ```sh curl -fsS https:///healthz ``` It answers with `"status":"ok"`. Point the CLI at the service with its key and run `hermitbox run -- echo hello`, as [Connect after deployment](https://docs.hermitbox.dev/v0.2.1/hosting.md#connect-after-deployment) shows. ## Koyeb notes The deploy-button format supports an image, variables and ports, but not a volume attachment. Each way around that falls short: - A bare button loses state on replacement. - An external database still loses local identity and sandbox data. - A volume you create first works, but needs the account steps above. The button format has no documented generated-secret expression, so the fields leave out `HERMITBOX_BOOTSTRAP_API_KEY` and the key appears only in the log. `KOYEB_PUBLIC_DOMAIN` gives the HTTPS origin. Keep one instance with its `/var/lib/hermitbox` volume, port `8080`, a writable root filesystem, the image's default user and privileged mode off. Admission must establish actual Landlock and seccomp support; no namespace, cgroup or KVM guarantee is inferred from Koyeb's isolation technology. See [Tiers and guarantees](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees). [Button format](https://www.koyeb.com/docs/build-and-deploy/deploy-to-koyeb-button), [volumes](https://www.koyeb.com/docs/reference/volumes), [pricing](https://www.koyeb.com/pricing). --- # Host on your own machine > Let your agent do it: Install Hermitbox on my Linux machine with cloud-init. Create the machine from an image that runs cloud-init, such as Ubuntu 24.04 or 26.04, with the page's `user-data.yaml` as its user data. On the machine, check that `curl -fsS http://127.0.0.1:8080/healthz` answers `"status":"ok"`, and have me read the `apiKey` from `sudo journalctl -u hermitbox-image` myself. Then give me the SSH tunnel command to reach the welcome page at `http://127.0.0.1:8080`. Never copy the key into this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md. Deploy Hermitbox on a Linux machine with a persistent disk by supplying the shipped [cloud-init user data](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/cloud-init/user-data.yaml). It runs the installer and `hermitbox up --image` once as root, keeping state on the machine's disk. ## Install with cloud-init 1. Create the machine from an image that runs cloud-init. CI boots Ubuntu 24.04 and 26.04 with this file. 2. Supply [user-data.yaml](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/cloud-init/user-data.yaml) as its user data. The installer puts only the CLI on the machine, and `hermitbox up --image` runs the release image as the `hermitbox-image` systemd service. 3. Find the key in the service journal: the image prints `apiKey` once, on its first successful start. ```sh sudo journalctl -u hermitbox-image ``` ## Verify and connect On the machine: ```sh curl -fsS http://127.0.0.1:8080/healthz ``` It answers with `"status":"ok"`. The service endpoint is HTTP, and its default origin is loopback. Reach the welcome page through an SSH tunnel, then open `http://127.0.0.1:8080` on your own computer: ```sh ssh -L 8080:127.0.0.1:8080 @ ``` The welcome page shows the key location and the configured tier. Enter the key there, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.1/get-started/connect.md). ## Machine notes This is the server installation of the release image. It installs Docker and its host firewall policy, and the image uses the container tier, refusing a missing policy. On `x86_64` it also registers gVisor's `runsc` with Docker. A public HTTPS deployment needs your own DNS and TLS setup and `HERMITBOX_PUBLIC_URL`. This file doesn't invent a domain or weaken TLS. No cloud-init provider or operating system can allocate a verified domain for a machine from this repository alone. This path needs root, systemd, Docker and the host firewall policy. On a host without them, the [installer](https://docs.hermitbox.dev/v0.2.1/get-started/install.md) selects a preset that fits, an ordinary user's included. A requested capability the host lacks is refused. Keep the state directory. See [operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md), [Host on a server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md) for the server preset without the image, and [cloud-init runcmd](https://docs.cloud-init.io/en/latest/reference/modules.html#runcmd). --- # Host on Railway > Let your agent do it: Deploy Hermitbox on Railway from its published template, https://railway.com/deploy/hermitbox, as one service with one state volume. If you can't act in my Railway account, walk me through each step in its dashboard. Then check that `/healthz` answers `"status":"ok"`, have me take the key from the service's variables or its first log, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately for the CLI, and run `hermitbox run -- echo hello`. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/railway.md. Deploy Hermitbox on Railway as one service with one state volume. [![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/hermitbox) The published template sets every value in the [Railway fields](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/railway/template.md) and generates the first API key. After it deploys, give the service 2 GiB of memory to start, then [verify the service](#verify-the-service). ## Create the service yourself Without the template: 1. In Railway's Template Composer, or in a new project, add one service from the image the [Railway fields](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/deploy/platforms/railway/template.md) name, with one replica. 2. Add a volume at `/var/lib/hermitbox`, generate a domain with target port `8080`, and set the health check to `/healthz`. 3. Set the variables from the same file; outside Template Composer, leave out `HERMITBOX_BOOTSTRAP_API_KEY`, whose value is a template function. Start with 2 GiB of memory for embedded Postgres, the store and sandboxes, then deploy. ## Verify the service ```sh curl -fsS https:///healthz ``` It answers with `"status":"ok"`. Point the CLI at the service with its key and run `hermitbox run -- echo hello`, as [Connect after deployment](https://docs.hermitbox.dev/v0.2.1/hosting.md#connect-after-deployment) shows. ## Railway notes In a template, `HERMITBOX_BOOTSTRAP_API_KEY=${{secret(64)}}` generates the key. Find it in **service → Variables**. On a service without that variable, read the `apiKey` the first successful start prints once in the service log. `RAILWAY_PUBLIC_DOMAIN` gives the HTTPS origin, and the fields also set `HERMITBOX_PUBLIC_URL` from it. Keep one instance, the image's root user, its writable container filesystem and its one state volume across redeploys. Process admission still requires the kernel policy in [Tiers and guarantees](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees); no user namespace, delegated cgroup, Docker or KVM is assumed. [Templates](https://docs.railway.com/templates), [variable functions](https://docs.railway.com/variables/reference), [volumes](https://docs.railway.com/volumes), [pricing](https://railway.com/pricing). --- # Host on Render > Let your agent do it: Deploy Hermitbox on Render from the repository's Blueprint. Keep its Standard web-service plan and its disk. If you can't act in my Render account, walk me through each step. When `/healthz` is healthy, have me take `HERMITBOX_BOOTSTRAP_API_KEY` from the service's Environment settings, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately for the CLI, and run `hermitbox run -- echo hello`. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/render.md. Deploy Hermitbox on Render from the repository Dockerfile, with a state disk and managed Postgres. The [root Blueprint](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/render.yaml) describes the whole service. [Deploy on Render](https://render.com/deploy?repo=https://github.com/hermitbox/hermitbox) ## Deploy the Blueprint 1. Open the deploy link above and apply the Blueprint. To deploy your own fork instead, open Render's **New → Blueprint**, connect the fork and select the branch that holds `render.yaml`. 2. Keep the Blueprint's Standard web-service plan and its disk. The bundled services and a default sandbox need more memory than a 512 MiB instance. 3. Wait for `/healthz` to become healthy, then find `HERMITBOX_BOOTSTRAP_API_KEY` in the service's **Environment** settings. ## Verify the service ```sh curl -fsS https:///healthz ``` It answers with `"status":"ok"`. Point the CLI at the service with that key and run `hermitbox run -- echo hello`, as [Connect after deployment](https://docs.hermitbox.dev/v0.2.1/hosting.md#connect-after-deployment) shows. ## Render notes The Blueprint builds the repository Dockerfile and keeps one 10 GB state disk at `/var/lib/hermitbox`. Render creates the Postgres database and passes its connection string to the service as `DATABASE_URL`. Render generates `HERMITBOX_BOOTSTRAP_API_KEY`. The key is never logged and never sent with the public welcome page. The image reads `RENDER_EXTERNAL_URL`, so agent and port aliases use the service's verified HTTPS origin. Set `HERMITBOX_PUBLIC_URL` yourself when you add a custom domain. The image's default user is root, and Render supplies the container filesystem and the disk. Host namespaces and cgroups are not assumed, and no Docker or KVM is attached. Keep the disk attached across deployments. [Tiers and guarantees](https://docs.hermitbox.dev/v0.2.1/hosting.md#tiers-and-guarantees) covers what runs here. [Blueprint reference](https://render.com/docs/blueprint-spec), [persistent disks](https://render.com/docs/disks), [pricing](https://render.com/pricing). --- # Host on a server with root > Let your agent do it: Install Hermitbox on this Linux systemd server with the server preset, which runs as root. Check that the domain's DNS A record points at this server and that inbound TCP 443 is open. Show me `curl -fsSL https://hbx.sh | sudo HERMITBOX_DOMAIN= sh` with my domain, and run it only after I confirm. Then run `hermitbox run --image alpine:3.22 -- echo hello` and `hermitbox doctor`, and tell me which tiers are on. Never copy the key into a file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/hosting/server.md. Install Hermitbox on a Linux systemd server as root with the server preset. Root turns on the tiers an ordinary user can't have: containers, gVisor, virtual machines and a separate user for each process sandbox. ```sh curl -fsSL https://hbx.sh | sudo HERMITBOX_DOMAIN=sandboxes.example.com sh ``` ## Before you install Point a DNS A record for the domain at the server, and allow inbound TCP 443 for HTTPS and certificate validation. The edge needs local TCP ports 80 and 443 for its HTTP and TLS fronts. Omit `HERMITBOX_DOMAIN` to install a local server on loopback port 7331, with path aliases. Run `sudo hermitbox up --check --domain sandboxes.example.com` on an installed CLI to print the plan without changing anything. ## Verify the install The installer prints the API URL, the key and a first command, and saves the URL and key for the account that ran `sudo`. Run the command it prints: ```sh hermitbox run --image alpine:3.22 -- echo hello ``` It prints `hello`. Then list what this host serves: ```sh hermitbox doctor ``` `hermitbox doctor` shows each tier as on or off, with the reason and what would change it. ## What root turns on | Capability | What the server preset adds | | --- | --- | | Containers from images | Docker and an nftables host firewall policy (`host-firewall`) | | gVisor | gVisor's pinned `runsc`, registered with Docker on `x86_64`; off elsewhere, with the reason | | Virtual machines | The signed VM bundle descriptor and `hermitboxd-vm-worker.service`, on `x86_64` with KVM | | Separate users | A UID pool for process sandboxes (`separate-users`), where the credential-drop probe passes | | Kernel network policy | Per-sandbox cgroup programs for process sandboxes: `host-firewall`, hostname egress and address rules | | HTTPS | A certificate for the domain from ACME, renewed by the `hermitbox-api-tls` unit | The node serves every tier its host permits, so process and Wasm sandboxes run beside these. Server sandbox placement needs private network and PID namespaces and enforced CPU and memory limits. The main daemon's unit hardening stays in force. [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md) explains each tier, and [host capabilities](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md) lists every guarantee. ## Server notes A systemd host gets Docker, nftables, persistent Docker volumes for the database and object store, control and edge units, and its enrolled local node. Debian and Ubuntu install missing packages automatically. Other distributions need Docker and nftables installed first, and the installer names them before it provisions anything. Without an `--allow-image` list of your own, the node admits `alpine:` and `node:` images, the pinned coding-agent and language-stack images, and the images the VM bundle is proven with. See [virtual machines](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md) for the VM tier's host requirements. The API is at `https://sandboxes.example.com` with an automatically renewed certificate. Existing domains stay immutable. See [operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for DNS, TLS, server upgrades, more nodes and explicit data removal. --- # Hermitbox Hermitbox runs sandboxes for your agents and your code on Linux hosts you own. Create a sandbox, run commands in it, keep its files, put it to sleep, snapshot or fork it, and delete it, all through one API. ```sh curl -fsSL https://hbx.sh | sh ``` Linux (x86_64 or aarch64), no root, no Docker. Then run your first command: ```sh ~/.local/bin/hermitbox run -- echo hello ``` ## Who it is for - **Agent builders.** Give an AI agent a sandbox to run code, install packages and keep files in, isolated to the tier you ask for. - **Product teams.** Run code your users or your agents write, on hardware you control. - **Operators.** Start with one machine, then add more as nodes of one fleet. ## What it solves - **Your hosts, your data.** Sandboxes run on Linux machines you own. Hermitbox needs no hosted service. - **One command to install.** The installer asks nothing, detects the host and takes the preset for it. Root, Docker and KVM turn on stronger tiers; none of them is needed to start. - **State without idle compute.** Sleep stops a sandbox's compute and keeps its files. The next command, connection or API call wakes it. - **The same start every time.** Templates and snapshots start each new sandbox in a known state, and a fork copies one. - **No silent downgrade.** A request that names a tier gets it, or a refusal that says what the host is missing. - **Every caller.** Agents connect over MCP. Code calls the TypeScript and Python SDKs, the CLI or the HTTP API. ## Building blocks - [Sandboxes](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): an isolated place to run commands, keep files and serve ports. - [Lifecycle](https://docs.hermitbox.dev/v0.2.1/concepts/lifecycle.md): start, stop, sleep, wake, rest, snapshot, fork and delete. - [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md): `process`, `wasm`, `container`, `gvisor` and `vm`, from a confined process to a virtual machine with its own kernel. - [Templates](https://docs.hermitbox.dev/v0.2.1/concepts/templates.md): a reusable starting state for new sandboxes. - [Nodes and fleet](https://docs.hermitbox.dev/v0.2.1/concepts/fleet.md): one machine runs Hermitbox on its own, and more machines join it as nodes. ## Documentation map - [Get started](https://docs.hermitbox.dev/v0.2.1/get-started/quickstart.md): install Hermitbox, run a first sandbox, and connect your agent or your code. - [Concepts](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): what a sandbox is, how it runs and sleeps, and how it is isolated. - [Guides](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md): run code, browsers, desktops and virtual machines, build templates, receive webhooks and add machines. - [Integrations](https://docs.hermitbox.dev/v0.2.1/integrations/claude.md): agents over MCP, GitHub Actions and agent frameworks. - [Hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md): where to run Hermitbox, from your own machine to a server or a platform that runs images. - [Reference](https://docs.hermitbox.dev/v0.2.1/sdk/typescript.md): the SDKs, the CLI, the HTTP API, the MCP tools and tiers in depth. [All documentation](https://docs.hermitbox.dev/v0.2.1/reference.md) lists every page. ## Next steps - [Quickstart](https://docs.hermitbox.dev/v0.2.1/get-started/quickstart.md): create a sandbox, run `echo hello` and delete it from the CLI, TypeScript or Python. - [Connect your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md): paste one prompt into your agent, or add `hermitbox mcp` to it yourself. --- # agentOS on Hermitbox > Let your agent do it: Run a sandbox on Hermitbox's `wasm` tier on this `x86_64` host. Each sandbox there is its own agentOS VM. Run `hermitbox run --isolation wasm -- echo hello` and show me the output. If it is refused, show me the reason it gives. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md. The wasm tier runs each sandbox in its own agentOS VM, with a virtual kernel and no container engine. # agentOS on Hermitbox The `wasm` tier runs each sandbox in its own agentOS VM on `x86_64`, with a virtual kernel and no container engine. Ask for it by name; a user install without Landlock ABI 3 selects it by default. ```sh hermitbox run --isolation wasm -- echo hello ``` `hermitboxd` owns the VMs through the published Rust client and a separate native sidecar. Control keeps placement, projects, units, epochs, leases and lifecycle. Clients use the same authenticated agent API and edge routes as on every other tier. The dependency is agentOS **0.4.7**, published from [`a4c049b2e25ceb2098889a307b71853526de2bdf`](https://github.com/rivet-dev/agentos/tree/a4c049b2e25ceb2098889a307b71853526de2bdf). The client and native protocol have no cross-version compatibility promise: both Rust crates and the sidecar are pinned together. No agentOS source is vendored into Hermitbox. ## Licence and distribution agentOS is Apache-2.0 licensed. Sections 2 and 4 permit embedding and redistribution with its licence and required notices retained; section 4 permits different terms for the aggregate. That permits this dependency in Hermitbox under AGPL-3.0-only, without relicensing agentOS. Its Apache licence and notice ship under the distribution's `licenses/` and `NOTICE` paths. Bundled software retains its own terms and sources in the pinned upstream software tree. `deploy/agentos.json` pins the Linux x86-64 GNU sidecar and Core software archive by npm SHA-512 integrity, and pins the extracted sidecar and each default software package by SHA-256. `scripts/fetch-agentos.py` verifies archives before extracting regular files, refuses links and paths outside its staging root, checks the binary again, and never executes downloads. The image includes the verified distribution. The release publishes the sidecar binary and software/licence archive alongside `hermitboxd`, under the existing checksum and attestation steps. The linked dependency is `agentos-client`; its same-version `agentos-sidecar-client` owns the wire types. The native sidecar speaks its own framed protocol over stdio and an inherited Unix socket. The static `hermitbox-agent` does not link agentOS. The daemon reuses that agent's router through explicit virtual-process and guest-ingress adapters. ## State and lifecycle The sandbox data directory contains `root.sqlite` for the VM's chunked SQLite root, plus a separate `content/` directory mounted at the sandbox's configured data path. That explicit agentOS host-directory mount is the only writable guest access to host files. The dependency also exposes its runtime libraries, including the host npm package, through read-only mappings. The existing descriptor walk serves the same content through the agent and stopped-node files API, including large streams; it does not expose the root database, runtime journal or signing keys. Snapshot, export, restore and fork copy the parent data directory, retaining both filesystem parts. VM disposal completes before the filesystem is copied. Sleep disposes compute and wake recreates it with the same root and content; processes, terminals, language contexts and open connections do not survive that recreation. Stop/start follow the same filesystem rule. The measured alternatives and the selected image default are in [tiers.md](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). The shared sidecar has a no-network manager VM that keeps its worker alive between sandbox creations. Its fixed memory cost is distinct from incremental VM memory. A private launcher holds a kernel lock across sidecar exec and arms Linux's parent-death signal. A new daemon cannot create VMs while the preceding worker can execute. Pending VM creation/disposal is durably recorded before effects and remains pending after uncertain outcomes. Environment values, including signing seeds and project secrets, are excluded from this journal. After daemon restart, old VMs are gone and control must send a full ensure before a VM is recreated on its retained data. The VM's initial identity matches its host-directory worker identity, so virtual permission checks agree with native mount metadata. A root daemon drops its sidecar to `wasm.worker_uid`/`worker_gid` (both default 60000, outside the default process UID pool), clears supplementary groups and sets no-new-privileges; an unprivileged daemon keeps its own UID. Reserve those worker IDs for the service and use consistent worker IDs across a fleet. The worker has a separate private home/cache. Project and provider environment are removed; the operator's PATH, proxy and CA configuration remain. The pinned sidecar resolves npm's JavaScript CLI from that host PATH and runs it inside the VM; the image includes Node/npm. Host-owned `wasm.max_ingress_requests` (default eight) bounds simultaneous exposed-application requests across VMs, in addition to each VM's connection and upstream frame bounds. Process counts and JavaScript, Python and WASM heap settings come from the declared resource envelope. These virtual runtime bounds are not per-VM Linux cgroups; the sidecar is a shared fault domain. Requested CPU-millis count toward control admission, but this shared worker does not enforce a per-VM CPU rate. Host service limits must bound the worker as a whole. ## API mapping | Hermitbox surface | agentOS operation | | --- | --- | | Create/start/wake | Create a VM with the same-version client, root database, explicit mount and host policy | | Stop/sleep/delete compute | Dispose the VM and await acknowledgement | | Run and processes | Spawn, retained output pages, exit observation, stdin and awaited signals | | Terminal | Open shell, ordered output, stdin, resize and close | | Files | The explicit persistent data mount, shared safe streaming path and agentOS virtual filesystem | | Declared ports and expose | Fixed and spare-port/revision listeners forwarded to the VM's streaming HTTP API | | Network | The VM network permission policy; `none` denies traffic outside its virtual network | | Packages | Pinned-release registry names resolved and digest-checked before installation | Application ingress supports HTTP over TCP. UDP is rejected at admission; raw TCP, TLS passthrough and application WebSockets are unavailable through this pinned streaming HTTP API. The agent API itself retains its authenticated WebSocket terminal and streaming routes. All listeners use the host-selected audience addresses. Safe GET/HEAD requests can wait up to three seconds for a newly starting listener; mutations and started responses are never repeated. The default wasm terminal uses the bundled shell's minimal input backend to preserve pasted multi-line commands; its rich line editor drops subsequent pasted lines in the pinned release. Requests authenticate with the same scoped, expiring sandbox capabilities as the other tiers. Project credentials never enter the guest. Commands execute inside the VM. A virtual PID is never passed to a host signal call. Output remains bounded and sequenced; sidecar callbacks only wake readers of retained output. Uncertain process termination fences that VM's work. `image` is refused on wasm with `422 invalid_request`, field `image`, and problem `this host runs the wasm tier; images are not available`. `packages` is optional, accepts registry names rather than URLs or host paths, and is sent only to nodes advertising `wasm-packages`. The eight bundled default packages need no runtime download. Additional names use the matching release catalog and fail if it is unavailable; operators can configure the upstream client's HTTPS registry mirror. No package mutation is retried automatically. ## Run agentOS as a Hermitbox guest Hosted agentOS has two services: Rivet's control plane and Rivet Services, which owns its `agentOS` actor and VMs. The embedded Core library needs neither. Its public groups cover processes, terminals, filesystem/mounts, JavaScript, TypeScript, Python, contexts, networking, software and cron. Core supports ephemeral roots, chunked SQLite roots and chunked S3 mounts; durable files survive recreation, while running processes and contexts do not. The current `AgentOsSandboxProvider.start` boundary still supplies an external process and filesystem client with disposal. The [prepared provider patch](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/integrations/rivet/upstream/agentos/README.md) places that external guest on a Hermitbox sandbox-agent template with a stable creation key and a service-held project key. It applies to upstream commit [`4662e362fb93adcfbfc86bfd51b51855d463f371`](https://github.com/rivet-dev/agentos/tree/4662e362fb93adcfbfc86bfd51b51855d463f371). This seam does not replace the hosted actor's VM identity, storage or ownership handoff with a remote VM factory; a full hosted placement adapter would need those additional contracts. The patch is not part of upstream agentOS. ## Local real-sidecar checks Stage the distribution into a new directory, then run the ordinary Rust suite unprivileged: ```sh # Stage the pinned distribution. python3 scripts/fetch-agentos.py /tmp/hermitbox-agentos-test # Run the Rust suite against it. HERMITBOX_AGENTOS_DISTRIBUTION=/tmp/hermitbox-agentos-test cargo test --locked ``` The wasm test uses the built `hermitboxd` as its private launcher. Missing assets are a setup failure; the test does not skip, substitute a fake backend or require a container engine. --- # ChatGPT support ChatGPT on the web connects to an MCP server at a public HTTPS address. Hermitbox's project-wide MCP server runs only on your machine, so there is nothing for ChatGPT to add yet. ## What Hermitbox offers | Surface | Where it listens | Reachable from ChatGPT | | --- | --- | --- | | `hermitbox mcp` | Standard input and output of a local process | No | | `hermitbox mcp --http ` | `http://127.0.0.1:/mcp`, bound to loopback, with Host and Origin checked | No | | A sandbox's own MCP endpoint | Your install's address, with an expiring capability for that one sandbox | Not tested | A sandbox's own endpoint comes from `hermitbox sandbox mcp-url `. Its tools act on that sandbox alone, and the URL expires on the agent token schedule. It isn't a project-wide endpoint, so it can't create or list sandboxes. [MCP](https://docs.hermitbox.dev/v0.2.1/reference/mcp.md) describes both surfaces. ## Use a local agent instead Give the prompt in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md#ask-your-agent) to an agent that runs on your machine, or connect [Codex](https://docs.hermitbox.dev/v0.2.1/integrations/codex.md). --- # Connect Claude Code > Let your agent do it: Connect Claude Code to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI where Claude Code runs, start Claude Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's server entry into the project's `.mcp.json`, which names the variables and never their values. After a restart, ask the server for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/claude.md. Give Claude Code the Hermitbox tools for a remote install through `hermitbox mcp` over stdio. On the machine where you ran the installer, use the keyless setup in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md) instead. 1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) where Claude Code runs. 2. Start Claude Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Merge this into project `.mcp.json`, restart, and ask for project defaults, a sandbox, hello and cleanup. Container defaults need an image; process and Wasm must omit it. ```json { "mcpServers": { "hermitbox": { "type": "stdio", "command": "hermitbox", "args": ["mcp"], "env": { "HERMITBOX_API_URL": "${HERMITBOX_API_URL}", "HERMITBOX_API_KEY": "${HERMITBOX_API_KEY}" } } } } ``` [Claude Code's reference](https://code.claude.com/docs/en/mcp) defines this file and its variable expansion. Host admission enforces [tier limits](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md), so an agent can't grant a capability the host lacks. --- # Connect Codex > Let your agent do it: Connect Codex to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI on the machine running Codex, start Codex with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's `[mcp_servers.hermitbox]` table into `~/.codex/config.toml`; its `env_vars` passes the values without storing the key. After a restart, ask for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/codex.md. Give Codex the Hermitbox tools for a remote install through `hermitbox mcp` over stdio. On the machine where you ran the installer, use the keyless setup in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md#codex) instead. 1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) on the machine running Codex. 2. Start Codex with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Merge this into `~/.codex/config.toml`, restart, and ask for project defaults, a sandbox, hello and cleanup. Supply an image only for a container default. ```toml [mcp_servers.hermitbox] command = "hermitbox" args = ["mcp"] env_vars = ["HERMITBOX_API_URL", "HERMITBOX_API_KEY"] ``` The [Codex reference](https://learn.chatgpt.com/docs/extend/mcp?surface=cli) also documents a project `.codex/config.toml` in trusted projects. `env_vars` passes the named values without storing the key. Host policy and [tier limits](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) stay in force. --- # Connect Cursor > Let your agent do it: Connect Cursor to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI on the machine running Cursor's MCP process, start Cursor with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's server entry into `.cursor/mcp.json`, which names the variables and never their values. After a restart, ask for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/cursor.md. Give Cursor the Hermitbox tools for a remote install through `hermitbox mcp` over stdio. On the machine where you ran the installer, the Add to Cursor link in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md#cursor) sets it up without a key. 1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) on the machine running Cursor's MCP process. 2. Start Cursor with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Merge this into `.cursor/mcp.json`, restart, and ask for project defaults, a sandbox, hello and cleanup. Supply an image only for a container default. ```json { "mcpServers": { "hermitbox": { "type": "stdio", "command": "hermitbox", "args": ["mcp"], "env": { "HERMITBOX_API_URL": "${env:HERMITBOX_API_URL}", "HERMITBOX_API_KEY": "${env:HERMITBOX_API_KEY}" } } } } ``` [Cursor's reference](https://cursor.com/docs/mcp) owns this file and its variable syntax. Keep literal credentials out of it. Requests keep the host's [tier refusals](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). --- # Connect GitHub Actions > Let your agent do it: Add a Hermitbox step to my GitHub Actions workflow. Check that my install has an address the runner can reach; a hosted runner can't reach a loopback install. Have me set the repository Actions variable `HERMITBOX_API_URL` and the secret `HERMITBOX_API_KEY` myself, and set `HERMITBOX_IMAGE` to `alpine:3.22` only for the container tier. Then add the page's step to a job: it runs `echo hello` and deletes its sandbox. Never copy the key into the workflow or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/github-actions.md. Run a command in a Hermitbox sandbox from a GitHub Actions workflow step. The Action creates the sandbox, runs the command and deletes the sandbox. 1. Host Hermitbox at an address your Actions runner can reach; hosted runners cannot reach a private loopback install. 2. Set repository Actions variable `HERMITBOX_API_URL` and secret `HERMITBOX_API_KEY`. Set variable `HERMITBOX_IMAGE` to `alpine:3.22` for containers; leave it empty for process or Wasm. 3. Put this step in a workflow job. The Action runs `echo hello` and deletes its sandbox. ```yaml - uses: hermitbox/hermitbox/action@v0.2.1 with: url: ${{ vars.HERMITBOX_API_URL }} key: ${{ secrets.HERMITBOX_API_KEY }} image: ${{ vars.HERMITBOX_IMAGE }} run: echo hello ``` The Action's tag follows the repository's release version. Images need the container tier. An empty image selects the host's default tier and never substitutes a weaker isolation. See the [Action inputs](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/action/action.yml) and [tier boundaries](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). --- # Connect agents over MCP > Let your agent do it: Connect my MCP client to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI on the machine running the agent, launch the agent with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's server entry into the client's settings file in its own variable syntax, naming the variables and never their values. After a restart, ask for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/mcp.md. Give any MCP client the Hermitbox tools for a remote install through `hermitbox mcp` over stdio. On the machine where you ran the installer, use the keyless setup in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md) instead. 1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) on the machine running your agent. 2. Launch the agent with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Merge this into project `.mcp.json`, restart, and ask for project defaults, a sandbox, hello and cleanup. Use an image only when the default tier is container. ```json { "mcpServers": { "hermitbox": { "type": "stdio", "command": "hermitbox", "args": ["mcp"], "env": { "HERMITBOX_API_URL": "${HERMITBOX_API_URL}", "HERMITBOX_API_KEY": "${HERMITBOX_API_KEY}" } } } } ``` Each agent reads its own file, with its own variable syntax: see [Claude Code](https://docs.hermitbox.dev/v0.2.1/integrations/claude.md), [Cursor](https://docs.hermitbox.dev/v0.2.1/integrations/cursor.md), [Codex](https://docs.hermitbox.dev/v0.2.1/integrations/codex.md), or [VS Code and Copilot](https://docs.hermitbox.dev/v0.2.1/integrations/vscode.md). A named isolation or capability the host lacks is refused. See [MCP tools and transports](https://docs.hermitbox.dev/v0.2.1/reference/mcp.md) and [tier boundaries](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md). --- # Connect a Rivet harness > Let your agent do it: Make Hermitbox the sandbox provider of my Rivet agent harness. Install `hermitbox` in the Rivet runner project, and set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, never in code or this chat. Replace the harness's sandbox factory with the page's `hermitboxProvider()` export, and keep the returned sandbox ID in actor state. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/rivet-harness.md. Use Hermitbox as the sandbox provider for an agent harness in a Rivet runner. The provider creates, connects, suspends and deletes Hermitbox sandboxes behind the harness's existing factory. 1. Install `hermitbox` in your Rivet runner project. 2. Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Replace the harness's sandbox factory with this export; keep the returned ID in actor state. ```ts import { hermitboxProvider } from 'hermitbox/provider' export const sandboxProvider = hermitboxProvider() ``` The provider reads the default tier and uses an image only for containers. File paths resolve inside the sandbox's reported `cwd`. Shared-UID processes must trust each other, and internet-enabled processes share host networking. Wasm has a virtual kernel and a shared sidecar, with HTTP-only ingress. A named missing tier keeps its admission refusal, and this API version refuses a named guarantee it can't prove. [The full integration guide](https://docs.hermitbox.dev/v0.2.1/integrations/rivet.md) covers lifecycle semantics and partial methods. OpenOrange 1.0.2 needs the prepared upstream patch, because its releases don't include that provider hook. Follow that guide before you try its registration or preview callback. --- # Rivet and OpenOrange > Let your agent do it: Back my Rivet Actor's agent harness with Hermitbox. Install `hermitbox` beside the harness, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` on the runner and nowhere else, never in a response or this chat, and use the page's `hermitboxProvider()` factory as the harness's sandbox provider, keeping its existing hooks. For an OpenOrange Sandbox binding, tell me first that the published release can't select Hermitbox without the prepared patch the page links. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/rivet.md. Back a Rivet Actor's agent harness, or an OpenOrange Sandbox binding, with Hermitbox sandboxes. The TypeScript SDK exports `hermitboxProvider` from `hermitbox/provider`, which implements Rivet's published `SandboxProvider` contract. Install the SDK alongside your existing adapter, and set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the actor runner's environment. Keep the key there; it never belongs in a Worker response or a sandbox environment. ## Agent harness in a Rivet Actor 1. Install `hermitbox` alongside your harness. 2. Set the install's `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` on the runner. 3. Use this factory for the harness's sandbox provider. Keep its existing `create`/`connect`, `suspend` and `destroy` hooks; the Actor stores the sandbox id as before. ```ts import { hermitboxProvider } from 'hermitbox/provider' export const sandboxProvider = hermitboxProvider() ``` Run the complete lifecycle example with `bun examples/rivet-provider.ts`. It needs no model key. The provider holds no per-Actor state. `create` returns an id, `connect` starts stopped compute or wakes a sleeping sandbox, `suspend` sleeps it with data kept, and `destroy` deletes it. Connecting to a deleted or expired sandbox returns `undefined`; authentication, placement and transport failures throw. A missing sandbox makes `suspend`/`destroy` a no-op. Mutations are sent once. ## OpenOrange sandbox binding OpenOrange 1.0.2 has a closed list of provider names and no custom-provider registration API. It cannot select Hermitbox in an unmodified release. The [prepared patch](https://docs.hermitbox.dev/v0.2.1/upstream/open-orange.md) adds that registration; it is not part of the published OpenOrange package. With that change applied, the connection is: 1. Install `hermitbox` next to OpenOrange. 2. Set `HERMITBOX_API_URL`, `HERMITBOX_API_KEY` and `ORANGE_SANDBOX_PROVIDER=hermitbox` on the runner. 3. The provider registration below backs the existing Sandbox binding; Worker code keeps its existing `getSandbox()` calls. The prepared patch supplies the native file/preview bridge. ```ts import { hermitboxProvider, hermitboxPortAddress } from 'hermitbox/provider' export const sandboxProvider = hermitboxProvider() export const portAddress = (id: string, port: number) => hermitboxPortAddress(id, port) ``` The binding uses the connected sandbox's persistent directory: `/data` on mounted tiers, or the agent's data directory on the process tier. Native file paths must stay inside that root. The host's default tier applies; a caller can pass `{ tier, template, require }` to the factory, along with optional `url` and `key` overrides. The provider does not pass `require` to the API: every nonempty `require` is refused with `missing_guarantee` and the names, before creation. No requirement is silently dropped. Unavailable tiers and templates retain the API's reason. Container creation uses the project's configured `repoImage` when no template was named. A template used with this provider must mount its persistent storage at `/data` on mounted tiers. Use `sandbox.cwd` to resolve file paths and execution directories; the provider learns the process directory when connecting and leaves the optional provider-level `cwd` unset. Exec accepts absolute `cwd`, an explicit environment, a millisecond timeout and an AbortSignal. Undefined or zero timeout adds no provider deadline; the install's execution ceiling still applies. Timeout kills the process group and returns `timedOut: true` and `exitCode: null`. Abort kills it and rejects with `Error('aborted')`, including an abort during process startup. `onData` receives stdout and stderr as they arrive; final output keeps the streams separate. Nonzero exits are results. Output above the SDK's capture budget throws `output_truncated`; connection loss keeps the SDK's unknown-outcome error and never replays the command. `hermitboxPortAddress(id, port)` publishes a port through Hermitbox's own edge and returns its preview URL. No sandbox IP or direct host listener is returned. Capacity and host policy refusals remain visible. The prepared binding patch sends preview requests through that address. OpenOrange's other partial and unsupported methods stay as documented by its [Sandbox binding](https://raw.githubusercontent.com/rivet-dev/open-orange/1cabf2e9db300361c9f0b751c7723da7eb706f5e/docs/modules/sandbox.mdx): its session/code-context methods throw, inactivity timeout does nothing, container images and custom entrypoints are not run, and PTY/stdin, interception, container snapshots and inspection are unsupported. Full `Files.stat/lstat` metadata remains unavailable through this bridge. ## Browser rendering The current Hermitbox browser is **not a fixed OpenOrange Browser Rendering endpoint**. `box.browser()` mints a capability URL that expires within five minutes; minting another rotates access, and sleep/recreation also invalidates old access. OpenOrange reads one `ORANGE_BROWSER_CDP_URL`, opening a new connection to it for each launch, and has no callback for refreshing that capability. Do not place a minted Hermitbox browser URL in that variable. No persistent browser compatibility is claimed. The [Browser Rendering rules](https://raw.githubusercontent.com/rivet-dev/open-orange/1cabf2e9db300361c9f0b751c7723da7eb706f5e/docs/modules/browser-rendering.mdx) require a URL that accepts each new connection; Hermitbox's short-lived browser access remains available through its own SDK. ## Pinned interfaces sandbox-adapter **0.5.6**, Apache-2.0, from the integrity-pinned npm package; OpenOrange **1.0.2**, Apache-2.0, commit `1cabf2e9db300361c9f0b751c7723da7eb706f5e`. The published adapter declares abort as `Error('aborted')`, timeout as a null exit and a flag, and missing connections as undefined. Its Docker provider stops and restarts on suspend and connect; normal command failures remain results. The declarations are a development dependency only. ## How this is tested CI typechecks this version on every change and the newest published version weekly. Acceptance against a real Hermitbox deployment exercises every provider method, cancellation, streaming, sleep/wake persistence, missing connections and edge preview; both pages' blocks and the complete example run in the same job. --- # Connect VS Code and Copilot > Let your agent do it: Connect Copilot's agent mode in VS Code to my remote Hermitbox install through `hermitbox mcp`. Install the Hermitbox CLI where the Copilot MCP process runs, start VS Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment, and merge the page's server entry into `~/.copilot/mcp-config.json`, which names the variables and never their values. After restarting the agent harness, ask for the project's defaults, create a sandbox, run `echo hello` in it and delete it. Never copy the key into the file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/integrations/vscode.md. Give Copilot's agent mode in VS Code the Hermitbox tools for a remote install through `hermitbox mcp` over stdio. On the machine where you ran the installer, use the keyless setup in [Use Hermitbox with your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md#vs-code) instead. 1. Install the [Hermitbox CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md) where the Copilot MCP process runs. 2. Start VS Code with `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in its private environment. 3. Merge this into `~/.copilot/mcp-config.json`, restart the native agent harness, and ask for project defaults, a sandbox, hello and cleanup. Use an image only for containers. ```json { "mcpServers": { "hermitbox": { "type": "stdio", "command": "hermitbox", "args": ["mcp"], "tools": ["*"], "env": { "HERMITBOX_API_URL": "${HERMITBOX_API_URL}", "HERMITBOX_API_KEY": "${HERMITBOX_API_KEY}" } } } } ``` The current [VS Code reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration) defines this native-harness file, and `COPILOT_HOME` can move its directory. The same reference describes shared project configurations. Host [tier boundaries](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) still apply. --- # All documentation Every page of the Hermitbox documentation, grouped as in the sidebar. ## Introduction - [Hermitbox](https://docs.hermitbox.dev/v0.2.1/index.md): what Hermitbox is, who it is for and how these docs are organised. ## Get started - [Quickstart](https://docs.hermitbox.dev/v0.2.1/get-started/quickstart.md): install, then create a sandbox, run `echo hello` and delete it from the CLI, TypeScript or Python. - [Install](https://docs.hermitbox.dev/v0.2.1/get-started/install.md): the one-command installer and its presets for a user, a server, a container, an image platform and a fleet node. - [Connect your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md): the agent prompt, and `hermitbox mcp` for Claude, Cursor, VS Code, Codex and any MCP client. - [Choose a caller](https://docs.hermitbox.dev/v0.2.1/get-started/connect.md): every way to call Hermitbox, with its guide. - [TypeScript](https://docs.hermitbox.dev/v0.2.1/get-started/typescript.md): create, run and delete from a Node or Bun backend. - [Python](https://docs.hermitbox.dev/v0.2.1/get-started/python.md): create, run and delete from a Python application. - [CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md): run a one-shot command in a sandbox from your shell. - [HTTP](https://docs.hermitbox.dev/v0.2.1/get-started/http.md): call the API with `curl` and a project key. ## Concepts - [Sandboxes](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): an isolated place to run commands, keep files and serve ports. - [Lifecycle](https://docs.hermitbox.dev/v0.2.1/concepts/lifecycle.md): how sandboxes start, sleep, wake, snapshot, fork and delete. - [Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md): each tier, from a confined process to a virtual machine. - [Templates](https://docs.hermitbox.dev/v0.2.1/concepts/templates.md): starting every new sandbox in the same state. - [Nodes and fleet](https://docs.hermitbox.dev/v0.2.1/concepts/fleet.md): one machine on its own, or many machines as nodes. - [Security model](https://docs.hermitbox.dev/v0.2.1/concepts/security.md): what Hermitbox isolates, what it trusts, and what it never puts in a sandbox. ## Guides - [Run code](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md): persistent Python and JavaScript contexts in a sandbox. - [Browser and desktop](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md): headless browsers, X11 desktops, SSH and bucket mounts. - [Virtual machines](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md): the `vm` tier, with a Linux kernel per sandbox. - [Templates from code](https://docs.hermitbox.dev/v0.2.1/guides/templates-from-code.md): prepare a sandbox once and start others from it. - [Webhooks](https://docs.hermitbox.dev/v0.2.1/guides/webhooks.md): receive signed sandbox lifecycle events at your HTTPS endpoint. - [Docker clients](https://docs.hermitbox.dev/v0.2.1/guides/docker-clients.md): container engines and the Docker socket experiment. - [Add machines](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md): machine providers that add and remove fleet hosts. - [Operate a fleet](https://docs.hermitbox.dev/v0.2.1/guides/operate.md): nodes, placement, upgrades and the operator API. ## Integrations ### Agents - [Claude](https://docs.hermitbox.dev/v0.2.1/integrations/claude.md): connect Claude Code to a remote install. - [Cursor](https://docs.hermitbox.dev/v0.2.1/integrations/cursor.md): connect Cursor to a remote install. - [VS Code](https://docs.hermitbox.dev/v0.2.1/integrations/vscode.md): connect VS Code and Copilot to a remote install. - [Codex](https://docs.hermitbox.dev/v0.2.1/integrations/codex.md): connect Codex to a remote install. - [ChatGPT](https://docs.hermitbox.dev/v0.2.1/integrations/chatgpt.md): what ChatGPT needs from an MCP server. - [Any MCP client](https://docs.hermitbox.dev/v0.2.1/integrations/mcp.md): the stdio configuration for any agent. ### Frameworks - [GitHub Actions](https://docs.hermitbox.dev/v0.2.1/integrations/github-actions.md): run a command in a sandbox from a workflow step. - [Rivet](https://docs.hermitbox.dev/v0.2.1/integrations/rivet.md): the Rivet sandbox provider and OpenOrange. - [Rivet agent harness](https://docs.hermitbox.dev/v0.2.1/integrations/rivet-harness.md): Hermitbox as a Rivet runner's sandbox provider. - [agentOS](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md): how the `wasm` tier runs agentOS. ## Hosting - [Choose where](https://docs.hermitbox.dev/v0.2.1/hosting.md): every place to host Hermitbox, and what each keeps. - [Railway](https://docs.hermitbox.dev/v0.2.1/hosting/railway.md): one service with one state volume. - [Render](https://docs.hermitbox.dev/v0.2.1/hosting/render.md): the repository Dockerfile, a state disk and managed Postgres. - [Fly.io](https://docs.hermitbox.dev/v0.2.1/hosting/fly.md): one Machine with a persistent state volume. - [Koyeb](https://docs.hermitbox.dev/v0.2.1/hosting/koyeb.md): one web service with a persistent volume. - [Coolify](https://docs.hermitbox.dev/v0.2.1/hosting/coolify.md): a Docker Compose service on your Coolify host. - [DigitalOcean](https://docs.hermitbox.dev/v0.2.1/hosting/digitalocean.md): a Droplet set up by cloud-init. - [Your own machine](https://docs.hermitbox.dev/v0.2.1/hosting/own-machine.md): a Linux machine with a persistent disk, set up by cloud-init. - [Server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md): the server preset on a Linux systemd server. - [Release image](https://docs.hermitbox.dev/v0.2.1/hosting/container.md): the all-in-one image on Docker or any container host. ## Reference - [TypeScript SDK](https://docs.hermitbox.dev/v0.2.1/sdk/typescript.md): every TypeScript method. - [Python SDK](https://docs.hermitbox.dev/v0.2.1/sdk/python.md): every Python method, sync and async. - [CLI](https://docs.hermitbox.dev/v0.2.1/reference/cli.md): the `hermitbox` command and its subcommands. - [HTTP API](https://docs.hermitbox.dev/v0.2.1/reference/api.md): the public API under `/v1`. - [MCP tools](https://docs.hermitbox.dev/v0.2.1/reference/mcp.md): the MCP server's tools, resources and transports. - [Tiers in depth](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md): each tier's guarantees, needs and measurements. - [Capabilities](https://docs.hermitbox.dev/v0.2.1/reference/capabilities.md): every capability and where it is implemented. - [Host capabilities](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md): the guarantees a host enforces, and how to require them. ### Internals - [Architecture](https://docs.hermitbox.dev/v0.2.1/reference/architecture.md): `hermitboxd`, control and the edge, and what each owns. - [Threat model](https://docs.hermitbox.dev/v0.2.1/reference/threat-model.md): adversaries, trust boundaries and invariants. - [Node protocol](https://docs.hermitbox.dev/v0.2.1/reference/protocol.md): how control talks to `hermitboxd` on each host. - [Sandbox agent](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md): `hermitbox-agent`, PID 1 in each sandbox. - [Process tier](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md): how process sandboxes are confined. - [Network policy](https://docs.hermitbox.dev/v0.2.1/reference/bpf.md): eBPF network policy for process sandboxes. - [Store leases](https://docs.hermitbox.dev/v0.2.1/reference/store-lease.md): the object-store execution lease. - [Speed](https://docs.hermitbox.dev/v0.2.1/reference/speed.md): interpreter and tool measurements. - [Edge](https://docs.hermitbox.dev/v0.2.1/reference/edge.md): how long clients wait while the edge wakes a sandbox. - [Decisions](https://docs.hermitbox.dev/v0.2.1/decisions.md): each choice Hermitbox has made, and why. - [Upstream patches](https://docs.hermitbox.dev/v0.2.1/upstream/open-orange.md): the OpenOrange provider registration. --- # Public API Hermitbox's public HTTP API lives under `/v1` on your install's API URL. Authenticate every request with `Authorization: Bearer `; requests and responses are JSON, and exec and logs stream NDJSON. Create, list and revoke keys with `hermitbox key` on the private operator listener; the key chooses the project. See [control/README.md](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/README.md) for configuration, and the [TypeScript](https://docs.hermitbox.dev/v0.2.1/sdk/typescript.md) and [Python](https://docs.hermitbox.dev/v0.2.1/sdk/python.md) SDKs for examples. ## Endpoints ### Project and audit | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | GET | `/v1/audit` | — | 200 | | GET | `/v1/project` | — | 200 | ### Sandboxes and lifecycle | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | GET | `/v1/sandboxes/{id}/why` | — | 200 | | POST | `/v1/sandboxes/{id}/ssh` | SshRegister | 200 | | DELETE | `/v1/sandboxes/{id}/ssh` | — | 200 | | GET | `/v1/sandboxes/{id}/metrics/stream` | — | 200 | | POST | `/v1/sandboxes/{id}/token` | — | 200 | | POST | `/v1/sandboxes/{id}/network` | — | 200 | | POST | `/v1/sandboxes` | MakeRequest | 201 | | GET | `/v1/sandboxes` | — | 200 | | POST | `/v1/sandboxes/{id}/lifetime` | LifetimeRequest | 200 | | GET | `/v1/sandboxes/{id}/metrics` | — | 200 | | GET | `/v1/sandboxes/{id}` | — | 200 | | DELETE | `/v1/sandboxes/{id}` | — | 200 | | POST | `/v1/sandboxes/{id}/start` | — | 200 | | POST | `/v1/sandboxes/{id}/stop` | — | 200 | | POST | `/v1/sandboxes/{id}/sleep` | — | 200 | | POST | `/v1/sandboxes/{id}/wake` | — | 200 | | POST | `/v1/sandboxes/{id}/rest` | — | 200 | | GET | `/v1/sandboxes/{id}/endpoints` | — | 200 | | GET | `/v1/sandboxes/{id}/events` | — | 200 | ### Exec and logs | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | POST | `/v1/sandboxes/{id}/exec` | ExecRequest | 200 | | GET | `/v1/sandboxes/{id}/logs` | — | 200 | ### Files and data | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | GET | `/v1/sandboxes/{id}/data/content` | — | 200 | | PUT | `/v1/sandboxes/{id}/data/content` | — | 204 | | GET | `/v1/sandboxes/{id}/data/list` | — | 200 | | GET | `/v1/sandboxes/{id}/data/stat` | — | 200 | | PUT | `/v1/sandboxes/{id}/files/{path}` | — | 200 | | GET | `/v1/sandboxes/{id}/files/{path}` | — | 200 | | PUT | `/v1/sandboxes/{id}/file-chunks/{path}` | — | 200 | | GET | `/v1/sandboxes/{id}/file-chunks/{path}` | — | 200 | ### Snapshots | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | POST | `/v1/sandboxes/{id}/snapshots` | — | 201 | | GET | `/v1/sandboxes/{id}/snapshots` | — | 200 | | DELETE | `/v1/sandboxes/{id}/snapshots/{snapshot}` | — | 200 | | POST | `/v1/snapshots/{snapshot}/sandboxes` | MakeRequest | 201 | ### Templates | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | POST | `/v1/templates/{name}/versions` | TemplateVersionRequest | 201 | | GET | `/v1/templates/{name}/versions` | — | 200 | | POST | `/v1/templates` | TemplateRequest | 201 | | GET | `/v1/templates` | — | 200 | ### Webhooks | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | POST | `/v1/webhooks` | WebhookRequest | 201 | | GET | `/v1/webhooks` | — | 200 | | DELETE | `/v1/webhooks/{id}` | — | 200 | | GET | `/v1/webhooks/{id}/deadletters` | — | 200 | ## Requests and errors Requests and responses are defined in [the OpenAPI document](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/openapi/hermitbox.openapi.json). Exec and logs use `application/x-ndjson`. Exec forwards live agent stdout and stderr chunks, a final exit event, and an error event for a failure after headers. File writes take JSON `dataBase64`, and reads return a base64 tar archive. File paths are relative to persistent storage. Use a stable `Idempotency-Key` for retried create or exec requests; reusing one for different input is refused. An exec with an uncertain outcome is never replayed automatically. Lifecycle operations return the reached sandbox and, for sleep and wake, its tier. TTL expires access immediately, and upkeep deletes data. Idle is evaluated from activity and live sessions. Templates warm each active node once and retain a stopped snapshot. Public endpoints include their edge hostname and port; private endpoints are reachable only on the private network. Errors have the node envelope `{error:{code,message,details}}`. Invalid fields answer 422, missing keys 401, forbidden operations 403, missing resources 404, state conflicts 409, expired TTL 410 and unavailable placement 503. API v1 evolves additively. ## Direct sandbox operations `POST /v1/sandboxes/{id}/token` returns a short-lived sandbox capability and agent URL. SDKs cache it and send running processes, terminals, streamed files and runtime expose requests through the edge directly to `/_hermitbox/`. The project key is never sent to the sandbox. See [the agent API](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md) for its contract, file URLs, spare ports and network policy. The `/data/content`, `/data/list` and `/data/stat` routes use the node files feature while compute is stopped or sleeping. Raw content streams as `application/octet-stream`; JSON requests stay bounded. ## Projects and limits An operator creates a project with `POST /operator/v1/projects` on the private operator listener. The body accepts `name`, `key:true` and any project limit; the response includes the project, effective limits, usage, and one new raw key only when requested. `GET` on the collection lists projects, and `GET`, `PATCH` or `DELETE` on `/` views, changes or deletes one. `POST //freeze` stops its sandboxes and refuses public writes; `/unfreeze` permits new work without restarting them. `GET //usage` and public `GET /v1/project` show units and counts against effective limits. `hermitbox project create --max-units 5 --max-running 3 --max-ttl 2h --expires-in 24h` creates a project, and `hermitbox key create --project ` prints a key once. `hermitbox project` `ls`, `get`, `set`, `freeze`, `unfreeze` and `rm` use the same operator listener. `set` accepts `--max-*` flags, `--allowed-images` comma-separated prefixes and `--expires-in`. A value of `unlimited` resets a numeric or image limit to inheritance. Units default to 512 MiB and 250 CPU millis (`HERMITBOX_UNIT_MEMORY_MB`, `HERMITBOX_UNIT_CPU_MILLIS`). Create accepts `units` (default one) or explicit resources rounded upward to whole units. `cpuReservationMillis` records admission CPU, not an enforced ceiling. Container units retain their quotas. Process and Wasm units reserve CPU without a quota; explicit `cpuMillis` ceilings or `cpuWeight` requests on those tiers return 422 with the resource field identified. A VM's `cpuMillis` ceiling is its guest's whole vCPUs: a positive multiple of 1000, or 422 on `resources.cpuMillis`. Units round it down to the whole vCPUs they pay for, and `cpuWeight` returns 422. Use container isolation when a weight is required. Node listings include `unitsFree` and regional totals after host and running reservations. Project limits are `maxUnits`, `maxSandboxes`, `maxRunning` (including suspension with memory held), `maxUnitsPerSandbox`, `maxTtl`, `maxIdle`, `maxExecTimeout`, `maxSnapshots`, `maxSnapshotBytes`, `maxEgressPorts`, `allowedImages` and `expiresAt`. A refusal is 403 `limit_exceeded` with `details:{name,limit,current}`. Unknown command outcomes retain their compute reservation until a confirmed stop, so a retry never exceeds quota. Snapshot bytes are measured before publication. Lower aggregate limits freeze excess usage; expiry deletes owned data and revokes keys. Lists and all resource routes are project-scoped, and foreign IDs answer 404. Each limit has `HERMITBOX_PROJECT_` as its deployment default, for example `HERMITBOX_PROJECT_MAX_UNITS` and `HERMITBOX_PROJECT_ALLOWED_IMAGES`. Missing defaults are unlimited. Non-null project columns override defaults; null restores inheritance. `maxTtl` and `maxIdle` also supply omitted sandbox timers. Public image permissions always remain bounded by host policy. ## Isolation and software Creation accepts `container`, `gvisor`, `process`, `vm` or `wasm` isolation. Placement and template warming need a node that advertises the requested tier. Project usage counts all tiers in units. Sandbox responses report the selected tier in `isolation`. Container accepts host-permitted images. Process and wasm refuse images with a field-specific 422 `invalid_request`. `packages` is an array of agentOS registry names, available only for wasm and sent only after the node advertises `wasm-packages`. Names are not URLs or host paths. The no-engine image default and measured comparison are in [tiers.md](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md); [agentos.md](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md) describes persistence, software distribution and the agentOS boundary. ## SDK handles and live commands The TypeScript and Python SDK READMEs contain executable handle examples. Commands start on call: `run` returns a native promise or task, or a sync result, and `stream` iterates output with `lines` and `result`. Each command receives one idempotency key, and mutations never retry automatically. A stream ending without its exit has an unknown outcome. Public exec and logs forward agent frames into their published v1 records; failures after exec headers use an error event. `PUT /v1/sandboxes/{id}/file-chunks/{path}` accepts `offset` (a 32 KiB boundary) and `dataBase64` (up to 32 KiB decoded); `GET` returns a base64 tar member named `data`. These v1 JSON representations remain for HTTP callers; SDKs use binary streams directly. Control forwards binary bytes to the agent, with stopped data served by the node. Positional JSON writes spool existing bytes to a private control temp file before replacement, keeping RAM bounded. Callers must serialize concurrent writers; multi-request writes are not atomic. Decoded JSON file reads use the node-owned JSON memory bound; binary streams and chunk reads have no total file bound. No sandbox command or archive extraction is involved. Paths remain relative, without dot segments or symlink components. ## Field surface Create accepts `env`, `labels`, a project-unique `name`, `metadata` as a JSON object, an absolute `workdir`, a numeric `user`, `idle` and `autoDelete`. The requested user must equal the operator container UID policy, and process and wasm refuse user selection. `autoDelete` requires `idle` and deletes after idle instead of retaining compute and data. `GET /v1/sandboxes` filters by name, label subset and state. Names remain reserved until deletion. SDK ID or name lookup wakes sleeping or resting data unless `wake` is false. ### Lifecycle and metrics `POST /v1/sandboxes/{id}/lifetime` takes exactly one positive `keepAlive`, `ttl` or `idle` in seconds, bounded by project ceilings and expiry. `keepAlive` extends access and touches activity; `ttl` replaces the deadline from now. `GET /metrics` returns the last node CPU, memory, disk and network sample without polling; `since` returns up to 2000 minute samples. `GET /metrics/stream` pages through retained history from `since`, then follows current observations as NDJSON. Set `follow=false` for a finite result. The CLI streams these samples with `hermitbox sandbox top ` and accepts `--since` and `--once`. History persists for the lifetime of the sandbox, and unavailable counters are null. SDK `waitUntil` polls public state. `events` uses NDJSON with `stream=true`, an optional `since` timestamp and `follow=true`. Plain v1 events still returns its published JSON shape. ### Processes and shells The SDK process handle adds `waitForPort` (HTTP or TCP, path, status and timeout), `waitForLog`, `waitForExit` and `logs`. A deadline is `wait_timeout`; exit before readiness is `process_exited`. `run` and `spawn` accept one-shot stdin text or bytes. Sandbox `processes` and `killAll` inspect and stop owned processes. `shell` opens a serialized stateful pipe session with separate stderr and exact exit codes; `close` ends it. See [agent.md](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md) for all versioned routes and budgets. ### Files and Git Files add `exists`, `find` glob, `grep` and literal replacement at regex matches, `chmod`, caller-disk upload and download with progress callbacks, tar `uploadDir` and `downloadDir`, and SHA-256 upsert `sync`. CLI `cp` uses these methods. Git `clone`, `status`, `diff`, `branch`, `checkout`, `add`, `commit`, `push`, `pull` and `log` return parsed values with raw output. Clone supports path, branch, depth and token; commit supports author, diff supports staged, and log supports limit. Tokens use an HTTPS host-scoped one-call credential helper, never a persisted credential file. Git clone, push and pull and their transient VM bridge default to five minutes with per-call timeout overrides, disable background maintenance and unset all trace destinations. Wasm clone metadata uses the persistent guest filesystem while checkout data stays mounted. Repo creation clones before returning and retains the sandbox identity if preparation fails. ### Template builds The SDK `template` method builds from image or isolation with copy pairs, env and workdir, run commands and ready; only a successful ready publishes a snapshot version. Creating from a version runs start in the sandbox data directory unless an explicit workdir is set. `POST /v1/templates/{name}/versions` registers an owned completed snapshot and its start plan; `GET` lists immutable versions. A referenced snapshot and hidden builder cannot be deleted while versions use them. SDK `rebuild` uses the same local context. CLI `templates` lists versions, and `template build -f hermitbox.template.ts` imports its default plan. ### Egress Container `egress:{allow:[hosts],deny:[hosts]}` requires the announced `egress-hostnames` node feature and a root-installed firewall. Deny overrides allow, and a wildcard matches only subdomains. The bridge redirects HTTP and TLS to host gateways, resolves and pins public destinations at connect time, refuses raw IPs, non-public answers and answers naming an address of this host, and blocks other new outbound protocols. TLS passes through with certificate checks intact. Process sandboxes take it where their node announces `tier-process:egress-hostnames` (kernel network policy, [bpf.md](https://docs.hermitbox.dev/v0.2.1/reference/bpf.md)); wasm refuses it with the tier named. `egressAddresses:{allow:[{prefix,ports?}],deny:[…]}` allows or denies exactly those prefixes and inclusive port ranges, deny first. It is placed only on a tier announcing `egress-addresses` (kernel policy on the process tier) and cannot name loopback, link-local, multicast or IPv4-mapped ranges. Rules whose ports, with those of every wider prefix, come to more than 24 ranges on one address are refused on `egressAddresses`, naming the prefix. The request cannot configure firewall readiness or relax host policy. ## Lifecycle webhooks `POST /v1/webhooks` takes `url` and `kinds`; `GET` lists, `DELETE /` removes, and `GET //deadletters` inspects exhausted delivery. Kinds are `created`, `running`, `sleeping`, `woken`, `resting`, `deleted`, `failed`, `ttl_expired` and `idle_slept`. Creation returns the secret once; listing never does. The payload is `{id,event,sandboxId,at}`, with no sandbox env, metadata or secret values. A lifecycle transaction enqueues delivery atomically. Verify `hermitbox-signature` as `v1=` plus lowercase hex HMAC-SHA256 using the full UTF-8 creation secret over `hermitbox-timestamp` + a literal dot + the exact raw body bytes. Compare in constant time, reject stale timestamps, and deduplicate `hermitbox-id` across retries. The timestamp is Unix seconds. Delivery resolves all addresses once, refuses non-public DNS, pins the chosen destination with original HTTPS SNI and Host, verifies TLS and never follows redirects. An operator can explicitly allow an owned private receiver with `HERMITBOX_WEBHOOK_ALLOW_HOSTS`; projects cannot. Delivery has a ten-second DNS, connect and response deadline, five total attempts, one, two, four and eight-minute delays, durable leases and dead letters. Delivery IDs remain stable, and each attempt gets a fresh timestamp and signature. Receivers should return 2xx after durable acceptance. `hermitbox webhook create --kinds created,deleted`, `webhook ls`, `webhook rm ` and `webhook deadletters ` operate on the same scoped registrations. ## CLI subcommands `hermitbox sandbox` adds `ps`, `spawn`, `kill-all`, `wait-port`, `wait-log`, `wait-exit`, `shell` (interactive or `--command`), `exists`, `find`, `grep`, `replace`, `chmod`, `sync`, `git` and `keep-alive`, `ttl`, `idle`, `metrics` and `wait`. `exec`, `run` and `spawn` with `--stdin` read caller input once. Create flags include `--name`, `--labels`, `--metadata`, `--env`, `--workdir`, `--user`, `--auto-delete` and `--egress`, or `--spec` JSON. `sandbox ls` accepts `--name`, `--labels` and `--state`, and `events` accepts `--since` and `--follow`. Git uses `repo` by default; `clone --path` changes only that SDK handle. --- # Architecture `hermitboxd` runs sandboxes on each host and owns their local files. Control owns desired sandbox state, placement epochs and the Postgres ledger, and reaches hosts only through `hermitboxd`'s mutual-TLS API. ```mermaid flowchart LR Client -->|TLS / HTTP / TCP| Edge Client -->|Bearer key /v1| Control Edge -->|private /edge/v1| Control Control --> Postgres Control -->|mTLS| hermitboxd Edge -->|private allocated ports| Sandbox hermitboxd --> Sandbox hermitboxd -->|presigned transfers| S3 ``` Edge is the public entry point: it polls routes, reads TLS SNI or HTTP Host (or uses a dedicated TCP port), holds bytes while control wakes a sandbox, then relays them. Applications receive no platform greeting and need no application-specific integration. Make persists intent before asking a node, then places and boots (or provisions stopped). Sleep keeps data and tries to suspend process memory; without that node feature it stops. Wake resumes memory, boots from files, or restores a resting snapshot under a new epoch. Rest first captures/uploads a snapshot, then releases local compute/data. Snapshot and fork copy persistent files rather than memory. These verbs preserve state deliberately; delete removes data and snapshots too. | Tier | Retained resources | Wake | | --- | --- | --- | | Suspended | Memory, local disk, node reservation | Resume process memory | | Stopped | Local disk and placement | Boot image from files | | Resting | Object-store snapshot | Place, download, restore, boot | Prices come from operator/provider configuration, never product constants. Suspension still uses memory; stopped sandboxes still use local disk; resting copies use store space and transfer requests. XFS reflink shares unchanged blocks; other filesystems make a full copy. ## Isolation tiers - **Container** fixes capabilities, filesystem mounts, network rules and allowed image prefixes through host policy. - **Process** uses the bundled userland, Landlock, seccomp, rlimits and sampled resident memory without creating namespaces; its weaker boundary is described in [process-tier.md](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md). - **Wasm** uses a virtual kernel with WebAssembly and V8 in a shared unprivileged sidecar; SQLite and the explicit data mount survive recreation, while processes and terminals end on sleep. Its limits and API mapping are in [agentos.md](https://docs.hermitbox.dev/v0.2.1/integrations/agentos.md). - **VM** boots each sandbox in a Firecracker virtual machine with its own kernel. A node announces it only where KVM works for `hermitboxd`'s ordinary user and a signed installation supplies its bundle; a root node serves it only through the separate VM worker service ([vm.md](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md)). [tiers.md](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) compares the tiers. Placement enforces the requested isolation tier. A sandbox request cannot loosen host policy. Workload ports are private; only configured control/edge sources can dial them. ## Epochs and failures An epoch names one placement. Every mutating node request carries `blocklyd-epoch`; older handles cannot affect a newer copy. Moves fence and retire the old copy, and the edge closes connections from older epochs. The control execution lease permits autonomous restart only while current; its expiry does not stop an already running sandbox. Operator-confirmed loss remains necessary for failover when the optional store lease is off. | Failure | Hermitbox behavior | Caller sees | | --- | --- | --- | | Daemon crash | Containers continue; the owned wasm worker stops, retaining files for a fresh control ensure | Operations wait/fail; data stays | | Docker restart | live-restore keeps containers; otherwise report stopped/crashed | Unavailable operations until recovery | | Host reboot | Resume only after control authorizes | Temporary interruption | | Host loss / partition | No timer creates another running copy | Unknown/unavailable; operator fences before rebuild | | Control / Postgres outage | Running sandboxes continue; no new decisions | API operations fail or wait | | S3 outage | Keep local data/copies; rest/rebuild waits | Operation unavailable, local copy retained | | Disk floor | Refuse writes/creates needing room | insufficient_disk; running work remains | | Lost exec reply | Keep durable uncertain request identity | operation_unknown; inspect before new key | | Edge route change | Apply incrementally; close stale epoch connections | Reconnect to current copy | | Edge dies | Sessions age out; other edges continue | Connections through that edge close | | TTL expires | Access refuses immediately; upkeep deletes | gone | The node protocol keeps its original v1 wire/on-disk names. Rust generates node OpenAPI; Zod generates public and edge contracts; clients and documentation are checked for drift. Control's durable create identity survives retries, while uncertain execs are never replayed blindly. Secrets are excluded from views/events and node digests, and API keys are hash-only. See [protocol.md](https://docs.hermitbox.dev/v0.2.1/reference/protocol.md) for exact node semantics, [operations.md](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for recovery and [edge.md](https://docs.hermitbox.dev/v0.2.1/reference/edge.md) for measured client wait bounds. --- # Kernel network policy for process sandboxes # Kernel network policy for process sandboxes A process sandbox shares its host's network stack. Where the host lets `hermitboxd` attach eBPF programs to a cgroup of its own, each process sandbox gets its own cgroup and a small set of programs that decide every destination it dials in the kernel, so it gets the egress policy a container gets with the host firewall loaded. Where the host can't give it, the guarantee is off and the process tier is exactly what [process-tier.md](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md) describes. ## Where it is on `hermitboxd probe --json` and `hermitbox doctor` report the `kernel-network-policy` capability. It is proved, not read: `hermitboxd` makes a disposable child of its own cgroup v2 directory, loads every program (the kernel's verifier is the safety proof), attaches each, starts a process into the cgroup, then removes everything. It is on for: | Host | Cgroup | Pins | | --- | --- | --- | | `hermitboxd` as root, the server preset's `hermitboxd.service` included | a child of `hermitboxd`'s own cgroup | `/sys/fs/bpf/hermitbox` | | an ordinary user with CAP_BPF and CAP_NET_ADMIN and a delegated cgroup (systemd `Delegate=yes`) | a child of the delegated cgroup | a `hermitbox` directory it owns on a BPF filesystem | It is off, with the reason and what would turn it on, in any of these cases: - Without cgroup v2. - Without a writable cgroup (a default `docker run`, an undelegated user service). - Without `CAP_BPF` and `CAP_NET_ADMIN` (any ordinary user they weren't granted to). - Without a BPF filesystem `hermitboxd` can write. - Without a netlink socket to hear of the host's address changes (a unit whose `RestrictAddressFamilies` leaves out `AF_NETLINK`). - Without readable host address tables in `/proc/net`. - Where the kernel's verifier refuses a program, with the verifier's words. Nothing is approximated where it is off. The root unit that the server and node presets install (`deploy/hermitboxd.service`) grants what it needs and no more: CAP_BPF and CAP_NET_ADMIN, with CAP_SETUID and CAP_SETGID for the process tier's uid pool, netlink sockets for the address watch below, `Delegate=yes`, and of `/sys` only its own cgroup subtree and `/sys/fs/bpf/hermitbox` writable. Process sandboxes live in cgroups below the unit's, so they stop when `hermitboxd`'s unit stops, as VMs do with the VM worker; containers keep running. `hermitboxd` logs the proof at each start (`kernel network policy`, with `on` and its evidence). The server preset's own control plane requires private-network, private-pids, memory-limit and cpu-limit of every sandbox. Under this unit the process tier gives memory-limit and cpu-limit ([process-tier.md](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md#limits)) and, in the namespaced mode, private-pids: the unit allows exactly the user, mount, PID, IPC and network namespaces its helper takes, and keeps nothing mounted over `/proc`, since the kernel mounts a sandbox's own `/proc` in a user namespace only where none is (ProtectKernelTunables, ProtectKernelLogs and ProtectHostname are off; `/sys` is read-only by ReadOnlyPaths, and syslog(2), sethostname(2) and setdomainname(2) are refused by SystemCallFilter instead). It doesn't give private-network to an Internet-enabled process sandbox, which shares the host's network stack, so the preset places none there; a control plane a node joins that places process sandboxes gets them policed and limited. As root, granting it to a user means: the capabilities on its service (`AmbientCapabilities=CAP_BPF CAP_NET_ADMIN`), `Delegate=yes`, and `install -d -o /sys/fs/bpf/hermitbox` with `chmod o+x /sys/fs/bpf`. `hermitboxd` clears its ambient capabilities for every supervisor it starts, so a sandbox never holds them. ## What a sandbox gets The same specification as a container's network decides: | Specification | Reaches | | --- | --- | | `network: internet` (public internet on) | Every destination but this host, link-local (169.254.0.0/16, fe80::/10, where clouds serve metadata), AWS's IPv6 metadata address (`fd00:ec2::254`, though the rest of fc00::/7 stays private, its resolver `fd00:ec2::253` included), multicast, broadcast, and private addresses on the ports `hermitboxd` serves and its API's. DNS reaches the resolvers `/etc/resolv.conf` names. | | `egress: {allow, deny}` (public internet off, hostname policy) | Only the named hosts, through gateways `hermitboxd` serves for that sandbox: TCP 80 and 443 and DNS on 53, from any address, are redirected to them; nothing else leaves. A gateway dials a name only when every address it resolves to is public, none is local to this host as the kernel routes it at that moment, and none is one the sandbox's `egressAddresses.deny` refuses on that port. | | `egressAddresses: {allow, deny}` | Allow adds exactly the prefixes and ports named; deny takes them away. Deny wins. | | `network: none` | Nothing, as before; the programs refuse it too. | Always, whatever the specification: a host address (loopback, any address of this host) reaches only a socket the sandbox itself made, so its own `localhost` works and another sandbox's ports, the host's services, its agent's neighbours and `hermitboxd`'s API don't; a request's allow rule can't name loopback, link-local, multicast or the unspecified ranges. A host address's NAT64 twin (`64:ff9b::` and the IPv4 address) is refused, since a translator off the host can send it back here, and so is every prefix this host's routes broadcast to (a subnet's last address, loopback's `127.255.255.255`): a datagram sent there reaches this host's own UDP sockets too, from the link. This host's addresses and broadcast prefixes are read when a sandbox's programs are attached, and again each time the kernel says an address was added or removed (rtnetlink's IPv4 and IPv6 address groups, and its IPv4 route group, since both are read from the local routing table the kernel updates right after it tells of the address). `hermitboxd` is woken by that message and at once compiles and writes every live sandbox's rules again, new ones in before old ones out, so no lookup misses. The packet egress hook independently checks the current kernel route: a host-local destination uses the loopback device, including an address newly added that the watcher has not processed. There it permits a datagram, or the SYN that opens a connection, only to the sandbox's own destination sockets, its exact gateway listeners or configured DNS resolvers on their DNS port; an explicit deny still wins for a sandbox destination. The SYN is looked up with its whole four-tuple, so a reuse-port group another owner shares with the sandbox (as processes of one user can) can't hand the connection to that owner. A SYN that meets TIME-WAIT goes to the listener the kernel picks with its source, which a lookup can't reach past the TIME-WAIT socket, so the hook looks it up without the source: that finds the same listener or another member of its reuse-port group. A gateway listener is in no group, and when the sandbox runs as a UID of its own (`hermitboxd` as root, the process UID pool) a group with its listener holds only its sockets, so either is let through. Under a shared UID (`hermitboxd` as an ordinary user) the owner of the member the SYN reaches can't be proved, and the SYN is refused: a reconnect from the same port to the sandbox's own listener waits for TIME-WAIT to end, or picks another port. A connection's later segments go to the peer its SYN reached. Every active TCP connect marks its socket, including one reused after accepting and disconnecting, so a new dial cannot take the accepted-response allowance. Off this host the hook holds every packet but a reply on an accepted TCP connection to the destination its header names, which IPv4 source-route options and IPv6 routing headers can make other than the address the connect hook saw: it must be one the sandbox can dial, allowed or a configured resolver, and never this host's own. The hook reads IP and TCP/UDP headers, including up to eight ordinary IPv6 Hop-by-Hop, Routing or Destination Options headers; malformed, fragment and longer chains fail closed, and so does an encrypted one on loopback. Off the host an IPsec packet passes as before: the host's own policy sealed it after the address hooks ran, and no sandbox socket can. Process sandboxes can't attach a program to a reuse-port group (the agent's seccomp filter refuses `SO_ATTACH_REUSEPORT_CBPF` and `_EBPF`), since such a program, not the hash these lookups follow, would pick the group's member. HTTP and TLS gateways also check their connected upstream's peer and current route before writing any request bytes. When the host's address tables can't be read or a sandbox's new rules can't be written, `hermitboxd` freezes (`cgroup.freeze`) and kills that sandbox's cgroup, keeping its programs attached until every member has exited. That fenced program set never becomes verified again: another start removes the old empty cgroup and attaches a fresh set. A missing IPv6 address table is accepted only when an IPv6 socket proves that the host has no such address family. `hermitboxd` needs a netlink socket for the address watch, and is off without one, with that reason. Sockets other than TCP and UDP over IPv4 and IPv6 (raw, ICMP echo, SCTP, UDP-Lite, MPTCP) are refused at `socket()`. From off this host a sandbox is reached as a container is: on the ports `hermitboxd` published for it (its agent's and its spares, where the edge dials it) and nowhere else, so a server it binds to `0.0.0.0` is reached from this host and through the edge, never directly from another machine. What arrives from another machine is let in only for TCP to a published port, for a TCP connection the sandbox dialled off the host (its answers; a socket that dialled and then listened gets none), or for a UDP socket from a peer, address and port, that socket itself was allowed to send to; the rest is dropped, so the other machine's connection times out. Each sandbox keeps its 4096 most recent datagram peers (about 360 KiB of kernel memory); an older peer's datagrams are dropped until the socket sends to it again. An IPv6 datagram behind extension headers is dropped too, since the program reads only the fixed IP and UDP headers. A sandbox's view reports `host-firewall: true` once its own programs are attached and verified; a node announces `host-firewall`, `egress-hostnames` and `egress-addresses` for the process tier only where the probe proved them. While any process sandbox runs without verified programs (one started before its host had the capability, which a restart of `hermitboxd` leaves running, or one whose rules no longer fit the host's addresses), `host-firewall` is off for the whole tier, on the node and in every process sandbox's view, with how many in `kernel-network-policy`'s evidence: such a sandbox reaches the others' listeners over loopback. A normal stop restores the guarantee only after the trusted supervisor closes command admission, joins its native-tool worker, shuts down its runtime, kills and reaps every remaining descendant, and signs a fresh retirement challenge. This includes detached sessions and children whose exit signal is not SIGCHLD. A dedicated UID can instead prove cleanup through a complete, unfiltered process scan; unreadable or ambiguous process visibility cannot prove that nothing remains. An unexpectedly lost legacy supervisor can leave descendants that its shared UID no longer identifies. That uncertainty keeps the tier guarantee off for the rest of the current boot, even after its sandbox record is removed or `hermitboxd` restarts. An older process state directory without the new history-origin record is treated the same way, because earlier versions could already have deleted such a sandbox's record. A changed, verified kernel boot identity clears that history. Without a boot identity the uncertainty remains. A request for hostname or address policy on a host without the capability is refused with `kernel-network-policy` named; a placement that requires `host-firewall` is refused naming it. Before every fork, including plain mode without BPF, `hermitboxd` saves a boot-scoped launch intent. If it crashes before saving the PID, that intent retains the possible generation's ownership; only a record with no launch intent qualifies as never started. Live observation waits through the intent, synchronous fork and PID checkpoint, so it cannot retire a launch in progress. An incomplete plain-mode intent cannot use an empty dedicated UID as retirement proof: its child might still be paused before dropping to that UID. The actual PID checkpoint ends that pending phase; a proven new boot also retires it. ## How the programs work One object (`bpf/network.bpf.c`, built by `bpf/build.sh` and embedded in `hermitboxd`), nine programs, each with one job, and six maps (rules, config, owners, sockets, peers and counters): | Program | Hook | Job | | --- | --- | --- | | `connect4`, `connect6` | `cgroup/connect4`, `connect6` | Allow, refuse (EPERM) or redirect a TCP or UDP connect | | `sendmsg4`, `sendmsg6` | `cgroup/sendmsg4`, `sendmsg6` | The same for an unconnected datagram's address | | `recvmsg4`, `recvmsg6` | `cgroup/recvmsg4`, `recvmsg6` | Put back the resolver's address on a redirected DNS answer | | `sock_create` | `cgroup/sock_create` | Refuse non-TCP/UDP sockets; mark the rest as the sandbox's | | `ingress` | `cgroup_skb/ingress` | Drop what arrives from off the host but answers (TCP connections dialled, UDP peers sent to) and published ports; count | | `egress` | `cgroup_skb/egress` | Check where each datagram and SYN lands on this host, and what leaves it; count packets and bytes | `hermitboxd` compiles the policy into an LPM trie of IPv6 prefixes (IPv4 as `::ffff:a.b.c.d`, NAT64's `64:ff9b::/96` taking the rules of the address it embeds). Each prefix carries its own port ranges and those of every wider prefix, in the order they apply, and a fallback, so a program does one lookup and takes the first matching range. A verdict is allow, deny, a configured resolver, *owned* (a host address: allowed only when `bpf_sk_lookup` finds a listener the sandbox's socket-storage map holds) or a gateway (the destination is rewritten to the sandbox's gateway, after checking that `hermitboxd`'s listener is there). The packet hook reads only network and transport headers, never payloads. The ownership-only socket map uses the kernel's `BPF_F_CLONE`, so an accepted destination retains its listener's exact sandbox or gateway ownership. Direction and redirected-DNS state live in a separate, non-cloned map: a listener's earlier dial never marks a new accepted socket as an initiated connection. A stale public rule can therefore still reach an owned wildcard listener on a newly local address, including its established connection's payload, while a host listener remains refused. Programs are attached through cgroup BPF links and pinned, with their maps, under `/hermitbox//`, where `` names the sandbox within one state directory. A restarted `hermitboxd` first requires its private record's complete object SHA-256 to match the embedded object, then finds the pins, checks each link is the one it attached, writes the rules again and serves new gateways. A failed host proof, address watch or adoption stops every supervisor with a recorded program set; it can't restart in plain mode while that proof is unavailable. Legacy supervisors without a record keep their existing mode with the tier guarantee off. When a sandbox's supervisor is gone, `hermitboxd` fences and kills whatever is left in its cgroup, waits for it to empty, removes the pins, which detaches the programs, and removes the cgroup. Missing or changed object identities require that retirement and a fresh start with current programs. The journal records the prepared policy before any fork can join it. A missing supervisor or an incomplete earlier record cannot prove cleanup: any unverified canonical cgroup, even empty or unreadable, keeps the tier's guarantee off until retirement removes it. Failed cleanup keeps the journal, so a later daemon cannot lose the cgroup's owner by deleting the record. ## Read the counters `GET /v1/workloads/{id}/stats` reports the sandbox's `networkRxBytes` and `networkTxBytes` from the `ingress` and `egress` programs, loopback traffic included. With `bpftool` as root, the map `map-counters` under the sandbox's pin directory holds five per-CPU `{packets, bytes}` slots: ingress, egress, refused destinations, refused sockets, refused ingress. ```sh # Dump the sandbox's packet and byte counters. bpftool map dump pinned /sys/fs/bpf/hermitbox//map-counters # Dump its compiled rules. bpftool map dump pinned /sys/fs/bpf/hermitbox//map-rules # Show one of its attached links. bpftool link show pinned /sys/fs/bpf/hermitbox//link-connect4 ``` ## Kernels The object needs cgroup BPF links (5.7), socket storage in `sock_create` programs and socket lookups in address hooks, all present on every kernel the process tier supports (Landlock ABI 3, 6.2 and later). It reads only UAPI context fields and carries BTF, so one build loads on every kernel. ## How this is tested CI loads the object on the oldest and newest hosted kernels in its matrix and fails if the verifier rejects a program. `bpf/rejected.bpf.o`, the same source built to end with a program the verifier refuses, goes to the probe: CI checks the guarantee is off with the verifier's words, nothing of the set stays attached, and a request for address policy is refused naming the capability. The kernel test deliberately keeps the old address map and requires the first and all ten repeated TCP and UDP attempts to reach no host listener, for IPv4, mapped IPv4 and IPv6, while owned IPv6 Destination Options traffic still works. --- # Capabilities Each row names a Hermitbox capability and links to the code or the document that implements it. Measurements are in [speed](https://docs.hermitbox.dev/v0.2.1/reference/speed.md), and [tiers](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) states each tier's limits. Hermitbox's local tools require the prepared images and the host policy in [native tools](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md). Hermitbox is **open source under AGPL-3.0-only**. What you embed or copy into your own project (the SDKs, the integrations, the GitHub Action and the stack templates) is Apache-2.0. | Capability | Hermitbox | | --- | --- | | Create from image | [yes, container and vm tiers](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/public-model.ts) | | Create from snapshot | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/public-model.ts) | | Create from warm template | [yes](https://docs.hermitbox.dev/v0.2.1/guides/templates-from-code.md) | | Templates from code | [yes, builder](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/template.ts) | | Run command | [yes, run](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | Stream output | [yes, stream](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | Background process | [yes, spawn](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | Process stdin | [yes, stdin](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | Signals | [yes, signals](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | PTY | [yes, PTY](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | Persistent shell sessions | [yes, shell](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/handles.ts) | | waitForPort | [yes, process readiness](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/agent/src/field_process.rs) | | Read files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | Write files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | List files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | Watch files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | Upload files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | Download files | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/files.ts) | | Find files | [yes, bounded native search](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/agent/src/file_search.rs) | | Grep file contents | [yes, bounded native search](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/agent/src/file_search.rs) | | Directory sync | [yes, incremental](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/local-files.ts) | | Git | [yes, native command wrapper](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/git.ts) | | Ports and preview URLs | [yes, token-protected agent previews](https://docs.hermitbox.dev/v0.2.1/reference/sandbox-agent.md) | | Raw tunnels | [yes, edge TCP/TLS fronts](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/edge/src/front.ts) | | Egress allowlist including DNS | [yes, container host policy](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/src/runtime/docker/egress.rs); [process sandboxes in the kernel where the host grants it](https://docs.hermitbox.dev/v0.2.1/reference/bpf.md) | | Internet off | [yes, tier-specific enforcement](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) | | Sleep with memory | [yes, suspension by tier](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) | | Sleep (disk kept) | [yes](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md) | | Auto-resume on request | [yes, edge hold and wake](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/edge-service.ts) | | Snapshot | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandboxes.ts) | | Fork | [yes, snapshot forks](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandboxes.ts) | | Move between owned hosts | [yes, fenced transfer](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/transfers.ts) | | TTL | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandbox-lifetime.ts) | | Idle timeout | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandbox-lifetime.ts) | | Keep alive | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandbox-lifetime.ts) | | Labels | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandboxes.ts) | | Metadata | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandboxes.ts) | | Lookup by name or metadata | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandboxes.ts) | | Metrics | [yes, bounded retained samples](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/sandbox-lifetime.ts) | | Lifecycle events | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/events.ts) | | Webhooks | [yes, signed and retried](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/control/src/webhooks.ts) | | Code interpreter with charts | [yes on containers and processes](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md) | | Desktop and computer use | [containers and namespace-capable processes, X11/noVNC](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md) | | SSH | [containers and namespace-capable processes, raw or HTTP edge wake](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md) | | Object-store bucket mounts | [yes, real FUSE with host opt-in](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md) | | Browser and CDP | [yes on containers and processes](https://docs.hermitbox.dev/v0.2.1/guides/browser-and-desktop.md) | | Per-sandbox MCP server | [yes](https://docs.hermitbox.dev/v0.2.1/reference/mcp.md) | | GitHub Action | [yes, repo action](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/action/action.yml) | | CLI | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/cli/src/main.ts) | | TypeScript SDK | [yes](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/typescript/src/index.ts) | | Python SDK | [yes, sync and async](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/sdk/python/src/hermitbox/__init__.py) | | Self-hosted deployment | [yes, owned Linux hosts](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) | | Runs without root | [process and Wasm tiers; vm where the user can open `/dev/kvm`](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md#what-a-host-needs) | | Projects and quotas | [yes](https://docs.hermitbox.dev/v0.2.1/reference/api.md#projects-and-limits) | | Machine providers and autoscale | [yes, owned-node adapters](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md) | | Source availability and licence | [AGPL-3.0-only](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/LICENSE.md); SDKs, integrations, GitHub Action and stack templates [Apache-2.0](https://github.com/hermitbox/hermitbox/blob/75b22d18abc93b8be54b6ae2324b97ed713be910/LICENSES/Apache-2.0.txt) | ## Guarantees by tier Each Hermitbox sandbox reports the [guarantees](https://docs.hermitbox.dev/v0.2.1/reference/host-capabilities.md) its tier gives on that host, and a create can `require` any of them. A guarantee a node doesn't announce is false. - `own-kernel`: vm only. - `memory-limit`: container when the engine enforces it, and vm (the guest's RAM). - `cpu-limit`: container when the engine enforces it, and vm (whole vCPUs). - `private-network`: container and vm. - `private-pids`: container and vm. - `separate-users`: process as root, when the credential-drop probe passes. - `host-firewall`: container, on a rootful engine with the host firewall loaded, and process where `kernel-network-policy` is on and the sandbox's own programs are attached ([bpf.md](https://docs.hermitbox.dev/v0.2.1/reference/bpf.md)). - `memory-sleep`: process, container on a rootful engine with memory limits, and an ordinary user's vm once its start test has restored a guest on that host. - `browser-sandbox`: container with the native-tools seccomp profile and user namespaces, and process when its browser probe passes. The vm tier runs only where KVM works: as an ordinary user, or as root through its separate worker service, which the server preset installs. Its guarantees, network policy and limits are in [vm.md](https://docs.hermitbox.dev/v0.2.1/guides/virtual-machines.md), with what is tested, and its thirty-sample measurements in [tiers.md](https://docs.hermitbox.dev/v0.2.1/reference/tiers.md#vm-tier-measurements). ## How this is tested Every implementation in the table is exercised by the unit, Docker or end-to-end CI suites. Process desktop and HTTP SSH are tested as an ordinary user on the signed installation, through both SDKs and the installed CLI. [Startup measurements](https://docs.hermitbox.dev/v0.2.1/reference/speed.md) give thirty samples per tool and the different resource guarantees of containers and processes. --- # 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. ```txt hermitbox [options] ``` To install it and run a first command, see [Connect the CLI](https://docs.hermitbox.dev/v0.2.1/get-started/cli.md). The HTTP API behind each command is in the [public API reference](https://docs.hermitbox.dev/v0.2.1/reference/api.md), which also summarizes the [CLI subcommands](https://docs.hermitbox.dev/v0.2.1/reference/api.md#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_URL` and `HERMITBOX_API_KEY`. Without them, they read the credentials `hermitbox up` saved in `~/.config/hermitbox/client.json`. See [Environment variables](#environment-variables). - Operator commands (`node`, `key`, `project` and `doctor --fleet`) need `HERMITBOX_OPERATOR_TOKEN`. - A `` is a number of seconds (`90`) or a number followed by `s`, `m`, `h` or `d` (`10m`, `2h`). - A `` 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 ` does the same. | | `--version` | Print the version. Only as the first argument. | ```sh hermitbox sandbox --help ``` ## Sandboxes ### `run` Create a sandbox, run one command in it, and delete it. ```txt hermitbox run [options] -- ``` | Option | Default | What it does | | --- | --- | --- | | `--isolation ` | The host chooses | `process`, `wasm`, `container`, `gvisor` or `vm` | | `--image ` | None | The image to start from. Needed for `container`, `gvisor` and `vm`. | | `--timeout ` | 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 ` | None | With `--snapshot`, also write the snapshot ID to this file (mode 600) | `run` also takes the request options of [`sandbox create`](#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. ```sh hermitbox run -- echo hello ``` ```sh hermitbox run --isolation vm --image alpine:3.22 -- uname -r ``` ### `sandbox create` Create a sandbox and print its record. ```txt hermitbox sandbox create [options] ``` | Option | Default | What it does | | --- | --- | --- | | `--image ` | None | The image to start from | | `--isolation ` | The host chooses | `process`, `wasm`, `container`, `gvisor` or `vm` | | `--name ` | None | A name unique in the project | | `--labels ` | None | Labels, as a JSON object of strings | | `--metadata ` | None | Metadata, as a JSON object | | `--env ` | None | Environment variables, as a JSON object | | `--workdir ` | None | An absolute working directory | | `--user ` | None | A numeric user ID | | `--ttl ` | None | End access after this long; the data is deleted after | | `--idle ` | 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 ` | 1 | Resource units to reserve | | `--network ` | `internet` | `internet` or `none` | | `--spare-ports ` | None | Edge ports to reserve for `sandbox expose` | | `--egress ` | None | Host rules, as `{"allow":[…],"deny":[…]}` | | `--package ` | None | A Wasm package to add. Repeat for more. Wasm tier only. | | `--stopped` | Off | Create the sandbox without starting it | | `--from-snapshot ` | None | Start from a snapshot. The other request options are ignored. | | `--spec ` | None | Read the whole request from a JSON file. The other request options are ignored. | | `--idempotency-key ` | A random UUID | Repeat a create safely with the same key | ```sh # Create a sandbox from an image and save its ID. SANDBOX_ID=$(hermitbox sandbox create --image alpine:3.22 | jq -r .id) ``` ```sh hermitbox sandbox create \ --name web \ --labels '{"team":"web"}' \ --idle 15m ``` ### `sandbox ls` List the project's sandboxes. `hermitbox sandbox` with no verb does the same. ```txt hermitbox sandbox ls [--name ] [--state ] [--labels ] ``` | Option | Default | What it does | | --- | --- | --- | | `--name ` | None | Only the sandbox with this name | | `--state ` | None | `creating`, `stopped`, `starting`, `running`, `sleeping`, `resting`, `restoring` or `failed` | | `--labels ` | None | Only sandboxes that carry all these labels | ```sh hermitbox sandbox ls --state running ``` ### `sandbox get` Print a sandbox's record without waking it. ```txt hermitbox sandbox get ``` ```sh hermitbox sandbox get "$SANDBOX_ID" ``` ### `sandbox exec` Run a command in a sandbox, stream its output, and exit with its exit status. ```txt hermitbox sandbox exec [options] -- ``` | Option | Default | What it does | | --- | --- | --- | | `--timeout ` | None | Stop the command after this long | | `--stdin` | Off | Send this shell's standard input to the command once | | `--idempotency-key ` | None | Run the command at most once for this key | ```sh hermitbox sandbox exec "$SANDBOX_ID" -- ls / ``` ```sh echo hello | hermitbox sandbox exec "$SANDBOX_ID" --stdin -- cat ``` ### Lifecycle verbs Change whether a sandbox runs, and how long it lives. Each prints the sandbox's record. ```txt hermitbox sandbox hermitbox sandbox hermitbox sandbox wait [--timeout ] hermitbox sandbox rm ``` | 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 | ```sh hermitbox sandbox sleep "$SANDBOX_ID" ``` ```sh hermitbox sandbox wait "$SANDBOX_ID" running --timeout 2m ``` ### `sandbox snapshot` Save a sandbox's files as a snapshot and print it. ```txt hermitbox sandbox snapshot ``` ```sh SNAPSHOT_ID=$(hermitbox sandbox snapshot "$SANDBOX_ID" | jq -r .id) ``` ### `sandbox fork` Start a new sandbox from a snapshot. ```txt hermitbox sandbox fork [--idempotency-key ] ``` `--idempotency-key` defaults to a random UUID. To snapshot and copy a sandbox in one step, use [`fork`](#fork). ```sh hermitbox sandbox fork "$SNAPSHOT_ID" ``` ### Processes Start, list, stop and wait for processes in a sandbox. ```txt hermitbox sandbox ps hermitbox sandbox spawn [--stdin] -- hermitbox sandbox kill-all hermitbox sandbox wait-port [--http] [--path ] [--timeout ] hermitbox sandbox wait-log [--timeout ] hermitbox sandbox wait-exit [--timeout ] ``` | 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. ```sh # 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 --http ``` ### Shells and terminals Work in a sandbox interactively. ```txt hermitbox sandbox terminal hermitbox sandbox shell [--cwd ] [--command ] hermitbox sandbox ssh [] hermitbox sandbox python [] [-c ] [--context ] ``` | 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](https://docs.hermitbox.dev/v0.2.1/guides/code-interpreter.md). ```sh hermitbox sandbox terminal "$SANDBOX_ID" ``` ```sh hermitbox sandbox python -c 'print(2 + 2)' ``` ### Files Copy, search and change files in a sandbox. ```txt hermitbox sandbox cp hermitbox sandbox sync hermitbox sandbox exists [] hermitbox sandbox find [] hermitbox sandbox grep [--paths ] hermitbox sandbox replace [--paths ] hermitbox sandbox chmod ``` | Verb | Default | What it does | | --- | --- | --- | | `cp` | | Copy a file or directory. One side is `:`, 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. ```sh # 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.txt ``` ### `sandbox git` Run Git in a sandbox. ```txt hermitbox sandbox git clone [--path ] [--branch ] [--depth ] [--token-env ] hermitbox sandbox git hermitbox sandbox git diff [--staged] hermitbox sandbox git branch [] hermitbox sandbox git checkout [--create] hermitbox sandbox git add hermitbox sandbox git commit [--author ] hermitbox sandbox git push [--token-env ] hermitbox sandbox git log [--limit ] ``` | Option | What it does | | --- | --- | | `--token-env ` | Read the Git token from this environment variable on your machine | | `--author ` | The commit's author, in `Name ` form | | `--create` | Create the branch before checking it out | | `--staged` | Show staged changes only | Git works in `repo` unless `clone --path` names another directory. ```sh hermitbox sandbox git "$SANDBOX_ID" clone https://git.example.com/team/app.git --depth 1 ``` ### Ports and network Publish a sandbox's ports and change its network. ```txt hermitbox sandbox expose hermitbox sandbox unexpose hermitbox sandbox endpoints hermitbox sandbox network hermitbox sandbox mcp-url ``` | 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 | ```sh hermitbox sandbox expose "$SANDBOX_ID" 8000 ``` ### Logs and measurements Read what a sandbox did, without waking it. ```txt hermitbox sandbox logs [--follow] [--since