# The sandbox agent `hermitbox-agent` runs as PID 1, as the image's user and within the sandbox's resource limits. The node mounts its static binary read-only; images need no installed shell or file utilities for agent operations. The original image entrypoint remains a supervised child. SDK-created sandboxes use the agent itself to stay alive. Control owns creation, placement, sleep, wake, network changes, snapshots and deletion. Running commands, processes, terminals, data and runtime port forwarding go directly through the edge to the agent. A Postgres regression counts actual queries: after token warmup, these SDK operations make zero control calls and zero SQL queries. Token renewal and lifecycle still contact control. The node announces `agent`, `files` and `network-policy` before control sends their new fields. Every supported node runs the agent. The v1 node wire retains its published endpoints. ## Capabilities and routing `POST /v1/sandboxes/{id}/token` requires the project's API key and returns a sandbox capability, expiry, epoch, public key and agent base URL. Capabilities expire within five minutes, are bound to one sandbox and epoch, and enforce project execution and spare-port limits. The node's private Ed25519 key stays in the container's private bootstrap environment; records, labels, responses and logs never contain it. Child process environments omit the bootstrap entry. The SDK caches its capability, renews it before expiry, and invalidates it on lifecycle refresh. HTTP uses `Authorization: Bearer TOKEN`. Websockets offer `hermitbox` and `hermitbox-token.TOKEN` as subprotocols; the negotiated subprotocol is `hermitbox`. TLS verification remains enabled. The edge verifies capabilities locally before wake. The only private API on `https://SANDBOX.PUBLIC_DOMAIN` is `/_hermitbox/`. A local one-box installation also accepts `http://localhost/sandboxes/SANDBOX/_hermitbox/`. Unexposed application ports return 404. Ready requests do not ask control for permission again. Route-only edge capabilities can list port assignments but cannot run commands or read data. ## HTTP and websocket API All paths below start with `/_hermitbox`. The committed Rust schema is [agent/openapi.json](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/openapi.json); node capabilities remain in the node schema. | Operation | Path | | --- | --- | | Start or list processes | `POST` or `GET /processes` | | Process metadata | `GET /processes/{id}` | | Wait for completion | `GET /processes/{id}/wait` | | Write or close stdin | `POST` or `DELETE /processes/{id}/stdin` | | Signal or resize | `POST /processes/{id}/signal` or `/resize` | | Output | `GET /processes/{id}/output` (NDJSON), `/ws` (websocket) | | Interactive PTY | websocket `/terminal` | | Read, write or delete data | `GET`, `PUT` or `DELETE /files/content?path=PATH` | | List or stat data | `GET /files/list?path=PATH`, `/files/stat?path=PATH` | | Create directory or move | `POST /files/mkdir`, `/files/move` | | Watch a directory | websocket `/files/watch?path=PATH` | | Transfer from or to an HTTP URL | `POST /files/upload`, `/files/download` | | Issue a short file URL | `POST /files/token` | | Expose or list ports | `POST` or `GET /ports` | | Unexpose | `DELETE /ports/{port}` | | Health | `GET /health` | Starting a process accepts `command` as an argv array or shell string, `env`, `cwd`, `stdin`, `pty`, `cols`, `rows` and an optional timeout in seconds. Supply `Idempotency-Key`; the SDK generates one. A reused key with a different body is refused. Requests never retry a mutation. Processes outlive disconnected clients. Completion waits for the actual process and output, including commands that close stdout and stderr early. Signals address the process group. Output events carry base64 byte chunks, followed by an exit result. Detached replay is bounded to 1 MiB; a slow subscriber has a bounded queue and is detached after backpressure times out. Results expose truncation. SDK collected output and line buffers are bounded; use `stream()` for large or indefinitely long output. PTYs provide a controlling terminal and support resize. Files stream without a total body-size cap; JSON requests are limited to 1 MiB. Paths are relative to persistent data, opened with descriptor-relative walks that refuse parent symlinks, special files and traversal. A watch first sends `ready`, then `change` messages; overflow is explicit. URL transfers accept only HTTP and HTTPS destinations without user information. They resolve the hostname before connecting, refuse every non-public answer (including loopback, private, link-local and multicast addresses), and pin connections to that first answer set. Redirects and transfer-client proxy overrides are disabled; HTTPS certificate and hostname verification remain enabled. This applies to container, process and Wasm agents. `files.url(path, 'GET' | 'PUT')` returns a capability URL bound to that path and method for at most one minute, and never beyond the parent token. Treat the URL as a credential until it expires. ## Ports, activity and network `sparePorts` reserves edge-only host bindings at creation, defaulting to three. Projects reserve their quota for these bindings up front. `expose(port)` assigns a spare and returns `https://SANDBOX-PORT.PUBLIC_DOMAIN`; no restart or spec update occurs. Exhaustion returns 409 `no_spare_port`. Unexpose closes existing forwards and frees the slot. Assignments survive agent restart in an atomic checkpoint. A target header checked by the agent prevents a stale hostname from reaching a reused slot; it is removed before the application sees the request. On the process tier, the agent also proves the connected application socket belongs to its supervisor tree before sending request bytes. Foreign sockets are refused even for the same UID. This proxy check does not isolate direct guest networking; Internet-enabled process workloads must be mutually trusted as described in [process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md). Activity stays in agent memory and is checkpointed once per second. Existing node heartbeats carry activity and assignments to control and edge polling. Idle upkeep honors recent activity and active streams; the sandbox's absolute TTL still applies. `network: 'none'` removes outbound connectivity while retaining private node and edge ingress. Rootful Docker and Podman use isolated internal bridges; supported rootless Docker uses a loopback-only namespace and the protected agent's private exec transport. Missing support is refused by name. `box.network('internet' | 'none')` changes the policy while retaining persistent data. It replaces compute, so running processes and terminals end. The SDK invalidates the old capability. Hostname policy is described below. The node's file feature supplies read, write, list and stat while compute is stopped or sleeping. The SDK selects that path automatically. Interactive operations use the agent and may wake a sleeping sandbox. MCP uses the same capability boundary. ## Validation and measurements Public exec and logs forward through the edge to the agent. Entrypoint output is replayed from a bounded persistent logbook; a slow live reader receives an explicit gap. Private activity, port and log checkpoints are hidden from normal listings and watch events. Stopped file writes use the sandbox's configured owner, so the agent can update them after start. The supervisor disables process dumps and same-user proc inspection before loading its private material. Signing keys live outside sandbox data under the node state directory, mode 0600, and survive compute replacement within the same epoch. A placement change uses a new key. The fleet join script installs the trusted agent before starting the node. Control serves its installed agent from the Rust-owned default path, or HERMITBOX_AGENT_BIN when configured. For the HTTPS sandbox hostnames, configure HERMITBOX_EDGE_AGENT_TLS_CERT and HERMITBOX_EDGE_AGENT_TLS_KEY with paths to a trusted wildcard certificate and its private key. The edge terminates TLS only for agent and exposed-port hostnames; ordinary TLS routes remain pass-through. A platform TLS terminator can instead forward to the HTTP front. Localhost SDK URLs use the HTTP alias. TLS verification is never disabled. Health reads wait for the agent after wake before a user mutation is forwarded. Rust tests execute real local processes, PTYs, websocket streams, notifications, safe file walks, file capabilities and spare-slot reuse. The Docker acceptance suite exercises the TypeScript, synchronous Python and asynchronous Python handles through a real node and edge in CI. [speed.md](https://docs.hermitbox.dev/v0.2.0/speed.md) records measured cohorts and their limits. ## Field API version 2 Process agents may additionally report `processIpcScoped: true` after installing their own Landlock abstract-socket scope. The field is absent otherwise, including legacy agents. It describes an enforced IPC primitive, not native-tool availability or isolation from unscoped legacy peers; `toolsVersion` and `kernelsVersion` remain API versions. Authenticated health announces `apiVersion: 2`. SDKs check it before every new route family, cache that answer per capability and invalidate it after lifecycle changes. New routes are: | Operation | Path | | --- | --- | | Readiness: kind port/log/exit, timeout seconds | `POST /processes/{id}/ready` | | Kill every running owned process | `POST /processes/kill-all` | | Open a cwd/env shell session | `POST /shells` | | Run a command with timeout | `POST /shells/{id}/run` | | Close the shell | `DELETE /shells/{id}` | | Glob find, regex grep/replace, chmod | `POST /files/find`, `/grep`, `/replace`, `/chmod` | | Stream a directory tar | `GET` or `PUT /files/archive?path=PATH` | Readiness never selects an outside address. Process listeners must belong to the supervisor; VM probes use that VM network. Log waits search bytes per stream, including split UTF-8, with a 1 MiB capture bound. Timeout and early exit have distinct structured codes. One-shot SDK stdin writes bounded chunks then closes once; partial delivery is an uncertain mutation. Shells use one pipe-driven read/eval process, serialize commands, encode each frame and capture independent random stdout/stderr sentinels. This preserves cwd, env, functions, exact exit codes and separate streams. There are at most 32 sessions; output is bounded to 1 MiB per stream. A timeout or framing failure closes the session. Intentional exit returns its real code. Searches refuse links/special files, scan at most 100,000 entries and 64 MiB total, with 1 MiB per text file and response. Regexes have a linear-time engine and a 1 MiB compile bound. Replace treats replacement text literally and retains ordinary file modes. Tar transfers preserve files and empty directories, refuse links/devices/traversal and special permission bits, cap packed and expanded bytes at 256 MiB and entries at 100,000. Two archive slots bound anonymous on-disk spools; download retains its slot until the body ends. Blocking file work is tracked and drained before VM stop/snapshot. Local SDK disk walks also hold no-follow parent descriptors. Sync hashes content and upserts changes; it never deletes remote data. Git tokens stay in the one-call process environment and a host-scoped helper, never a URL or credential file. Hooks, global/system config, redirects and trace environment settings are disabled for helper calls; results redact the token and refuse incomplete parsed stdout. On wasm, a transient loopback bridge adapts Git HTTP to the VM fetch stack, retains the original HTTPS remote and terminates after the call. VM network policy and upstream TLS remain in force. Container hostname egress is enforced by the host bridge. Process sandboxes take it where their node announces kernel network policy ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)); wasm refuses it explicitly. Wasm Git clones keep their object database in the VM’s persistent guest filesystem via Git’s separate-git-dir option; checkout files stay in persistent data. This avoids the host mount’s read-only object-write limitation without relaxing permissions. Both are retained by stop and snapshot. Git network helpers have a five-minute default and per-call timeout overrides and disable automatic background maintenance/GC. Virtual Git HTTP request bodies are bounded by the 16 MiB guest frame limit. --- # agentOS on Hermitbox The `wasm` backend runs one agentOS VM per sandbox. hermitboxd owns the VMs through the published Rust client and a separate native sidecar. Control retains placement, projects, units, epochs, leases and lifecycle; clients use the same authenticated agent API and edge routes. 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.0/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 may 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 may configure the upstream client's HTTPS registry mirror. No package mutation is retried automatically. ## Running 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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 python3 scripts/fetch-agentos.py /tmp/hermitbox-agentos-test 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. --- # Use Hermitbox with your agent `hermitbox mcp` is an MCP server over stdio. After `curl -fsSL https://hbx.sh | sh`, it reads the credentials the installer saved, so no key goes in any agent's config. The ordinary-user install puts the CLI in `~/.local/bin/hermitbox`; a root install puts it in `/usr/local/bin/hermitbox`. Agents started from a desktop may not have either on `PATH`, so each step names the full path. ## 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. ``` ## 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 one-click Claude Desktop extension is not published yet; in Claude Desktop, give Claude the prompt above. ## 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"] } ``` ## 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. ## Codex ```sh codex mcp add hermitbox -- ~/.local/bin/hermitbox mcp ``` It lands in `~/.codex/config.toml` as `[mcp_servers.hermitbox]`. ## ChatGPT ChatGPT on the web connects to a public MCP endpoint over HTTPS. Hermitbox's MCP server listens only on this machine ([MCP](https://docs.hermitbox.dev/v0.2.0/mcp.md)), so there is nothing for ChatGPT to add yet. Give the prompt to an agent that runs on your machine, or use Codex. ## What the server offers [MCP](https://docs.hermitbox.dev/v0.2.0/mcp.md) lists the tools, the loopback HTTP transport and their limits. Host admission enforces [tier limits](https://docs.hermitbox.dev/v0.2.0/tiers.md); an agent cannot grant a capability the host lacks. --- # Public API Authenticate with `Authorization: Bearer `. Create, list and revoke keys with `hermitbox key` on the private operator listener. The project is chosen by the key. See control/README.md for configuration and sdk/typescript/README.md or sdk/python/README.md for examples. | Method | Endpoint | Request schema | Success | | --- | --- | --- | --- | | GET | /v1/sandboxes/{id}/why | — | 200 | | GET | /v1/audit | — | 200 | | GET | /v1/project | — | 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 | | 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 | | POST | /v1/sandboxes | MakeRequest | 201 | | GET | /v1/sandboxes | — | 200 | | POST | /v1/sandboxes/{id}/lifetime | LifetimeRequest | 200 | | GET | /v1/sandboxes/{id}/metrics | — | 200 | | POST | /v1/templates/{name}/versions | TemplateVersionRequest | 201 | | GET | /v1/templates/{name}/versions | — | 200 | | POST | /v1/webhooks | WebhookRequest | 201 | | GET | /v1/webhooks | — | 200 | | DELETE | /v1/webhooks/{id} | — | 200 | | GET | /v1/webhooks/{id}/deadletters | — | 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 | | POST | /v1/sandboxes/{id}/exec | ExecRequest | 200 | | GET | /v1/sandboxes/{id}/logs | — | 200 | | PUT | /v1/sandboxes/{id}/files/{path} | — | 200 | | GET | /v1/sandboxes/{id}/files/{path} | — | 200 | | POST | /v1/sandboxes/{id}/snapshots | — | 201 | | GET | /v1/sandboxes/{id}/snapshots | — | 200 | | PUT | /v1/sandboxes/{id}/file-chunks/{path} | — | 200 | | GET | /v1/sandboxes/{id}/file-chunks/{path} | — | 200 | | DELETE | /v1/sandboxes/{id}/snapshots/{snapshot} | — | 200 | | POST | /v1/snapshots/{snapshot}/sandboxes | MakeRequest | 201 | | GET | /v1/sandboxes/{id}/endpoints | — | 200 | | GET | /v1/sandboxes/{id}/events | — | 200 | | POST | /v1/templates | TemplateRequest | 201 | | GET | /v1/templates | — | 200 | Requests and responses are defined in [the OpenAPI document](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/openapi/hermitbox.openapi.json). Exec and logs use application/x-ndjson; exec forwards live agent stdout/stderr chunks, a final exit event, and an error event for a failure after headers. File writes take JSON dataBase64; 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/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/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.0/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; GET/PATCH/DELETE /{id} views, changes or deletes one. POST /{id}/freeze stops its sandboxes and refuses public writes; /unfreeze permits new work without restarting them. GET /{id}/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; `hermitbox key create --project ` prints a key once. Project ls/get/set/freeze/unfreeze/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/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; they never let a retry exceed 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; 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/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 require 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.0/tiers.md); [agentos.md](https://docs.hermitbox.dev/v0.2.0/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/task or sync result, stream iterates output with lines/result. Each command receives one idempotency key; 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. Concurrent writers must be serialized by callers; 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, project-unique name, metadata as a JSON object, absolute workdir, numeric user, idle and autoDelete. The requested user must equal the operator container UID policy; process/wasm refuse user selection. autoDelete requires idle and deletes after idle instead of retaining compute/data. GET sandboxes filters by name, label subset and state. Names remain reserved until deletion. SDK id/name lookup wakes sleeping/resting data unless wake:false. 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 ID and accepts --since and --once. History persists for the lifetime of the sandbox. Unavailable counters are null. SDK waitUntil polls public state; events uses NDJSON with stream=true, optional since timestamp and follow=true. Plain v1 events still returns its published JSON shape. The SDK process handle adds waitForPort (HTTP or TCP, path/status/timeout), waitForLog, waitForExit and logs. A deadline is wait_timeout; exit before readiness is process_exited. run/spawn accept one-shot stdin text or bytes. Sandbox processes and killAll inspect/stop owned processes. shell opens a serialized stateful pipe session with separate stderr and exact exit codes; close ends it. See agent.md for all versioned routes and budgets. Files add exists, find glob, grep and literal replacement at regex matches, chmod, caller-disk upload/download with onProgress, tar uploadDir/downloadDir and SHA-256 upsert sync. CLI cp uses these methods. Git clone/status/diff/branch/checkout/add/commit/push/pull/log return parsed values with raw output. Clone supports path/branch/depth/token; commit supports author, diff supports staged, log supports limit. Tokens use an HTTPS host-scoped one-call credential helper, never a persisted credential file. Git clone/push/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. hermitbox.template builds from image/isolation with copy pairs, env/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 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; template build -f hermitbox.template.ts imports its default plan. Container egress:{allow:[hosts],deny:[hosts]} requires the announced egress-hostnames node feature and root-installed firewall. Deny overrides allow; a wildcard matches only subdomains. The bridge redirects HTTP/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.0/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 may not 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 /{id} removes, GET /{id}/deadletters inspects exhausted delivery. Kinds are created, running, sleeping, woken, resting, deleted, failed, ttl_expired and idle_slept. Creation returns secret once; listing never does. 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/Host, verifies TLS and never follows redirects. An operator may explicitly allow an owned private receiver with HERMITBOX_WEBHOOK_ALLOW_HOSTS; projects cannot. Delivery has a ten-second DNS/connect/response deadline, five total attempts, one/two/four/eight-minute delays, durable leases and dead letters. Delivery IDs remain stable and each attempt gets a fresh timestamp/signature. Receivers should return 2xx after durable acceptance. CLI webhook create URL --kinds created,deleted, webhook ls, webhook rm ID and webhook deadletters ID operate on the same scoped registrations. CLI 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/wait. exec/run/spawn --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/--state and events accepts --since/--follow. Git uses repo by default; clone --path changes only that SDK handle. --- # Architecture hermitboxd runs containers, restricted native process trees or agentOS WebAssembly VMs 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. 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. ```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 ``` 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 may require a full copy. The container tier fixes capabilities, filesystem mounts, network rules and allowed image prefixes through host policy. The process tier 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.0/process-tier.md). The wasm tier 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.0/agentos.md). The vm tier 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.0/vm.md)). [tiers.md](https://docs.hermitbox.dev/v0.2.0/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 may dial them. 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.0/protocol.md) for exact node semantics, [operations.md](https://docs.hermitbox.dev/v0.2.0/operations.md) for recovery and [edge.md](https://docs.hermitbox.dev/v0.2.0/edge.md) for measured client wait bounds. --- # 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.0/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, 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`, or 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.0/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 just 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 just 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 may) 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 may 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. 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. 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 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 may 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. ## Reading 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 bpftool map dump pinned /sys/fs/bpf/hermitbox//map-counters bpftool map dump pinned /sys/fs/bpf/hermitbox//map-rules 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; CI loads it 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 with `PRYX_REJECTED`, has a last program the verifier refuses: CI hands it to the probe and 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. --- # Capabilities Each row links to the code or the document that implements it, and every implementation is exercised by the existing unit, Docker or end-to-end CI suites; measurements are in [speed](https://docs.hermitbox.dev/v0.2.0/speed.md). hermitbox's local tools require the prepared images and the host policy in [native tools](https://docs.hermitbox.dev/v0.2.0/native-tools.md); [tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md) states their limits. 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/public-model.ts) | | Create from snapshot | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/public-model.ts) | | Create from warm template | [yes](https://docs.hermitbox.dev/v0.2.0/templates.md) | | Templates from code | [yes, builder](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/template.ts) | | Run command | [yes, run](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | Stream output | [yes, stream](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | Background process | [yes, spawn](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | Process stdin | [yes, stdin](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | Signals | [yes, signals](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | PTY | [yes, PTY](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | Persistent shell sessions | [yes, shell](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/handles.ts) | | waitForPort | [yes, process readiness](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/field_process.rs) | | Read files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | Write files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | List files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | Watch files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | Upload files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | Download files | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/files.ts) | | Find files | [yes, bounded native search](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/file_search.rs) | | Grep file contents | [yes, bounded native search](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/file_search.rs) | | Directory sync | [yes, incremental](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/local-files.ts) | | Git | [yes, native command wrapper](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/git.ts) | | Ports and preview URLs | [yes, token-protected agent previews](https://docs.hermitbox.dev/v0.2.0/agent.md) | | Raw tunnels | [yes, edge TCP/TLS fronts](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/edge/src/front.ts) | | Egress allowlist including DNS | [yes, container host policy](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/docker/egress.rs); [process sandboxes in the kernel where the host grants it](https://docs.hermitbox.dev/v0.2.0/bpf.md) | | Internet off | [yes, tier-specific enforcement](https://docs.hermitbox.dev/v0.2.0/tiers.md) | | Sleep with memory | [yes, suspension by tier](https://docs.hermitbox.dev/v0.2.0/tiers.md) | | Pause | [yes](https://docs.hermitbox.dev/v0.2.0/tiers.md) | | Auto-resume on request | [yes, edge hold and wake](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/edge-service.ts) | | Snapshot | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts) | | Fork | [yes, snapshot forks](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts) | | Move between owned hosts | [yes, fenced transfer](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/transfers.ts) | | TTL | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandbox-lifetime.ts) | | Idle timeout | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandbox-lifetime.ts) | | Keep alive | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandbox-lifetime.ts) | | Labels | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts) | | Metadata | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts) | | Lookup by name or metadata | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts) | | Metrics | [yes, bounded retained samples](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandbox-lifetime.ts) | | Lifecycle events | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/events.ts) | | Webhooks | [yes, signed and retried](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/webhooks.ts) | | Code interpreter with charts | [yes on containers and processes](https://docs.hermitbox.dev/v0.2.0/interpreter.md) | | Desktop and computer use | [containers and namespace-capable processes, X11/noVNC](https://docs.hermitbox.dev/v0.2.0/native-tools.md) | | SSH | [containers and namespace-capable processes, raw or HTTP edge wake](https://docs.hermitbox.dev/v0.2.0/native-tools.md) | | Object-store bucket mounts | [yes, real FUSE with host opt-in](https://docs.hermitbox.dev/v0.2.0/native-tools.md) | | Browser and CDP | [yes on containers and processes](https://docs.hermitbox.dev/v0.2.0/native-tools.md) | | Per-sandbox MCP server | [yes](https://docs.hermitbox.dev/v0.2.0/mcp.md) | | GitHub Action | [yes, repo action](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/action/action.yml) | | CLI | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/cli/src/main.ts) | | TypeScript SDK | [yes](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/typescript/src/index.ts) | | Python SDK | [yes, sync and async](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/sdk/python/src/hermitbox/__init__.py) | | Self-hosted deployment | [yes, owned Linux hosts](https://docs.hermitbox.dev/v0.2.0/operations.md) | | Runs without root | [process and Wasm tiers; vm where the user can open `/dev/kvm`](https://docs.hermitbox.dev/v0.2.0/vm.md#what-a-host-needs) | | Projects and quotas | [yes](https://docs.hermitbox.dev/v0.2.0/api.md#projects-and-limits) | | Machine providers and autoscale | [yes, owned-node adapters](https://docs.hermitbox.dev/v0.2.0/providers.md) | | Source availability and licence | [AGPL-3.0-only](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/LICENSE.md); SDKs, integrations, GitHub Action and stack templates [Apache-2.0](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/LICENSES/Apache-2.0.txt) | 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.0/speed.md) give thirty samples per tool and the different resource guarantees of containers and processes. ## hermitbox's guarantees by tier Each hermitbox sandbox reports the [guarantees](https://docs.hermitbox.dev/v0.2.0/host-capabilities.md) its tier gives on that host, and a create can `require` any of them. The node computes them in [`tier_guarantees`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/store_lease.rs); 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.0/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.0/vm.md), with what is tested, and its thirty-sample measurements in [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md#vm-tier-measurements). --- The installer prints the API URL and key and saves them privately; a server install also shows them on its welcome page, with its default tier. Keep the key in your caller's private environment. Each guide has three steps and one block to copy. - [TypeScript backend](https://docs.hermitbox.dev/v0.2.0/connect/typescript.md), including serverless callers - [Python](https://docs.hermitbox.dev/v0.2.0/connect/python.md) - [CLI](https://docs.hermitbox.dev/v0.2.0/connect/cli.md) - [GitHub Actions](https://docs.hermitbox.dev/v0.2.0/connect/action.md) - [Agents over MCP](https://docs.hermitbox.dev/v0.2.0/connect/mcp.md): [Claude Code](https://docs.hermitbox.dev/v0.2.0/connect/mcp/claude.md), [Cursor](https://docs.hermitbox.dev/v0.2.0/connect/mcp/cursor.md), [Codex](https://docs.hermitbox.dev/v0.2.0/connect/mcp/codex.md), [VS Code and Copilot](https://docs.hermitbox.dev/v0.2.0/connect/mcp/copilot.md) - [Webhooks](https://docs.hermitbox.dev/v0.2.0/connect/webhooks.md) - [Plain HTTP](https://docs.hermitbox.dev/v0.2.0/connect/http.md) - [Rivet harness](https://docs.hermitbox.dev/v0.2.0/connect/rivet.md) A container request needs an image and an engine. Process and Wasm refuse container images. Process requires Landlock/seccomp; a shared UID requires mutually trusted workloads, and internet-enabled processes share host networking. Wasm uses a virtual kernel and shared sidecar, with HTTP-only guest ingress. See [tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md) and [hosting boundaries](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees). --- 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 hello and cleans up its sandbox. ```yaml - uses: hermitbox/hermitbox/action@v0.2.0 with: url: ${{ vars.HERMITBOX_API_URL }} key: ${{ secrets.HERMITBOX_API_KEY }} image: ${{ vars.HERMITBOX_IMAGE }} run: echo hello ``` The tag follows the repository's release version. Images require containers; empty image selects the host default without substituting a weaker isolation. [Action inputs](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/action/action.yml), [tier boundaries](https://docs.hermitbox.dev/v0.2.0/tiers.md). --- 1. Install the CLI with the [one-command installer](https://docs.hermitbox.dev/v0.2.0/install.md). 2. Export `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` privately. If welcome reports `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 require the container tier and its engine. Process and Wasm refuse them; the block keeps that refusal. Welcome supplies an exact block for its configured tier. See [host boundaries](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees). --- 1. Open welcome and retrieve the active project key from the stated location. 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.0/api.md) describes lifecycle operations, capabilities, errors and webhook signing. --- On the machine where you ran the installer, the one-step setup is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): it needs no key. This page is for a remote install. 1. Install the [hermitbox CLI](https://docs.hermitbox.dev/v0.2.0/connect/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}" } } } } ``` Choose the file your agent reads: [Claude Code](https://docs.hermitbox.dev/v0.2.0/connect/mcp/claude.md), [Cursor](https://docs.hermitbox.dev/v0.2.0/connect/mcp/cursor.md), [Codex](https://docs.hermitbox.dev/v0.2.0/connect/mcp/codex.md), or [VS Code and Copilot](https://docs.hermitbox.dev/v0.2.0/connect/mcp/copilot.md). Their variable syntax differs. A named unavailable isolation or capability is refused. [MCP tools and transports](https://docs.hermitbox.dev/v0.2.0/mcp.md), [tier boundaries](https://docs.hermitbox.dev/v0.2.0/tiers.md). --- On the machine where you ran the installer, the one-step setup is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): it needs no key. This page is for a remote install. 1. Install the [hermitbox CLI](https://docs.hermitbox.dev/v0.2.0/connect/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 variable expansion. Host admission enforces [tier limits](https://docs.hermitbox.dev/v0.2.0/tiers.md); an agent cannot grant missing capabilities. --- On the machine where you ran the installer, the one-step setup is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): it needs no key. This page is for a remote install. 1. Install the [hermitbox CLI](https://docs.hermitbox.dev/v0.2.0/connect/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 project `.codex/config.toml` in trusted projects. `env_vars` passes named values without storing the key. Host policy and [tier limits](https://docs.hermitbox.dev/v0.2.0/tiers.md) remain in force. --- On the machine where you ran the installer, the one-step setup is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): it needs no key. This page is for a remote install. 1. Install the [hermitbox CLI](https://docs.hermitbox.dev/v0.2.0/connect/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; `COPILOT_HOME` can relocate its directory. It also describes shared project configurations. Host [tier boundaries](https://docs.hermitbox.dev/v0.2.0/tiers.md) still apply. --- On the machine where you ran the installer, the one-step setup is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): it needs no key. This page is for a remote install. 1. Install the [hermitbox CLI](https://docs.hermitbox.dev/v0.2.0/connect/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 variable syntax. Keep literal credentials out of it. Requests retain the host's [tier refusals](https://docs.hermitbox.dev/v0.2.0/tiers.md). --- 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 import os from hermitbox import Hermitbox # Connect with the URL and key from the environment. with Hermitbox( url=os.environ['HERMITBOX_API_URL'], key=os.environ['HERMITBOX_API_KEY'], ) 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.0/tiers.md) and the [sync and async SDK reference](https://docs.hermitbox.dev/v0.2.0/sdk/python.md). --- 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 be mutually trusted; internet-enabled processes share host networking. Wasm has a virtual kernel and shared sidecar, with HTTP-only ingress. Named missing tiers retain admission refusals; this API version refuses named guarantees it cannot prove. [The full integration guide](https://docs.hermitbox.dev/v0.2.0/integrations/rivet.md) covers lifecycle semantics and partial methods. OpenOrange 1.0.2 needs the prepared upstream patch; its releases do not include that provider hook. Follow that guide before trying its registration or preview callback. --- 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 the URL and key from the environment. const hb = new Hermitbox({ url: process.env.HERMITBOX_API_URL!, key: process.env.HERMITBOX_API_KEY!, }) // 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; an unawaited promise may be terminated. Long streams need a runtime that permits their duration. The host tier still controls [capabilities and isolation](https://docs.hermitbox.dev/v0.2.0/tiers.md). [SDK reference](https://docs.hermitbox.dev/v0.2.0/sdk/typescript.md). --- 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 the URL and key from the environment. const hb = new Hermitbox({ url: process.env.HERMITBOX_API_URL!, key: process.env.HERMITBOX_API_KEY!, }) // 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.0/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.0/tiers.md). --- # 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 may 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 may 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/compare.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/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/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 may 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), because every key hermitbox holds is post-quantum; 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 keep passing both until a release carries the default, since v0.2.0 requires them. - 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 may 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.1 (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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/interpreter-base.json), [Python interpreter](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/python-interpreter.json), [Node interpreter](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/node-interpreter.json), [Node canvas](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/node-canvas.json), [browser](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/browser.json), [desktop Python](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/desktop-python.json), [native tools (Debian)](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/native-tools-debian.json), [Playwright](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/playwright.json), [rclone modules](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/rclone-modules.json), [standalone Python](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/python-standalone.json), [micromamba builder](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/micromamba-builder.json), [earlier conda-forge prefix lock](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/conda-prefix.lock.json) and [VM kernel configuration inspection](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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.31.3 (MIT) and rustix for namespaces and mounts; Landlock 0.4.7 (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.0 (MIT OR Apache-2.0); flate2 1.1.10 (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.1 (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: ours says so only after the write succeeds and otherwise shows the full text selected to copy by hand. - 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. - 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. --- # Deploy the release image ```sh docker run -p 8080:8080 ghcr.io/hermitbox/hermitbox:0.2.0 ``` 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. See [hosting](https://docs.hermitbox.dev/v0.2.0/hosting.md) for platform files and exact validation boundaries. Set HERMITBOX_API_URL to `http://localhost:8080` and HERMITBOX_API_KEY to that key in the CLI or SDK environment. `hermitbox run -- echo hello` uses the bundled userland. `hermitbox run --image alpine:3.22 -- echo hello` is refused on the process tier with the image error documented in [process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md). 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 an unnamed request and reports the result. A request with `isolation` fixes its tier; a missing runtime is refused by name. `hermitbox doctor` lists what this host supports and why a tier is off. Advanced priority and single-backend overrides are documented in [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md). Wasm refuses an image and accepts optional `packages` registry names instead. See [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md) for the measured default and capabilities and [agentos.md](https://docs.hermitbox.dev/v0.2.0/agentos.md) for persistence and ingress limits. The [one-command installer](https://docs.hermitbox.dev/v0.2.0/install.md) runs the same supervisor as an ordinary user or provisions a systemd server as root. 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.0 ``` `docker compose up --build` uses the root docker-compose.yml with a named state volume. `docker compose logs hermitbox` shows the initial key on first start. A fresh image can use `--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. No privileged flag, engine socket or seccomp override is needed for the process tier. Embedded Postgres requires its private password on both TCP and Unix sockets. 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 using those aliases must support their URL prefix. Declared HTTP ports use the public hostnames returned by the API; configure DNS and preserve the Host header through the TLS terminator. The configured HERMITBOX_PUBLIC_URL hostname stays reserved for control routing, including when a declared hostname collides. TLS and raw TCP fronts are disabled in the image. Standalone host edges can still use wildcard DNS, certificates and raw fronts as documented in [agent.md](https://docs.hermitbox.dev/v0.2.0/agent.md). New image state derives its private node listener pool below the kernel's outgoing ephemeral range without changing sysctls. Restart preserves the stored pool, including older implicit pools. The image honors the edge's `HERMITBOX_EDGE_*` admission and greeting settings while keeping embedded service listeners private; normal limits remain the defaults. Without DATABASE_URL the image starts private Postgres in the volume. With DATABASE_URL it uses that existing 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 remain enabled. 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. For Render, this repository includes render.yaml, a public Blueprint with an ordinary Docker web service, persistent state disk and managed Postgres: 1. Open Render's **New → Blueprint**, connect your fork of this public repository, select the branch containing render.yaml, and apply the Blueprint. 2. Keep its Standard web-service plan and disk; the bundled service and a default sandbox need more memory than a 512 MiB instance. Render creates the Postgres add-on and supplies its connection string through the Blueprint's DATABASE_URL reference. 3. Wait for `/healthz` to become healthy, then retrieve HERMITBOX_BOOTSTRAP_API_KEY in the service Environment settings. The image uses Render's RENDER_EXTERNAL_URL automatically, so agent and port aliases use the service's verified HTTPS origin. Set HERMITBOX_PUBLIC_URL explicitly when using a custom domain. 4. Point the CLI/SDK at the service origin with that key. Run `hermitbox run -- echo hello` and create sandboxes without an image. Keep the disk attached across deployments. The process tier is Linux-only and requires the kernel policy described in [process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md). The image fails closed when the platform cannot enforce it. Container-tier installations add a usable host Docker socket and the host firewall policy; they require an operator's host permissions and do not change the ordinary-container process proof. 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, and refuses a cached image under any other digest. An explicit image reference may follow `--image`, or be set in `HERMITBOX_IMAGE`; it is used as given, and the install output's `imageSource` says which of the two it ran. The one-box binary preset starts PostgreSQL and RustFS by index digest too. This operator path installs the host Docker/firewall policy and mounts its engine socket; its container requires NET_ADMIN to apply that policy. It is separate from the ordinary process start above. Repeated installation retains credentials. Existing binary installations must first be stopped and their data migrated; the installer refuses an active binary deployment. Host installation reserves its configured workload ports in Linux's `ip_local_reserved_ports`, preserving existing reservations and writing a sysctl drop-in. This prevents outgoing connections from taking a stopped sandbox's published port. For an existing manually installed node, run `sudo hermitboxd reserve-ports --config /etc/hermitboxd/hermitboxd.toml`. --- # celld engines and the Docker socket experiment The native seam is in [integrations/celld/upstream](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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. 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. 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. CI keeps every sample, failed cohorts included, in `celld-native-measurements.json`. 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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 and keeps the requests, exit status and output in `docker-api-spike.json`. 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. --- # Silent-client measurements Run on Linux with a TCP listener that accepts but never writes, using clients with their default timeouts. `n=3` per client/protocol; each observation is capped at 15 seconds. Censored rows show lower bounds, not estimated timeouts. p90 uses the nearest-rank sample maximum. These measurements characterize these versions on this host, not every client version. | Client | Wait | n | p50 seconds | p90 seconds | Censored | | --- | --- | --- | --- | --- | --- | | Chrome | HTTP | 3 | ≥ 15.034 | ≥ 15.048 | 3/3 | | Chrome | TLS | 3 | ≥ 15.040 | ≥ 15.049 | 3/3 | | Go net/http | HTTP | 3 | ≥ 15.005 | ≥ 15.014 | 3/3 | | Go net/http | TLS | 3 | 10.064 | 10.076 | 0/3 | | Node fetch | HTTP | 3 | ≥ 15.014 | ≥ 15.295 | 3/3 | | Node fetch | TLS | 3 | 10.724 | 10.779 | 0/3 | | OpenSSH | banner | 3 | ≥ 15.023 | ≥ 15.030 | 3/3 | | Python requests | HTTP | 3 | ≥ 15.036 | ≥ 15.039 | 3/3 | | Python requests | TLS | 3 | ≥ 15.009 | ≥ 15.011 | 3/3 | | curl | HTTP | 3 | ≥ 15.049 | ≥ 15.162 | 3/3 | | curl | TLS | 3 | ≥ 15.048 | ≥ 15.049 | 3/3 | | Safari | TLS and HTTP | 0 | unavailable | unavailable | Safari cannot run on this Linux host | The default hold is **5 seconds**, below the smallest uncensored bound measured: Go net/http TLS (about 10 seconds). Node fetch TLS also timed out near 11 seconds. The other clients stayed connected through the cap. Safari is unmeasured, so no Safari bound or universal guarantee is claimed. A longer configured hold may help slow boots but cannot extend a client timeout. Commands: ```sh python3 -m venv ~/.local/hermitbox-edge-measure ~/.local/hermitbox-edge-measure/bin/pip install requests==2.32.5 export PATH="$HOME/.local/hermitbox-edge-measure/bin:$HOME/.local/go/bin:$PATH" python3 control/tools/measure-edge.py ``` The script builds a standard Go HTTP client, runs curl without a max-time, Node fetch without an AbortSignal, Python requests without a timeout, Go http.Get, Chromium headless with dump-dom, and ssh with no ConnectTimeout. Chromium uses no-sandbox only for this local test. Each capped process group is killed at the observation boundary. Go was installed from its published archive with its published SHA256 checked. Versions: - curl 8.14.1 (x86_64-pc-linux-gnu) libcurl/8.14.1 OpenSSL/3.5.7 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10 - Node.js v24.22.1 - Python requests 2.32.5 - go version go1.27.3 linux/amd64 - Chromium 155.0.8059.79 built on Debian GNU/Linux 13 (trixie) - OpenSSH_10.0p2 Debian-7+deb13u4, OpenSSL 3.5.7 9 Jun 2026 The edge keeps TLS ClientHello and HTTP request bytes, sends no hold messages, and splices them once control wakes the sandbox. Snapshots restore files, so a rest wake can take longer than a memory resume. Choose the configured hold using the clients and images actually deployed. A failed hold closes; the caller may reconnect after startup finishes. Control uses database-generated route versions and records each edge’s last fully held version. A running sandbox is shown as starting until every counted edge holds the first version naming it running. Liveness rules exclude quiet or lagging edges and bound that display wait to 15 seconds; they do not fence a node or authorize failover. Route epochs fence edge connections independently. --- # Host capabilities and guarantees `hermitboxd probe --json` tests the current caller's access without changing host configuration. It needs no node configuration or root. `hermitbox doctor` prints the same document as text; `hermitbox doctor --json` preserves its JSON form. Evidence names what was tested and an action names what would enable an unavailable capability. A permission failure is `unknown`, not evidence that the kernel lacks the capability. Only `on` can become a promised guarantee. The probe creates a disposable user namespace and uses a capability in its private UTS namespace; asks the Landlock ABI; reads the daemon's own cgroup controllers, and as `process-limits` whether its cgroup could give process sandboxes memory and cpu (a serving hermitboxd reports what it turned on); opens devices; and, on x86_64 with KVM access, measures ten real guest HLT exits. Namespace and guest children have a two-second deadline. Engine discovery asks for version and info, in order: Unix `DOCKER_HOST`, system Docker, user Docker, user Podman, system Podman. The first complete answer selects the engine. An explicit `docker.socket` in the configuration never falls back. Remote engines are refused because they cannot establish this host's data bind paths. The report also covers the firewall table, systemd, the user session, linger, architecture and the host C library. `hermitboxd doctor --config …` checks the selected runtime. Process nodes check enforceable Landlock rather than requiring Docker; Wasm nodes check their pinned distribution. State ownership uses the same runtime-specific policy as `serve`. `hermitbox doctor` also discovers the caller's protected installed configuration. With it, `process-desktop` and `process-ssh` report the verified native bundle, host glibc, agent support, namespaces and scoped-peer prerequisites. A bare probe keeps them off until a configured installation can be checked. This inspection reads existing process history without creating or repairing it, starting compute or downloading tools. A public sandbox view carries `guarantees`, with a boolean for every name below. A false value includes unknown or unannounced enforcement; it is never an implicit promise. The view reads the latest node announcement. A resting sandbox with no node reports false. | Guarantee | Current evidence | | --- | --- | | `separate-users` | A process uid pool, with an actual credential-drop probe; shared-uid process nodes report false | | `memory-limit` | Container engine info reports kernel memory limits and a cgroup driver; on the process tier, `process-limits`: hermitboxd's cgroup gives each sandbox's own cgroup the memory controller, and that sandbox started with its `memory.max` ([process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md#limits)) | | `cpu-limit` | Engine info reports CPU quota and weights and a cgroup driver; on the process tier, the cpu controller in each sandbox's own cgroup, and its `cpu.max` where it asked for a ceiling (weights stay a container's) | | `private-network` | The container backend's separate network namespace, gvisor's included; a namespaced process sandbox started with network none (reported per sandbox, never announced for the process tier) | | `host-firewall` | Rootful engine with a readable installed nftables table; refreshed before heartbeats. On the process tier, the `kernel-network-policy` probe (a disposable cgroup, every program loaded by the verifier, attached and removed) and that sandbox's own attached, verified programs ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)) | | `own-kernel` | The `vm` tier, whose guest boots its own kernel ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)); false on every other tier | | `memory-sleep` | Process suspension or a rootful container engine with cgroup enforcement; false on Wasm and rootless engines | | `browser-sandbox` | Observed browser launch policy plus usable namespaces and the approved container or verified native process policy | | `private-pids` | The container backend's private PID namespace, gvisor's included; the process tier where the `process-namespaces` probe started the installation's helper, as each sandbox reports it started | Containers do not claim a unique numeric host uid: several containers can use the same configured uid. Their namespace boundaries remain the container tier's boundary. Use a requirement only for a guarantee the deployment actually provides. Creation accepts an optional list, for example: ```json {"image":"alpine:3.22","require":["memory-limit","host-firewall"]} ``` `HERMITBOX_REQUIRE=memory-limit,host-firewall` adds deployment requirements to every creation. A request cannot remove a deployment requirement. Placement refuses missing guarantees with `no_room` and names them. Wake checks them again, including when the spec has not changed. Omitting requirements keeps the previous placement behavior. Requested `egress`, `network:none`, `user`, `workdir` and nonempty `packages` require their node feature on both create and wake. They are refused before a write or start when the feature is missing. Default Internet networking remains compatible with older v1 nodes, where the absent field already means Internet. CPU reservation remains admission metadata and retains its existing feature gate; it never becomes an implied kernel quota. Optional `requiredTools: ["desktop", "ssh"]` selects a process tier that announces those native tools and checks them again before wake. It remains control placement intent rather than an extra node request field. Native tool features are scoped to their tier; container or Wasm requests cannot inherit the process tier's readiness. Existing container tool calls continue to use their image and host-policy checks. See [native tools](https://docs.hermitbox.dev/v0.2.0/native-tools.md) for prerequisites. A container request with a memory limit is refused when the engine lacks its controller; the refusal names `memory-limit`. An ordinary user can explicitly accept a reservation: ```json {"image":"alpine:3.22","resources":{"memoryMb":256,"allowUnenforcedMemory":true}} ``` The node must announce `unenforced-memory` before control sends this field. Without a controller, the sandbox reports `memory-limit: false` and 256 MiB still counts for admission. Every capable engine applies the hard limit even when acceptance is true. This field cannot remove deployment requirements, CPU limits or PID limits: a requested CPU quota, weight or PID limit that the engine cannot enforce is refused. Omitted fields retain their original spec and record bytes. Doctor explains missing controller delegation and slow VFS storage. Podman's networks are made through its native API with bridge isolation, and a network that does not keep it is refused. The host firewall, FUSE and custom native-tool profiles are not available on Podman. The static `suspend` protocol feature remains for compatibility. `memory-sleep` is the additional statement that sleep preserves processes: Wasm data sleep disposes and recreates the VM. A browser on a host without usable namespaces has no `browser-sandbox` promise; the existing native-tool startup refusal remains. The probe reports facts about this caller; a privileged service can have different access from an interactive user on the same machine. --- [Use the Compose service](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/coolify/compose.yaml). Paste it into a Docker Compose Empty service on your existing Coolify host. Retain its named state volume. Coolify supplies the URL and generated key; find the key in service Configuration → Environment Variables. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#coolify) before deploying. [What runs on managed platforms](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) applies here. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- [Use a rented machine](https://docs.hermitbox.dev/v0.2.0/host/own-machine.md). App Platform has no persistent volumes, and none of its three storage paths keeps the complete install. Use the shipped cloud-init machine path to retain state; no stateless App Platform button is provided. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#digitalocean-app-platform) before deploying. The rented-machine path installs its container engine and host firewall policy; it attaches no KVM device. Container admission must enforce that policy. See the [machine guide](https://docs.hermitbox.dev/v0.2.0/host/own-machine.md) and [tier report](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) for the actual boundary. No live deployment has been tested. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- [Use the Fly Launch configuration](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/fly/fly.toml). Launch one Machine with the persistent volume. Fly chooses the app name. The initial key appears once in Monitoring → Logs; keep the volume on replacement. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#flyio) before deploying. [What runs on managed platforms](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) applies here. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- [Prepare the Koyeb service](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/koyeb/template.md). Prepare the recorded volume and service fields before deploying. A bare deploy button cannot attach that state volume. Read the generated key once in service Logs. No account or template is published. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#koyeb) before deploying. [What runs on managed platforms](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) applies here. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- Supply [the shipped cloud-init user data](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/cloud-init/user-data.yaml) to a Linux machine with persistent disk. It runs the installer and image startup once. CI boots it on the checksum-pinned Ubuntu 24.04 and 26.04 images. No live provider deployment or public HTTPS installation has been tested. This server path needs root, systemd, Docker and the host firewall policy. On a host without them, the [installer](https://docs.hermitbox.dev/v0.2.0/install.md) selects a preset that fits, an ordinary user's included. The image uses container isolation when that engine and policy are available; a requested unavailable capability is refused. Keep the state directory. The default service address is HTTP on loopback: use an SSH tunnel to reach it. Public HTTPS requires your existing DNS/TLS setup and `HERMITBOX_PUBLIC_URL`. See [operations](https://docs.hermitbox.dev/v0.2.0/operations.md) and [the full machine setup](https://docs.hermitbox.dev/v0.2.0/hosting.md#a-machine-of-your-own). Open the service address through that tunnel or your verified HTTPS endpoint. Welcome states the first-start key location in the journal and the configured tier. Enter the key there, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- [Prepare the Railway fields](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/railway/template.md). Paste the documented fields into Railway's Template Composer, attach one state volume and generate a domain. Find the generated bootstrap key in service Variables. Railway templates are account-owned, and none is published. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#railway) before deploying. [What runs on managed platforms](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) applies here. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- [Deploy on Render](https://render.com/deploy?repo=https://github.com/hermitbox/hermitbox). It builds the repository Dockerfile and retains its state disk and managed Postgres. Find the generated key in the service Environment settings. Read [the full setup and what is tested](https://docs.hermitbox.dev/v0.2.0/hosting.md#render) before deploying. [What runs on managed platforms](https://docs.hermitbox.dev/v0.2.0/hosting.md#tiers-and-guarantees) applies here. Open the service's address when it is healthy. Its welcome page states the key location and configured tier; enter the key there to connect, then choose a [caller guide](https://docs.hermitbox.dev/v0.2.0/connect.md). --- # Hosting Hermitbox 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. 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`. The templates name the release image by version, `0.2.0`. Render builds the repository Dockerfile, so its button uses the source directly. The platform documentation linked below was checked on 2026-11-14. These files create no account and publish no marketplace listing; where a platform needs a published template, its owner publishes it. See each platform's own pricing link below. CI runs the image built from the checkout in six container envelopes, one per platform below 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, and each passes the welcome page's secrecy, the authenticated details, all six caller blocks, and key retention across a restart without logging the key again. CI also runs each platform's own validator where one works without an account (`control/tools/hosting-validate.ts`), and boots the cloud-init file on two distributions. ## 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, and the platform files attach no nested engine or KVM. Process workloads share one UID, so run only work that trusts each other, and internet-enabled process workloads share host networking. No live deployment on these platforms has been tested. 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. On an ordinary container, the default process tier requires Landlock and seccomp. It refuses startup 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. There are no container images or browser/desktop templates in this process path. Process sleep keeps memory while the supervisor survives; a platform restart requires a fresh process from retained files. Shared UID workloads must be mutually trusted; 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.0/process-tier.md). Wasm is available on x86-64 when explicitly selected at deployment, with a virtual kernel, shared sidecar and [its limits](https://docs.hermitbox.dev/v0.2.0/agentos.md); it does not substitute for a requested process policy. Container requires an engine and host firewall, absent on these managed-service templates. 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 can establish Landlock ABI, seccomp, user namespaces and cgroup delegation there. The CI envelopes reproduce each platform's container settings under Docker; they are not a test of a provider's kernel. No live deployment on these platforms has been tested. ## Render [Deploy on Render](https://render.com/deploy?repo=https://github.com/hermitbox/hermitbox) uses the [root Blueprint](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/render.yaml), builds the repository Dockerfile, and retains one state disk and managed Postgres. `HERMITBOX_BOOTSTRAP_API_KEY` is generated by Render; retrieve it in the service's **Environment** settings. It is neither logged nor sent with the public welcome page. `RENDER_EXTERNAL_URL` provides the verified HTTPS origin. The image's default user is root; Render supplies the container filesystem and disk at `/var/lib/hermitbox`. Host namespaces/cgroups are not assumed. The ordinary-container process policy above applies; no Docker or KVM is attached. Validation: Render's own JSON Schema, the image envelope and the six caller blocks pass in CI. Live deployment: not tested. [Blueprint reference](https://render.com/docs/blueprint-spec), [persistent disks](https://render.com/docs/disks), [pricing](https://render.com/pricing). ## Railway [Prepare Railway deployment](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/railway/template.md). Templates are account-owned; the file lists every Composer field to paste. An account owner can publish those fields and use the returned deploy URL as the button; no template is published here. Use one instance, one `/var/lib/hermitbox` volume, generated domain and `/healthz`. `HERMITBOX_BOOTSTRAP_API_KEY=${{secret(64)}}` is generated in Template Composer; find it in **service → Variables**. `RAILWAY_PUBLIC_DOMAIN` gives the HTTPS origin. Keep the image's root user, writable container filesystem and its one state volume. Process admission still requires the kernel policy above; no user namespace, delegated cgroup, Docker or KVM is assumed. Validation: no account-free template validator exists for Composer fields. The container envelope and caller blocks pass in CI. Live deployment: not tested. [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). ## Fly.io [Prepare Fly deployment](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/fly/fly.toml). Fly Launch assigns a unique app name and attaches `hermitbox_state` to one machine. Use that file with Fly Launch; do not scale to a second machine with an independent state volume. Fly's secrets store accepts supplied values but the launch config does not generate one: the image prints its initial `apiKey` once in **app → Monitoring → Logs**. `FLY_APP_NAME` gives the HTTPS origin. Fly runs the image in a Machine with a writable root filesystem and its persistent `/var/lib/hermitbox` mount; the image user stays root. This template adds no Docker daemon or KVM device. The process policy must pass on the actual guest kernel. Validation: CI parses the TOML. Fly's remote configuration validator needs an app and an account ([its source](https://github.com/superfly/flyctl/blob/master/internal/command/config/validate.go)), so CI does not run it. The container envelope and caller blocks pass in CI; they do not emulate a Fly microVM. Live deployment: not tested. [Configuration](https://fly.io/docs/reference/configuration/), [volumes](https://fly.io/docs/volumes/overview/), [pricing](https://fly.io/docs/about/pricing/). ## DigitalOcean App Platform [Use a rented machine](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/cloud-init/user-data.yaml). App Platform has no persistent volumes. None of its 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. No App Platform button or stateless app spec is shipped. The rented-machine path below preserves all state. Validation: none for App Platform, which has no stateful image to test. Live deployment: not tested. [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). ## Koyeb [Prepare Koyeb deployment](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/koyeb/template.md). The deploy-button format supports an image, variables and ports but not a volume attachment. A bare button loses state; an external database still loses local identity and sandbox data; a pre-created volume works but needs account preparation. Prepare that volume and service using the supplied fields. No account or template is published. Read `apiKey` once in **service → Logs**; the button format has no documented generated-secret expression. `KOYEB_PUBLIC_DOMAIN` gives the HTTPS origin. Keep one instance with its `/var/lib/hermitbox` volume, port `8080`, writable root filesystem, image default user and no privileged mode. Actual Landlock/seccomp support must be established by admission; no namespace/cgroup/KVM guarantee is inferred from Koyeb's isolation technology. Validation: no account-free service validator is documented. The ordinary container envelope and caller blocks pass in CI, which is not a test of Koyeb's kernel. Live deployment: not tested. [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). ## Coolify [Prepare Coolify deployment](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/coolify/compose.yaml). In an existing Coolify installation, add a Docker Compose Empty service and paste the file. `SERVICE_URL_HERMITBOX_8080` asks Coolify to assign the proxy domain; `SERVICE_PASSWORD_64_HERMITBOX` generates the bootstrap key. Retrieve it in **service → Configuration → Environment Variables**. Keep the named volume, image user, writable container root and ordinary Docker security policy. Coolify runs on your host: Landlock/seccomp availability comes from that host, and no engine socket, privilege or KVM device is passed to hermitbox. No catalog entry is published. The generated URL uses the Coolify installation's domain/TLS policy; the operator must already have configured HTTPS there. Validation: Docker Compose's own config validator with generated values, the container envelope and the caller blocks pass in CI. Live deployment: not tested. [Compose](https://coolify.io/docs/services/configuration/docker-compose), [generated variables](https://coolify.io/docs/services/configuration/environment-variables), [pricing](https://coolify.io/pricing/). ## A machine of your own Supply [user-data.yaml](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/platforms/cloud-init/user-data.yaml) as cloud-init user data. It runs the installer and `hermitbox up --image` once as root, keeping state on the machine's disk. This is the server installation: Docker and its host firewall policy are installed; the image uses the container tier and refuses a missing policy. It ends at the same welcome page on port `8080`. The key location is the first successful startup in the service journal. The service endpoint is HTTP, and its default origin is loopback: reach the welcome page through an SSH tunnel. A public HTTPS deployment needs your own DNS and TLS setup and `HERMITBOX_PUBLIC_URL`; this file does not 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. Validation: cloud-init's own schema passes in CI, and CI boots the checksum-pinned Ubuntu 24.04 and 26.04 images ([inventory](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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. Live deployment: not tested. [cloud-init runcmd](https://docs.cloud-init.io/en/latest/reference/modules.html#runcmd). --- ## Install On Linux (x86_64 or aarch64), as your own user. No root, no Docker. ```sh curl -fsSL https://hbx.sh | sh ``` Then run your first command: ```sh ~/.local/bin/hermitbox run -- echo hello ``` ## Your first sandbox Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` to the values the installer printed. ```ts import { Hermitbox } from 'hermitbox' // Connect with the URL and key the installer printed. const hb = new Hermitbox({ url: process.env.HERMITBOX_API_URL!, key: process.env.HERMITBOX_API_KEY!, }) // 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() ``` ## Where to go next - [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md): Claude, Cursor, VS Code and Codex over MCP. - [Connect your code](https://docs.hermitbox.dev/v0.2.0/connect.md): TypeScript, Python, the CLI, GitHub Actions and HTTP. - [Host Hermitbox](https://docs.hermitbox.dev/v0.2.0/hosting.md): your own machine, a server, or a platform. - [Isolation tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md): what each tier guarantees, and what it needs. --- # Install Hermitbox ```sh curl -fsSL https://hbx.sh | sh ``` It runs as your own user on Linux (x86_64 or aarch64), asks nothing, and starts Hermitbox. It prints the API URL and a key, and saves them privately. Check that it works: ```sh ~/.local/bin/hermitbox run -- echo hello ``` `hermitbox up --check` prints the plan without changing anything. `--preset user|container|server|node` overrides what the installer detected. ## How the user preset works 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 x86_64's. An ordinary account gets the user preset without sudo, Docker or a system manager. The release bundle, signed with the ML-DSA-65 release keys, includes PostgreSQL, RustFS, control, edge, hermitboxd and its agent. Data, configuration, state and runtime sockets follow absolute XDG paths below home; defaults are `~/.local/share/hermitbox`, `~/.config/hermitbox`, `~/.local/state/hermitbox` and `~/.cache/hermitbox-runtime/hermitbox`. An XDG path escaping home is refused; the runtime falls back below home when `/run/user` is outside it. The service listens on loopback port 7331, or another free unprivileged port when it is busy. Sandboxes use authenticated path aliases; a domain is optional. Process isolation requires enforceable Landlock ABI 3. On compatible GNU hosts without it, the user preset selects and reports Wasm instead; explicitly selected unsupported backends are refused. Where the systemd user manager and noninteractive linger authorization work, hermitbox installs `~/.config/systemd/user/hermitbox.service` and starts it. Otherwise the command stays in the foreground and explains how to keep it running after logout. In a second terminal, run `~/.local/bin/hermitbox run -- echo hello`. New POSIX shell sessions find `hermitbox` through an installed PATH block; linked, unsafe or read-only shell profiles are left alone. The absolute command works in the current shell. Process sandboxes share your UID. 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.0/process-tier.md#limits). `hermitbox upgrade` authenticates the latest release and retains state and credentials. With foreground supervision it stays attached to the upgraded service. Deployment requirements are retained across user-manager restarts and upgrades; a backend change requires an explicit data migration. `hermitbox down` stops the service and its retained compute, keeping data. `hermitbox down --purge` also removes the managed bundle, configuration, state, cache, bootstrap, CLI shortcut, exact PATH block and user unit, prints the removed paths and reverses linger only when this installation enabled it. Save backups before purging. ## Server with root 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 database/object-store Docker volumes, control/edge units and its enrolled local node. Debian and Ubuntu can install missing packages automatically; other distributions need Docker and nftables installed and receive their names before any provisioning. Server sandbox placement requires private network/PID namespaces and enforced CPU/memory limits. The main daemon's unit hardening remains 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 [operations](https://docs.hermitbox.dev/v0.2.0/operations.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 user. Root in a container gets container, with managed files under `/opt/hermitbox`, `/etc/hermitbox-local`, `/var/lib/hermitbox` and `/run/hermitbox-local`. Embedded PostgreSQL drops to its dedicated nonzero UID. Process confinement must actually pass; missing kernel syscalls cause an actionable refusal. A mounted Docker socket alone does not establish correct host bind paths or firewall coverage. 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.0 ``` The same supervisor runs inside the release image. The first key appears once in its log. Keep the named volume; configure a trusted TLS terminator for remote access. See [deployment](https://docs.hermitbox.dev/v0.2.0/deploy.md) for Render, external stores and image tiers. ## 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/systemd fleet join. It installs the verifier and uses the supplied fleet token, verifying the signed daemon/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 entry has the same meaning as one `hermitbox node join --allow-image` value. A repository ending in `:` permits its tags, a namespace ending in `/` permits images under it, and 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.0/operations.md) for issuing a token and node policy. 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. Installation inside a container keeps that tier off. `hermitbox doctor` and `hermitboxd doctor` report tier availability. --- # Rivet and OpenOrange The TypeScript SDK exports `hermitboxProvider` from `hermitbox/provider`. It 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 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, sleep 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.0/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. 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. --- # Code interpreters A language context is a supervised process inside a native container or supported process sandbox. Its variables survive calls. The interpreter templates automatically start warming the default context at agent startup; `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. The process appears in `box.processes()` and its id/PID appears in `box.kernels()`. ```sh hermitbox template create python-interpreter hermitbox template create node-interpreter hermitbox sandbox python -c 'print(2+2)' ``` The CLI without an 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. ### 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 await py.interrupt() await py.restart() await py.close() 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 [Rust-owned agent document](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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 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.0/native-tools.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. CI runs both installed kernels through the TypeScript and sync/async Python SDKs, including state, charts, errors, interrupt and restart. Startup measurements are in [speed.md](https://docs.hermitbox.dev/v0.2.0/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/templates/python-interpreter/README.md) and [Node](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/templates/node-interpreter/README.md) image descriptions list layer notices and source availability. The resolved [Python](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/python-interpreter.json), [Node](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/node-interpreter.json) and [base-package](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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.0/speed.md). The [acceptance suite](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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. --- # MCP `hermitbox mcp` exposes this project's sandboxes through stdio. On the machine where you ran the installer, it reads the credentials the installer saved, so no key goes in any agent's config: each agent's one step is in [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md). For a remote install, set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` in the agent's environment, never in a file you share. Standard output contains only MCP messages. The optional command `hermitbox mcp --http 8090` instead serves stateless Streamable HTTP on `http://127.0.0.1:8090/mcp`; every request needs `Authorization: Bearer `. The HTTP listener checks Host and Origin and binds loopback. For a `.mcp.json` configuration: ```json { "mcpServers": { "hermitbox": { "command": "hermitbox", "args": ["mcp"], "env": { "HERMITBOX_API_URL": "https://hermitbox.example.com", "HERMITBOX_API_KEY": "replace-with-project-key" } } } } ``` For a `config.toml` configuration: ```toml [mcp_servers.hermitbox] command = "hermitbox" args = ["mcp"] [mcp_servers.hermitbox.env] HERMITBOX_API_URL = "https://hermitbox.example.com" HERMITBOX_API_KEY = "replace-with-project-key" ``` An HTTP configuration uses the same project's key: ```json { "mcpServers": { "hermitbox": { "type": "http", "url": "http://127.0.0.1:8090/mcp", "headers": { "Authorization": "Bearer replace-with-project-key" } } } } ``` Tools cover create, list, get, delete, run, background start, read, write, list files, snapshot, fork, sleep, wake, expose and project usage. State and logs are resources under `hermitbox://sandboxes//state` and `hermitbox://sandboxes//logs`. All calls use the public SDK and retain project admission and isolation. Tool errors are explicit; uncertain commands are never resubmitted. File reads are limited to 1 MiB; use SDK streaming for larger files. A single sandbox also has its own MCP endpoint. Obtain its expiring URL with `hermitbox sandbox mcp-url `, `await box.mcpUrl()` in TypeScript, or `box.mcp_url()` in Python (`await box.mcp_url()` for the async handle). The URL contains a scoped sandbox capability; put it in an HTTP client's URL field. It permits only that sandbox, expires on the existing agent token schedule, and can be regenerated when needed. It contains no project key. Its tools cover run, background processes, stdin, signals, files and exposed ports; resources are `hermitbox://sandbox/state` and `hermitbox://sandbox/logs`. Browser Origin requests are refused. The agent can be built without this optional surface using `cargo build -p hermitbox-agent --no-default-features --features server`. Both surfaces speak MCP 2025-11-25. --- # Desktop, browser, SSH and bucket tools The **container** tier provides desktops, browsers, SSH and bucket mounts as the sandbox user. The **process** tier provides browsers, Python/Node kernels, desktops and SSH through a separately verified tool bundle when the host meets each tool's prerequisites; mounts retain their capability refusal. Wasm refuses native tools. Measurements are in [speed](https://docs.hermitbox.dev/v0.2.0/speed.md). These tools wrap existing programs; the agent owns scoped routes and the edge owns access. `toolsVersion` is separate from the stable agent API version. ## 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 ``` ## 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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 const box = await hb.sandbox({ isolation: 'process', units: 4, requiredTools: ['desktop', 'ssh'], }) const png = await box.desktop.screenshot() await box.desktop.click(100, 100) await box.desktop.type('hello') await box.desktop.key('Return') const access = await box.ssh() // Use hermitbox sandbox ssh , or access.connect() with an SSH client. 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. 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. Startup measurements comparing the process and container tools are in [speed](https://docs.hermitbox.dev/v0.2.0/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/native-tools-debian.json), [browser](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/browser.json), [Playwright](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/playwright.json), [desktop Python](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/docs/licences/desktop-python.json) and [rclone](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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.0/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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 just 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. ```ts const box = await hb.sandbox({ template: 'desktop', units: 2 }) const { url } = await box.desktop() const png = await box.desktop.screenshot() 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. ```ts const browser = await hb.sandbox({ template: 'browser', units: 4 }) const { url: cdp } = await browser.browser() // Official Playwright: chromium.connectOverCDP(cdp) const page = await browser.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. ```ts const tools = await hb.sandbox({ template: 'tools', idle: '10m' }) const { host, port, user, key, hostKey } = await tools.ssh() // Pin hostKey and pass key to an SSH client in memory. await tools.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. ```ts // Mount a bucket prefix at /mnt/data. const mounted = 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 mounted.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 destroyed; 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.0/speed.md) for measured readiness. --- # Operating 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.0/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. 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 export HERMITBOX_API_URL=https://sandboxes.example.com export HERMITBOX_API_KEY=... # the initial key, printed once 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; it will not print it again. ## Adding nodes and daily operation 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 may 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 export HERMITBOX_OPERATOR_API=http://127.0.0.1:8081 export HERMITBOX_OPERATOR_TOKEN=... # from the protected control environment 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 ID` 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 ID --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 ID --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 ID` 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 URL` 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/observability/host.json) or the [fleet dashboard](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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. ## A host stops answering 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 hermitbox-postgres and hermitbox-store volumes and /var/lib/hermitboxd destroys 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-ARCH.sha256` and its `.sig` file beside the release assets, using `x64` or `arm64` for `ARCH`. 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 may 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. 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. 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. --- # Process isolation The release image runs the process tier when no usable Docker socket is present. It requires no host privilege. It has two modes, chosen by the host, never by a request: where the host lets the sandbox's user create user namespaces, each sandbox starts in namespaces of its own (below); elsewhere, as in a default `docker run`, it creates no user, mount, PID or network namespace. Independently, where the host delegates cgroup v2 controllers to hermitboxd, each sandbox gets a cgroup of its own whose limits the kernel enforces ([Limits](#limits)); where it doesn't, as in a default `docker run`, hermitbox writes no cgroup. ## Limits Where hermitboxd's cgroup can give its children the `memory` and `cpu` controllers (and `pids`), each process sandbox runs in a cgroup of its own below it, `hermitbox-`, the one its network policy's programs attach to as well ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)). Before its supervisor joins it, hermitboxd writes and reads back: | File | From | Means | | --- | --- | --- | | `memory.max`, `memory.swap.max` 0 | `resources.memoryMb` | The kernel's hard limit, with no swap beyond it, as a container's. Past it the kernel reclaims, then OOM-kills inside the sandbox's cgroup only | | `cpu.max` | `resources.cpuMillis`, when asked | A ceiling: that many thousandths of a CPU per 100 ms period | | `pids.max` | `resources.pidsLimit` or the node's default | Processes and threads in the sandbox, whatever their user | A sandbox runs with exactly these or not at all, and can't change them: its filesystem policy grants no part of `/sys/fs/cgroup`, even where it shares hermitboxd's user. The tier then announces `memory-limit` and `cpu-limit`, and each sandbox reports what it started with: one started before its host delegated the controllers reports them off until it starts again. The agent's sampled resident budget is set past reach there, since summing resident pages counts shared ones more than once and would kill a sandbox the kernel lets run. Stats come from the cgroup: memory charged, CPU time, throttled periods and process count. `resources.cpuWeight` stays a container's: it is refused on this tier. Where they are delegated: | hermitboxd runs | Its cgroup | | --- | --- | | As the server preset's unit, as root | The unit's own (`Delegate=yes`): memory, cpu and pids | | As the user preset's unit, an ordinary user | The user service's own (`Delegate=yes`), with what systemd gives users: memory and pids, and cpu from systemd 252 | | In a default `docker run`, or from a shell | None: off, with the reason | cgroup v2 lets a cgroup give its children controllers only while it holds no process of its own, so hermitbox's processes live in the `hermitbox-daemon` leaf of that cgroup: both units name it (`DelegateSubgroup=hermitbox-daemon`, systemd 254 and later); before that, hermitboxd moves itself there when it is its cgroup's only process, and never moves another. Where none of this holds, `process-limits` in `hermitbox doctor` and the node's host document is off with what is missing and what turns it on, the tier announces neither guarantee, memory stays the sampled budget below, and a request naming `resources.cpuMillis` is refused naming `cpu-limit`. Control places a CPU ceiling only on a tier announcing `cpu-limit`, and a deployment requiring `memory-limit` only on one announcing it. ## Two modes | | Plain | Namespaced | | --- | --- | --- | | When | The probe could not start the installation's helper in user namespaces | `process-namespaces` is on in `hermitbox doctor` | | PIDs | One host PID view; Landlock keeps other sandboxes' `/proc` unreadable | PID 1 of its own PID namespace; other sandboxes' processes don't exist there (`private-pids`) | | `/tmp` | Not granted; `TMPDIR` is the data directory's `.tmp` | A private `/tmp` of its own, granted to it alone, holding at most the node's `/tmp` size (`tmp_size_mb`) and never more than the sandbox's memory | | IPC | The host's | Its own IPC namespace | | `network: none` | A seccomp and Landlock filter in the shared network | Also an empty network namespace of its own (`private-network`) | | Landlock, seccomp, limits | As below | The same, installed inside the namespaces | The namespaced mode runs the installation's unmodified bubblewrap 0.13.1 (`namespaces/bin/bwrap` beside the agent, LGPL-2.1-or-later, never setuid) as `--unshare-user --unshare-pid --unshare-ipc --as-pid-1 --cap-drop ALL`, with the host's view bound whole and only `/proc`, `/dev` and `/tmp` new; `network: none` adds `--unshare-net`, and the node binds the supervisor's listeners in the host's network and passes them in. The probe is that same launch, run once per agent executable; a namespaced launch whose helper fails is refused, never started plain. Each sandbox reports what it started with: `private-pids` in the namespaced mode, `private-network` only there with network none. A request requiring `private-pids` is placed only on nodes that announce it for the tier. On Ubuntu 24.04 and later only binaries an AppArmor profile names may use user namespaces. `hermitbox doctor` then prints the one profile root installs for this installation's helper and the `apparmor_parser -r` that loads it; the `user` preset never installs it. The `server` preset does: `hermitbox up` unpacks the release's helper (`hermitbox-namespaces.tar.gz`) beside the agent in `/usr/local/lib/hermitbox`, and where the rule is on writes the profile hermitboxd names for exactly that helper (`hermitboxd namespace-profile`) to `/etc/apparmor.d/hermitbox-namespaces` and loads it; where the rule is off it removes one it wrote. No sysctl changes. The preset's unit lets hermitboxd create the helper's namespaces and leaves its `/proc` without the mounts the kernel refuses a new `/proc` under ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)). Run again on a server already enrolled, `hermitbox up` has the installed hermitboxd write its units as the release ships them (`hermitboxd install-units`, the writer `hermitboxd join` uses), reloads systemd and restarts hermitboxd when one changed. ## Isolation The API reports `isolation: process`; placement refuses a `container` request on this tier. An image request returns 422 `invalid_request`, field `image`, problem `this host runs the process tier; images are not available`. Each sandbox has an agent supervisor and persistent data directory. The default image runs as container root and allocates separate UIDs/GIDs from the node's configured pool. A fresh image started with `--user` uses one shared UID and explicitly announces that weaker mode. Public views also report `guarantees["separate-users"]`; creation can require it, and placement refuses a shared-UID node. The host's credential-drop probe must succeed before the uid-pool guarantee is announced. `hermitboxd doctor` checks Landlock and uses the same state owner as `serve`, without requiring a container engine. See [host capabilities](https://docs.hermitbox.dev/v0.2.0/host-capabilities.md). Keep a persistent volume with the same owner when restarting. Changing the container user does not grant access to a previous user's credentials. The userland is versioned with hermitbox: Debian 13, Node 24, Python 3, sh, coreutils, git, curl, and build-essential. Reviewed build-image digests are in Dockerfile; package versions come from that Debian release's maintained repositories. Templates snapshot prepared data, not arbitrary images. Commands start in their data directory. HOME and TMPDIR point there; absolute `/data` and `/tmp` paths are not remapped into a private namespace. Landlock ABI 3 or later (Linux 6.2 or later with Landlock enabled) is required. hermitbox refuses to start sandbox compute if filesystem policy cannot be fully installed. System userland is read-only, sandbox data is read-write, and other sandbox data and control credentials are inaccessible. PTY device access and only the agent's own proc task directory are granted. The memory sampler is a dedicated trusted thread created before filesystem restriction; it never executes requests. Untrusted commands inherit the restriction. Their launcher adds a supervisor guard before executing user code. It denies legacy thread signals, pidfd signals, scheduler changes, cross-process rlimit access, joining the supervisor's process group, and signals to its thread group. Legacy kill and queued process signals allow the command's initial PID and separate process groups, but refuse other positive PIDs because Linux also accepts supervisor thread IDs there. Use the agent's process signal API for individual child PIDs; guest tgkill remains available for other thread groups. The trusted supervisor retains its process controls. The syscall filter denies mount, unmount, pivot_root, chroot, ptrace, cross-process memory operations, pidfd_getfd descriptor copying, keyctl/add_key/request_key, bpf, kernel modules, unshare/setns, reboot/kexec, open_by_handle_at/name_to_handle_at, perf_event_open, userfaultfd, io_uring_setup, swapon/swapoff, UID/GID changes and capability changes. Clone flags creating namespaces are denied. clone3 returns ENOSYS so libc can use the checked clone fallback. no_new_privs prevents setuid executables gaining privileges. The existing platform seccomp policy stays active. Host policy fixes rlimits for virtual address space, descriptors, per-UID processes and CPU time per process, beside the cgroup's limits where it has them. The virtual ceiling allows V8's large virtual reservations; it is separate from the resident budget. Nice is a best-effort process priority, not a per-sandbox CPU weight. `resources.cpuWeight` is refused with 422 before compute starts, and so is `resources.cpuMillis` where the sandbox's cgroup can't hold it ([Limits](#limits)). Units reserve `cpuReservationMillis` for admission. Without a cgroup's `memory.max`, the agent samples the entire descendant tree's RSS every 100 ms and kills it when its memory budget is exceeded. That is not a hard memory cap: allocations can overshoot between samples, and shared pages may be counted more than once. Admission uses the enclosing container's readable memory allowance, not unrestricted host RAM. The enclosing platform's own memory limit still applies. Existing native specifications naming a CPU ceiling must be recreated as unit/admission-only specifications before restarting. Explicit hard-limit requests are never silently downgraded to reservations; persistent data is retained. Network-off is a filter, not a namespace. Landlock TCP connect filtering is used where available; the announced seccomp fallback also denies connect, bind, sendto, sendmsg and sendmmsg in command launchers. The authenticated supervisor's listener remains reachable. On this mode commands cannot start new application listeners. Internet-enabled processes share the enclosing network namespace. The process tier has no container network boundary. Where the host does not grant `kernel-network-policy`, all Internet-enabled process workloads must therefore be mutually trusted, including when they have separate UIDs: guest code can dial host and neighboring application listeners. Where it does (hermitboxd as root, the server preset's unit included, or an ordinary user with CAP_BPF, CAP_NET_ADMIN, a delegated cgroup and a BPF filesystem directory of its own), each process sandbox runs in a cgroup of its own whose eBPF programs decide every destination in the kernel ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)): with public internet on it reaches what a container reaches with the host firewall loaded, never this host's services (at any address it has, as its addresses change), another sandbox's ports, link-local or AWS's IPv6 metadata or private addresses on the served ports; hostname egress (`egress`) goes only through gateways hermitboxd serves for that sandbox; address rules (`egressAddresses`) allow or deny exactly the prefixes and ports named. Its own listeners stay reachable over loopback; from another machine only its published ports are, as a container's, and a UDP socket hears only peers it sent to. The sandbox reports `host-firewall` once its programs are attached and verified, and they survive any daemon restart the sandbox survives; one whose programs can't be verified after a restart is stopped, and while one started before the host had them runs, the tier reports `host-firewall` off. A host without the capability refuses `egress` and `egressAddresses` on this tier, naming it; nothing is approximated. The agent's spare-port proxy independently verifies target ownership. A bounded port-only channel asks a trusted worker, created before Landlock, to find an owned listening socket, connect, and verify the actual server-side socket's inode and full TCP tuple against the supervisor's descendant descriptors. PID start identities are checked throughout. No request bytes are sent before this proof; missing or inaccessible kernel metadata fails closed. A shared UID, a matching port, or an owned listener on a different address cannot authorize a foreign peer. This worker never executes guest code and exposes no general filesystem or network request interface. This protects agent forwarding, not direct guest TCP connections. Sleep retains memory. A sandbox with a cgroup of its own is frozen whole (`cgroup.freeze`, so nothing forks past it) and thawed on wake; one without has its tree stopped with SIGSTOP and continued with SIGCONT. Stop thaws it, sends TERM, then KILL after the configured grace; a kill of a sandbox with a cgroup is `cgroup.kill`, asleep or not, and whatever is left in its cgroup once its supervisor is gone is killed before the cgroup is removed. Signals use checked kernel start identities and pidfds. The supervisor adopts descendants; snapshot, fork, export and restore copy data with the same safe filesystem walk as the container tier. Private signing material and runtime journals are excluded. A daemon restart adopts surviving supervisors; a platform container restart requires booting them again from retained data. The kernel is the host container's kernel. A kernel escape from one process is an escape from that container. Separate UIDs improve access control; shared UID mode also shares per-UID resource limits and permits signaling other sandboxes or same-user services. Use shared UID mode only for mutually trusted workloads; its supervisor guard protects its own agent but does not create a separate user identity. The network trust requirement above also applies to separate-UID process sandboxes. Choose container or Wasm isolation for mutually untrusted workloads, accounting for the capabilities and shared-worker limits in [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md). Docker acceptance, kernel facts and measurements are collected in CI. See [speed.md](https://docs.hermitbox.dev/v0.2.0/speed.md) for measured cohorts and budgets. The public `/etc/mime.types` file is readable for Python HTTP and MIME lookup. This grants no read access to the rest of `/etc`; private service credentials remain outside the sandbox rules. --- # hermitboxd protocol v1 > The Rust types in [`src/protocol.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/protocol.rs) and > [`src/protocol/wire.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/protocol/wire.rs) are the source of truth; this page describes them. > The control service uses [generated node API types](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/wire.ts). > Before the first public release, protocol changes update both ends together. From that release, > changes within a major version are additive and adjacent releases interoperate. The control plane talks to one hermitboxd per host over **HTTPS with mutual TLS**, JSON bodies, under `/v1`. The vocabulary is *workloads*: a spec (image, environment, resources, storage, ports, stop behaviour) that hermitboxd keeps on this host, running or stopped. Nothing in the protocol names Docker. ## Conventions - **Transport.** TLS 1.3 only, and a client certificate is required. The certificate must chain to the host's `client_ca`, carry extended key usage `clientAuth`, and name one of `allowed_clients`. A missing or foreign certificate is refused during the handshake. A valid certificate for a name that isn't allowed gets `403 forbidden`, and its connection is closed after it. There is no 0-RTT. A handshake must finish within 5 s, and handshakes in progress are capped per peer address and overall: a connection past either cap is closed at once. A connection whose handshake finished is not counted. - **In fleet mode** (a `[fleet]` section, no `[api.tls]`), the node's sandbox certificate, the CA and `allowed_clients` all come from enrollment (below), and its certificate names the node (`.nodes..fleet`), not an address. A client dials the node's address and verifies that name. - **Versioning.** The major version is in the path (`/v1`). Every response carries `blocklyd-protocol: 1`. `GET /v1/health` lists `protocol.supported` and `features`. - hermitboxd refuses unknown request fields with `422 invalid_request`. Control checks the capabilities reported by the node before requesting an operation that depends on them. - **Request ids.** Send `x-request-id` (1–64 of `[A-Za-z0-9_-]`) to correlate. hermitboxd echoes it, or generates one, and logs it with every line about that request. - **Caching.** Every response is `cache-control: no-store`. - **Workload ids.** 1–63 of `a-z 0-9 -`, starting and ending with a letter or digit. A UUID is valid. Anything else in the path gets `400 invalid_workload_id` before any handler runs. - **Errors.** Every error but a `405` (which has no body) and a `stop` body over the size limit (a plain-text `413`) has the same shape. The `code` is the contract; the `message` is for people and may change. ```json { "error": { "code": "precondition_failed", "message": "…", "details": { "currentSpecDigest": "sha256:…" } } } ``` ## Idempotency: every verb is safe to repeat | Verb | Repeating it | |---|---| | `PUT /v1/workloads/{id}` | Same spec → `200 unchanged`, nothing touched. Keyed by id, so a retry never makes two workloads. | | `POST …/start` | Already running → `200 {changed: false}`. | | `POST …/suspend` | Already suspended → `200 {changed: false}`. | | `POST …/stop`, `POST …/kill` | Already stopped → `200 {changed: false}`. | | `DELETE …` | Already gone → `200 {existed: false}`. | | `POST …/exec` | Not idempotent by nature. Send `Idempotency-Key`: hermitboxd runs the command once per key (10 minutes, in memory) and returns the first answer to repeats. The same key with a different request gets `422 idempotency_key_reused`. Failures aren't cached. | Operations on one workload are serialized on hermitboxd: a concurrent duplicate waits for the first, then finds the work done. Operations run to completion even when the client disconnects mid-request, so a retry after a dropped connection finds a finished stop rather than half of one. ## Placement epochs (fleet mode) A fleet control plane gives every new home of a workload a **placement epoch**, a number that only rises: the first placement, each move, restore and recovery. It sends it with every mutating request in the `blocklyd-epoch` header, and hermitboxd stores it with the copy (in its record and as the container label `blocklyd.epoch`). Each verb checks it against the copy's own: | Verb | Rule | Why | |---|---|---| | `PUT` (ensure) | Its epoch, or a newer one, which takes the copy over | A new placement may land on a node that already holds an older copy | | `POST …/start`, `…/suspend`, `…/exec`, `…/export`, `…/snapshots`, `…/restore` | Exactly its epoch | Running a copy, copying it out or filling it is only ever for the current placement (a restore for a new epoch PUTs it first) | | `POST …/stop`, `…/kill`, `DELETE` | Its epoch or any newer one | A newer placement may always tear an older copy down | | `…/snapshots/{snapshot}/upload`, `DELETE …/snapshots/{snapshot}` | None | A snapshot never changes, whichever placement made it | - **Older** than the copy's: `409 stale_epoch` (`details.askedEpoch`, `details.currentEpoch`). - **Newer** where only exactly its own will do: `409 epoch_ahead`: PUT the spec with that epoch first. - **No header** for a copy that has one: `428 epoch_required`. A workload made without an epoch keeps the single-node protocol: none is asked for, and none is checked. - **A superseded copy** (fenced: see `…/fence`) refuses everything but teardown with `409 superseded`, and is never started again, by anyone, including hermitboxd's own restarts. Only a PUT for an epoch newer than the one that superseded it brings it back. ## Endpoints ### `GET /v1/health` `200` → `NodeHealth`: ```json { "status": "ok", "docker": true, "reconciled": true, "daemonVersion": "0.2.0", "protocol": { "current": 1, "supported": [1] }, "features": ["exec-idempotency-key", "logs-follow-across-restarts", "conditional-put", "placement-epochs", "data-transfer", "local-snapshots", "export-exclude", "execution-lease", "certificate-renewal", "resume-after-reboot", "multipart-upload", "self-upgrade", "suspend", "signed-upgrade"], "nodeId": "fra-box-1", "deploymentId": "staging" } ``` `status` is `degraded` while the runtime is unreachable or hermitboxd hasn't reconciled with it yet. ### `GET /v1/node` Host facts and capacity: - node and deployment - hermitboxd version, uptime, resident memory and CPU time - kernel, CPUs, load, memory, disk under the state directory, trash size - `capacity`: `allocatableMemoryMb`, `runningMemoryMb`, `provisionedMemoryMb`, ports total and allocated - workloads by state - Docker version, cgroup version and driver, security options, whether live-restore is on - the last reconciliation - host-level `issues`: orphaned data (`orphan_data`), a non-isolated network (`network_not_isolated`), live-restore off (`live_restore_off`), an unreadable record (`unreadable_record`), a container with no valid workload id (`unlabelled_container`), one with no record and no readable record label (`unrecoverable_container`), or a snapshot whose `snapshot.json` can't be read, or a name under `snapshots/` that isn't a snapshot's (`unreadable_snapshot`, found when hermitboxd starts and left alone) - `daemon`: version, start time, uptime, resident memory, CPU time - `fleet` (fleet mode): node id, control plane, the lifecycle it last said, the last contact and its age, the last error and latency, heartbeats answered and failed, the execution lease left (`leaseRemainingSeconds`), and when it last renewed its certificates in this run (`certificateRenewedAt`) ### `GET /v1/workloads[?changedSince=]` `200 { "workloads": [WorkloadView…], "observedAt": "…" }`. With `changedSince`, it lists only workloads whose state changed, or whose record was updated, at or after that time. This is the level-triggered listing the control plane's `observeChanged` needs: one call per host, answered from hermitboxd's own observations. ### `PUT /v1/workloads/{id}` — ensure Body: `WorkloadSpec`. ```json { "image": "ghcr.io/example/http-app:1.0", "entrypoint": null, "env": { "APP_MODE": "TRUE", "TYPE": "VANILLA", "VERSION": "1.21.8", "MEMORY": "2304M" }, "secrets": { "APP_TOKEN": "…" }, "resources": { "memoryMb": 3072, "cpuMillis": 2000, "cpuWeight": null, "pidsLimit": null }, "storage": { "mountPath": "/data", "sizeGb": 5 }, "ports": [ { "name": "http", "containerPort": 8080, "protocol": "tcp", "audience": ["edge", "control"] }, { "name": "admin", "containerPort": 9090, "protocol": "tcp", "audience": ["control"] } ], "stop": { "signal": "SIGTERM", "timeoutSeconds": 90 }, "restart": { "policy": "on-failure", "maxRetries": 3 }, "labels": { "blockly.sandbox": "0b6f1f2e-…" } } ``` | Field | Rules | |---|---| | `image` | `[A-Za-z0-9._-/:@]`, ≤ 255. Must start with one of the host's `allowed_images` prefixes, each of which ends in `/`, `:` or `@`, and read as an OCI reference; a prefix ending in `:` or `@` admits only the repository its name reads as (`alpine:` admits `alpine:3.24`, never `alpine:5000/x/y` on the registry `alpine:5000`). | | `entrypoint` | Optional argv, 1–64 arguments of ≤ 64 KiB, no NUL. | | `env`, `secrets` | Names `[A-Za-z_][A-Za-z0-9_]*` of ≤ 128. Values ≤ 64 KiB, no NUL. ≤ 256 variables and 512 KiB in all. A name is in one or the other. | | `resources.memoryMb` | Required. Hard limit with no swap, between `min_memory_mb` and what the host allocates. | | `resources.cpuMillis` | Optional CFS ceiling: 100 to cores × 1000. Container only; process and Wasm refuse it. It is also what the JVM counts as its processors. | | `resources.cpuWeight` | Optional cgroup weight, 2–262144. Container only; absent means proportional to memory: 1024 per 4 GB. Process and Wasm refuse explicit weights. | | `resources.cpuReservationMillis` | Optional admission reservation, 100 to cores × 1000; not an enforced CPU ceiling. Send only after `cpu-reservation` is announced. Unit CPU remains reserved in the control ledger even for a peer that has not announced this field. | | `resources.pidsLimit` | Optional, 64–65536. Absent means the host default (4096). | | `storage.mountPath` | Absolute path of plain components, not `/`. | | `storage.sizeGb` | 1–4096. Reported against measured use; **not enforced** in v1. | | `ports` | ≤ 8. Names `[a-z][a-z0-9-]{0,15}` are unique. `(protocol, containerPort)` pairs are unique. `audience` is a non-empty subset of `edge` and `control`. | | `stop.timeoutSeconds` | 1–600. The grace between the signal and the kill. | | `restart` | `no` or `on-failure`. `maxRetries` is 0–10, and 0 means never. hermitboxd restarts a failed workload itself, after a short backoff: every container's Docker restart policy is `no`, because Docker's `on-failure` restarts containers after an unclean reboot. It never restarts one after a requested stop, once it is fenced, or, in fleet mode, without the execution lease: the last heartbeat answer's `leaseSeconds`, counted from when that beat was sent (`restart_requires_contact_seconds` if the answer names none). A restart is admitted against memory as a start is: one that doesn't fit isn't made, and the workload stays `crashed` with the issue `insufficient_capacity`. A restart it withholds is not tried later. The retries a run has used are kept in the workload's record, so a restart of hermitboxd doesn't hand them out again; a requested start or a new spec begins a new run. After the host restarts, it resumes what was running when the host went down: in fleet mode only once it holds a lease, after applying the fences of the answer that granted it. After a restart of hermitboxd alone, in the same boot, it resumes nothing (see "After the host restarts"). | | `labels` | ≤ 32. Keys `[a-z0-9._/-]`. The `blocklyd.` prefix is reserved. Values ≤ 256. | | `resumesOn` | Optional, ≤ 128 characters. What a suspended workload may wake into from memory: see "Semantics". Not part of the spec digest. Announced as the feature `suspend`. | Every validation problem comes back at once: `422 invalid_request`, with `details.fields` a list of `{field, problem}`. **Semantics.** Ensure means "this workload exists with this spec", as HTTP `PUT` does. - **Absent:** hermitboxd creates it, stopped. `201 Created`, `outcome: "created"`. - **Present with the same spec and secret values:** nothing happens. `200`, `outcome: "unchanged"`. - **Present with a different spec** (or a rotated secret): hermitboxd makes a new generation. - It pulls the new image first; if that fails, nothing is touched. - It stops the old container gracefully and makes a new one on the **same data** and the **same host ports** for port names that remain. - It starts the new one if the old one was running. - `200`, `outcome: "replaced"`, `restarted: true|false`. - **A `retained` workload** (compute removed, data kept) gets compute again: `replaced`. - **A `suspended` workload with a different spec that names the same `resumesOn` as the spec it was suspended on** stays suspended, its memory kept. `200`, `outcome: "deferred"`, and the view's `pendingSpecDigest` names the spec. It is put in place at the workload's next boot: a cold start after a resume that didn't come back, or a start after a stop, a kill, a fence or a restart of the host. A resume wakes what is in memory and keeps the spec waiting. A `PUT` of the spec it runs drops a deferred one (`unchanged`); any other `PUT` replaces it as above, stopping it gracefully first, without starting it again. Conditional headers, standard HTTP: | Header | Meaning | Refused with | |---|---|---| | `If-None-Match: *` | Create only. Never touch an existing workload. | `412 precondition_failed` if it exists | | `If-Match: ""` | Replace only this exact current spec. An apply can't overwrite a newer one. | `412` with `currentSpecDigest` | | `If-Match: *` | Replace only if it exists. | `412` if absent | Responses carry `ETag: ""`. The spec digest is `sha256:` over the canonical JSON of the spec without secret values. Changed secrets are detected by comparing the container's environment instead, since hermitboxd keeps no copy of them. Refusals: | Status and code | When | |---|---| | `409 no_free_ports` | The host has no free ports. | | `507 insufficient_disk` | Free disk is under `min_free_disk_mb`. | | `503 runtime_unavailable` | Docker is down. | | `504 timeout` | The image pull ran past its limit. | `EnsureResponse`: `{ "outcome", "restarted", "workload": WorkloadView }`. `outcome` is `created`, `unchanged`, `replaced` or `deferred`. ### `GET /v1/workloads/{id}` `200 WorkloadView`, with an `ETag`: ```json { "id": "mc-1", "generation": 1, "epoch": 3, "supersededBy": null, "specDigest": "sha256:…", "image": "…", "state": "running", "health": "healthy", "exit": null, "restartCount": 0, "lastFailureAt": null, "startedAt": "…", "finishedAt": null, "changedAt": "…", "ports": [{ "name": "http", "protocol": "tcp", "containerPort": 8080, "hostPort": 42000, "endpoints": { "edge": ["10.0.0.5:42000"], "control": ["10.0.0.5:42000"] } }], "resources": { "memoryMb": 3072, "cpuMillis": 2000, "cpuWeight": null, "pidsLimit": null }, "storage": { "mountPath": "/data", "sizeGb": 5, "usedBytes": 745123840, "measuredAt": "…" }, "labels": { "blockly.sandbox": "…" }, "secretNames": ["APP_TOKEN"], "issues": [], "locate": { "containerName": "blockly-staging-mc-1", "containerId": "…", "dataDir": "/var/lib/hermitboxd/workloads/mc-1/data" }, "createdAt": "…", "updatedAt": "…" } ``` `state`, and how it maps onto the control plane's `ObservedState`: | `state` | Meaning | Control plane | |---|---|---| | `creating` | Accepted; its container isn't made yet (an interrupted create). | `stopped` | | `created` | Made and not running since. | `stopped` | | `running` | Running. | `running` | | `stopping` | A requested stop is in progress. | `stopping` | | `stopped` | Exited after a requested stop, or with code 0, 130 or 143. | `stopped` | | `crashed` | Exited with a failure on its own, or `exit.oomKilled`. | `crashed` (with `exit`) | | `restarting` | The restart policy is bringing it back. | `starting`, plus `lastFailureAt` as `failedAt` | | `missing` | hermitboxd has a record but the runtime lost the container. | `absent` | | `retained` | Compute removed on request, data kept. | `absent` | | `unknown` | The runtime can't be asked right now. | `unknown` | | `fenced` | Superseded by a newer placement: stopped, kept, never started again. | `stopped` (the fleet adapter never reports a stale copy as the sandbox) | | `suspended` | Frozen on request (`…/suspend`), its memory kept; a start resumes it. Only a workload asked to suspend is ever in it. | asleep, its memory kept | A few fields need a word: - **`endpoints`** is the control plane's `endpoint(handle, port, audience)`: per audience, the host addresses and port where the edge or the control plane reaches it. IPv6 is `[addr]:port`. - **`restartCount`** counts hermitboxd's restarts after failures since the last requested start or new spec. It survives restarts of hermitboxd. - **`issues`** lists what reconciliation or an operation found. The codes: `container_missing`, `create_incomplete`, `record_rebuilt`, `digest_mismatch`, `port_mismatch`, `port_conflict`, `port_out_of_range`, `duplicate_container`, `unexpected_container`, `over_storage`, `insufficient_capacity` (a restart after a failure didn't fit in memory; it stays until the workload is started or replaced), and `restore_finished` (a restore cut short by a crash after its data was complete was finished when hermitboxd started: whoever asked for it may not have heard). - **`pendingSpecDigest`**, present only while one waits: the digest of a spec a `PUT` deferred while the workload was suspended, put in place at its next boot. - **`locate`** is for operators. It is informational, never a contract. ### `POST /v1/workloads/{id}/start` `200 PowerResponse { changed, forced: false, workload }`. A start of a `suspended` workload resumes it: the same process, from the same start, with what it held in memory, and `resumed: true`. A resume that doesn't come back within `workloads.resume_timeout_seconds` (10 by default) is killed and the workload started afresh on its data, with `resumed: false`. `resumed` is absent on any other start. A start that boots the workload puts a deferred spec in place first. | Status and code | When | |---|---| | `409 no_compute` | The workload is retained. | | `409 not_created` | An interrupted create; PUT again. | | `409 container_missing` | The runtime lost the container; PUT again. | | `409 insufficient_capacity` | Running memory would exceed the allocatable memory. This is the control plane's `RuntimeFull`. | | `409 port_conflict` | Something else holds its host port. | ### `POST /v1/workloads/{id}/suspend` With the epoch header (exact). Freezes a running workload with Docker's cgroup freezer (pause): its processes stop where they are and its memory is kept, until a start resumes it. A suspended workload holds its memory on the node, as a running one does, and counts against what the node gives out. - `200 PowerResponse`; `changed: false` when it is already suspended. - `409 not_running` for a workload that isn't running. - Stop, kill, fence and delete reach a suspended workload as a running one: a stop's signal arrives as it thaws, so it saves on the way out. Export answers it as it answers a running one. Exec needs a running process, and a frozen one runs nothing: `409 not_running`. ### `POST /v1/workloads/{id}/stop` The body is optional: `{ "timeoutSeconds": 1–600 }` overrides the spec's grace. - hermitboxd sends `stop.signal`, waits the grace, then kills. - `200 PowerResponse`. `forced: true` means the grace ran out and the workload was killed without saving. - The request returns once the workload has exited, so it can take up to grace + 30 s. - A workload that isn't running (one waiting out a restart's backoff, or a resume after the host went down) stays down: the stop is recorded and nothing starts it on its own. `changed: false`. ### `POST /v1/workloads/{id}/kill` SIGKILL now, with no grace: the control plane's `forceStop`. `200 PowerResponse`. Like a stop, it keeps a workload that isn't running from being restarted or resumed. ### `DELETE /v1/workloads/{id}[?data=keep|delete]` - **`keep`** (the default): hermitboxd removes the container (stopping it gracefully first if it runs) and releases its ports. - The data stays. The workload becomes `retained`, and a later PUT brings its compute back. - This is the control plane's `decommission`. - **`delete`**: the same, and the whole workload directory (record and data) is **moved to the host's trash** in one rename. - It is purged after `trash_retention_hours`. - This is the control plane's `destroy` or `release`. - It requires `x-blockly-confirm-delete-data: {id}`, echoing the id; otherwise `428 confirmation_required`. Data is never deleted on a single mistake. `200 DeleteResponse { existed, removedContainer, data: "kept" | "trashed" | "absent", trashPath }`. ### `POST /v1/workloads/{id}/exec` The body is `{ "command": ["argv", …], "timeoutSeconds": 1–600 }`, with a 30 s default. Limits: ≤ 256 arguments of ≤ 128 KiB each (Linux's own limit), ≤ 1 MiB in all. - It runs **inside the workload**, as the workload's user, with its limits. It never runs on the host. - hermitboxd adds no shell. Send `["sh", "-c", script, name, args…]` for one: a control plane does. - Output is capped at 1 MiB per stream (`stdoutTruncated`, `stderrTruncated`). - **On timeout hermitboxd kills the command, and every process it started, by host pid.** Docker has no API to do that ([moby/moby#35703](https://github.com/moby/moby/issues/35703)). - Each pid is checked against the container's cgroup first, in case it was reused. - `timedOut: true`, `killed: true`. - The workload must be running (`409 not_running`). hermitboxd checks that, and the epoch, under the workload's lock, then runs the command in the container it found, by id, without holding the lock: a stop or a fence never waits for an exec. If the workload stops or is replaced in between, the command runs nowhere else: `409 not_running`. - An optional `Idempotency-Key` header is covered above. `200 ExecResponse { exitCode, stdout, stderr, stdoutTruncated, stderrTruncated, timedOut, killed, durationMs }`. ### `GET /v1/workloads/{id}/logs[?tail=N&since=&follow=true]` `application/x-ndjson`, one JSON object per line: ``` {"ts":"2026-09-28T02:16:32.123Z","stream":"stdout","line":"application ready"} {"event":"end","reason":"complete"} ``` - `tail` is at most 10 000. Without `follow` it defaults to 200 and the stream ends with `{"event":"end","reason":"complete"}`. - With `follow` the stream continues **across the workload's restarts**: - It emits `{"event":"restarted"}` and reads each new run from its start. - It ends with `{"event":"end","reason":"removed"}` when the container is removed. - It also ends when the client disconnects. - Lines are capped at 16 KiB. ### `GET /v1/workloads/{id}/stats` `200 StatsView`: - `state`, `uptimeSeconds` - `cpuCores`: cores in use since the previous sample. `cpuSecondsTotal`, `cpuThrottledPeriods`, `cpuLimitMillis` - `memoryBytes`, `memoryWorkingSetBytes` (usage minus inactive page cache), `memoryLimitBytes` - `pids`, `pidsLimit` - `networkRxBytes`, `networkTxBytes` - `dataUsedBytes`, measured every `disk_usage_seconds` by a walk of the data directory that never follows a link out of it and leaves out any filesystem mounted inside it ### `POST /v1/workloads/{id}/fence` Body: `{ "currentEpoch": N }`: the control plane says which epoch is current. - A copy older than `N` is stopped (gracefully) if it runs, marked superseded by `N`, and kept: its data stays where it is, and its Docker restart policy stays `no`. - A copy at or past `N` is left alone, so a late fence is harmless. - One older than `N` that is already superseded is fenced again all the same: its Docker restart policy is set to `no` again, and it is stopped if it runs. The answer says `changed: false`, so a repeated fence is harmless too. - A fence the runtime couldn't carry out (it didn't answer) is an error, but the mark stands: nothing starts the copy again, and hermitboxd stops it itself once a resync finds it running. - Needs no epoch header: it is itself the statement of which epoch is current. - Heartbeat answers carry the same instruction (below); this endpoint is for fencing at once. `200 FenceResponse { changed, stopped, workload }`. ### `POST /v1/workloads/{id}/export` Body: `{ "url": "…", "headers": { … }, "quiesced": false, "exclude": ["libraries"] }`, with the epoch header (exact). - hermitboxd writes the workload's data directory as a **gzip tarball of `./`-relative paths**, the control plane's archive format, to a spool file under its state directory while hashing it, then `PUT`s it to the presigned `url` with a known length. Gzip's fastest level: region files are compressed already. - `exclude` names entries at the top of the data to leave out (at most 64 plain names): what the image makes again when it is missing, so a move carries the data and not application bundles. - Only a stopped workload exports, unless `quiesced: true` says the caller paused its saving (for example, flushing and pausing an application writer). A superseded copy never exports. - The data belongs to the workload, which can rearrange it while it is read. hermitboxd reads it relative to directories it already holds open, with `O_NOFOLLOW` at every step: a symlink is archived as a symlink and never followed, an entry swapped mid-read is skipped, and a file that grows while it is read is cut at the size its header states. Nothing outside the data directory can reach the archive. - The URL is used once and never logged or stored. **In parts.** One PUT carries at most `transfer.max_put_mb` (default 5115, 5 GiB less 5 MiB: Cloudflare R2's limit, the strictest of the S3-compatible stores). For a larger archive the body may also carry `"parts": { "partSize": 67108864, "urls": ["…", "…"], "headers": { … } }`: an S3 multipart upload the control plane has begun, a presigned URL for each part, in order. hermitboxd packs first, then decides: - An archive no larger than one PUT goes to `url`, whether parts were offered or not; their URLs are never called, and the control plane drops the upload. - A larger one, with enough parts offered (`ceil(size / partSize)` of the URLs, from the first), goes in parts: every part `partSize` bytes but the last, each read from the spool with its length declared, one after another. A part whose PUT fails on the network or answers 5xx, 408 or 429 is sent again, up to three times in all; any other answer, or a part with no `ETag`, fails the export (`502 transfer_failed`). The response then carries `parts: [{ number, etag }]`, from 1, which the control plane completes the upload with. hermitboxd holds no credentials for the store, so it never completes or aborts an upload itself. - A larger one without parts, or with too few, is `422 archive_too_large` with `details.sizeBytes` (the archive's size) and `details.limitBytes` (one PUT's limit, or what the parts offered carry): refused once packed, before anything is sent. Asked again with enough parts, it goes. `partSize` is 5 MiB to 5 GiB less 5 MiB, and `urls` 1 to 10,000 of them, or the request is `422 invalid_request` (`parts.partSize`, `parts.urls`) before anything is packed. The body still has to fit `max_body_bytes` (2 MiB by default, about 2,000 presigned URLs); the control plane's control plane offers about 64, larger parts for a larger archive. A node that lists the `multipart-upload` feature takes `parts`; an older one refuses the field as unknown. `200 ExportResponse { sizeBytes, sha256, format: "tar.gz", entries, durationMs, parts? }`. Upload failures are `502 transfer_failed`; too little disk for the spool is `507 insufficient_disk`, up front or once free disk falls under the floor while the spool is written (hermitboxd looks every 256 MiB, within a file too). Data whose files state more than 256 GiB in all, more than a restore unpacks, gets the same answer before the file that takes it past is read: a sparse file counts at the size it states. ### `POST /v1/workloads/{id}/restore` Body: `{ "url": "…", "sha256": "…" }`, `{ "snapshot": "" }` or `{ "fork": { "workload": "", "snapshot": "" } }` (feature `local-forks`), with the epoch header (exact). The workload must exist (PUT first) and be stopped. - **From a URL**, hermitboxd downloads the archive to a spool file, and checks its sha256 when one is given, before anything changes: `422 checksum_mismatch` leaves the data alone. It unpacks into a fresh directory beside the data: regular files and directories only (links, devices and the like are skipped and counted); no absolute paths or `..`; files opened with `O_NOFOLLOW`; modes masked to 0755; owned by the workload's user; at most 256 GiB and 2 million entries; at most 1 MiB of any member's long name, long link and PAX records, or of a skipped entry's data. Anything else is `422 invalid_archive`. An archive of several gzip members is read whole, as `gzip -d` reads it. - **From a snapshot** this node holds of the workload (`404 snapshot_not_found` otherwise), it copies the snapshot beside the data, sharing blocks where the filesystem can. - **A fork** reads another workload's snapshot on this node in the same way. Where that snapshot was taken of a VM asleep with its memory (its `memory` is set), the VM still sleeps with that memory, the fork is on the same tier, and its spec differs from its source's only in what is each sandbox's own, the fork takes the memory too: its data directory gets the disk, it is `suspended`, and its first start resumes the source's processes under its own identity (`resumed: true`). Otherwise it copies the snapshot's disk alone. - **Disk.** A restore from a URL is refused up front (`507 insufficient_disk`) when free disk is already under `min_free_disk_mb`, or when the archive's announced length (`Content-Length`) wouldn't fit above it, and stopped with the same answer if free disk falls under the floor while it downloads or unpacks (hermitboxd looks every 256 MiB). One from a snapshot needs the snapshot's full size free above the floor, shared blocks or not, and is stopped the same way while it copies. Either way the data is left as it was. - Then it swaps the directories in one atomic exchange (`renameat2`), so a crash leaves the old data in place or the new, never neither, and the data it replaced goes to the host's trash. On a filesystem that can't exchange it renames twice instead. A restore a crash cuts short is settled when hermitboxd starts: one whose new data was complete is finished (issue `restore_finished`), any other is removed, and the data is as it was. `200 RestoreResponse { sizeBytes, sha256, entries, skipped, unpackedBytes, previousData, durationMs }` (`sha256` is null for a snapshot). ### `POST /v1/workloads/{id}/snapshots` Body: `{ "id": "", "quiesced": false }`, with the epoch header (exact). The id is the caller's (the control plane's archive id, a UUID; the workload-id rules apply). - A copy of the data directory into `workloads//snapshots//`, beside the data and never mounted into the workload. On a filesystem that shares blocks (XFS with reflink, btrfs) every file is a `FICLONE`: the snapshot takes moments and no space until the data changes. On one that can't (ext4), it is a full copy. Either way it needs the data's full size free above the floor (`507 insufficient_disk`): a copy that shares blocks takes as much as a plain one once the data moves on. It is stopped with the same answer, and removed, if free disk falls under the floor while it copies, or if the data's files state more than 256 GiB, as an export is. - The same rules as an export: a running workload only with `quiesced: true`, only the current copy, and the same walk that never leaves the data directory. - A VM asleep with its memory (`suspended`) is copied as its sleep left its disk, and stays asleep with that memory; its snapshot's `memory` names it, for a fork on this node. - Asking again with the same id answers `200` with the snapshot already made (`created: false`). A snapshot interrupted by a crash has no `snapshot.json` and is redone; what it had copied is removed when hermitboxd starts, as are spool files a crash left. `201 SnapshotResponse { created, snapshot: SnapshotView }`, where `SnapshotView` is `{ id, workload, epoch, createdAt, sizeBytes, files, method: "reflink" | "copy", quiesced, specDigest, durationMs }`. ### `GET /v1/workloads/{id}/snapshots` `200 { snapshots: SnapshotView[] }`, oldest first. ### `POST /v1/workloads/{id}/snapshots/{snapshot}/upload` Body: `{ "url": "…", "headers": { … }, "parts": { … } }`, `parts` optional. The snapshot as an archive, exactly as an export would write it, PUT to the presigned URL, or in parts when it is larger than one PUT carries and they are offered, as for an export, which says how. No epoch: a snapshot doesn't change. It doesn't hold the workload's lock either, so a long upload never delays a stop. `200 ExportResponse`. A snapshot packs for one upload at a time: another asked for meanwhile is `409 snapshot_busy`, and goes once the first ends. ### `DELETE /v1/workloads/{id}/snapshots/{snapshot}` `200 { existed }`. Deleting what isn't there (a workload deleted with its data takes its snapshots along) is not an error. During an upload of it: `409 snapshot_busy`. ### Ops listener (plain HTTP, loopback by default) It asks for no certificate, so `ops.listen` is loopback or a private address (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, fc00::/7, fe80::/10): hermitboxd refuses to start with 0.0.0.0, `::` or a public address. | Path | | |---|---| | `GET /healthz` | `200 ok` while the process runs. For systemd and liveness checks. | | `GET /readyz` | `200` once Docker answers and hermitboxd has reconciled; `503` otherwise. | | `GET /metrics` | OpenMetrics text: operations, durations, HTTP, auth failures, reconciliations, runtime events, workloads by state, ports, issues, per-workload memory, CPU and disk, snapshot bytes, hermitboxd's own RSS and CPU, and in fleet mode heartbeats, contact age, the execution lease left and certificate renewals. | ## Error codes | Status | `code` | |---|---| | 400 | `invalid_request` (malformed JSON or query, both `If-Match` and `If-None-Match`), `invalid_workload_id`, `invalid_snapshot_id` | | 403 | `forbidden`: a verified certificate for a name that isn't allowed | | 404 | `not_found`, `snapshot_not_found`, `no_route` | | 405 | No `code`: a method the path doesn't take is refused with an empty body. | | 409 | `no_compute`, `not_created`, `container_missing`, `not_running`, `not_stopped`, `not_quiesced`, `insufficient_capacity`, `no_free_ports`, `port_conflict`, `name_taken`, `stale_epoch`, `epoch_ahead`, `superseded`, `snapshot_busy` | | 412 | `precondition_failed` | | 413 | `payload_too_large` (bodies over `max_body_bytes`, 2 MiB by default); `POST …/stop` reads its optional body raw, so its 413 is plain text with no `code` | | 415 | `invalid_request` (a request that takes a JSON body, sent without a JSON `content-type`) | | 422 | `invalid_request` (spec or exec validation, unknown fields), `idempotency_key_reused`, `invalid_archive`, `checksum_mismatch`, `archive_too_large` (an export or snapshot upload larger than one PUT carries, with no parts or too few offered; `details.sizeBytes`, `details.limitBytes`) | | 428 | `confirmation_required`, `epoch_required` | | 500 | `internal` | | 502 | `runtime_error` (Docker refused something unexpected), `transfer_failed` (an export or restore couldn't move the bytes) | | 503 | `runtime_unavailable` | | 504 | `timeout` | | 507 | `insufficient_disk` | ## The control plane's endpoint (fleet mode) A node in fleet mode also talks to the control plane: it enrolls once, then beats, and renews its certificates before they end. All are HTTPS to `fleet.url`, trusting only the fleet CA's certificate (`fleet.ca`), TLS 1.3. The control plane's side is [`node-endpoint.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/node-endpoint.ts) and [`registry.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/registry.ts); the wire types are in [`src/protocol/wire.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/protocol/wire.rs). ### What a joining host fetches Before a host has anything, it fetches four things from the endpoint, with no authentication ([`join-routes.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/join-routes.ts)). None is secret, and each is checked before it is used: - `GET /fleet/v1/ca.pem`: the fleet CA. Fetched without checking the connection, since nothing is trusted yet, and then checked against the join token's hash; nothing else is fetched until it matches. - `GET /fleet/v1/join.sh`: [`control/src/join.sh`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/join.sh), with [`deploy/daemon.json`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/daemon.json) written into it. Fetched over TLS checked against that CA. - `GET /fleet/v1/blocklyd` and `GET /fleet/v1/blocklyd.sha256`: the static hermitboxd the control plane's image carries, and ` hermitboxd`, which `sha256sum -c` reads. Without the binary both are `404`, in plain text saying why. An enrolled node's `hermitboxd upgrade` also asks for `GET /fleet/v1/blocklyd.json`: the offer a heartbeat's answer makes (below), `{ "version": "…", "sha256": "…", "signature": "…" }`, which it checks the same way. **The join token.** `bk1.` and base64url (no padding) of `{"u": "", "h": "", "d": "", "s": ""}`, and `"n": ""` in a token that re-enrolls a node. `hermitboxd join` and enrollment read it ([`src/fleet/token.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/fleet/token.rs)); only `s` is sent to `enroll`, once `d` is the configuration's deployment and `h` matches `fleet.ca`. A bare token, the secret alone, is still accepted everywhere a token is. The region, labels and the node to re-enroll are kept with the token on the control plane, which decides by them; `n` only lets `join` tell the host it is pasted on from another node's. ### `POST /fleet/v1/enroll` No client certificate yet: the one-time token is the authorization: a bare token, or a join token's secret (the control plane takes a whole join token too, and looks up its secret). ```json { "token": "…", "csrPem": "-----BEGIN CERTIFICATE REQUEST-----…", "facts": NodeFacts } ``` - `NodeFacts`: hostname, boot id, sha256 of `/etc/machine-id`, daemon version, protocol and features, the API address to dial, edge and control addresses, capacity, labels. - The key behind the CSR is made on the node and never leaves it. The CSR's subject and names are ignored: the control plane names the node. - **One key until answered.** hermitboxd writes the key to `identity/enroll-key.pem` (0600) before its first attempt, and every attempt asks for it until one is answered, after a restart too. A spent token presented again with a CSR for the key that spent it gets a fresh answer for the same node, so an answer lost on the way (a timeout, a connection reset once the control plane had answered) is asked for again. - The answer: `{ nodeId, deploymentId, serverCertPem, clientCertPem, caPem, allowedClients, heartbeatSeconds }`. Two certificates for the node's one key: serverAuth for its API, clientAuth for its heartbeats. hermitboxd ignores this `heartbeatSeconds`: it beats every `heartbeat_seconds` of its own configuration until a heartbeat answer names another interval (1–60 seconds). Between beats it sends one as soon as a workload's state, epoch or ports change, at most once a second. - `caPem` must be the certificate in `fleet.ca`, compared as DER rather than as PEM text: from then on the node trusts that CA for the control plane and for who may call its API. An answer naming another is refused, and no identity is written. - hermitboxd writes `identity/` (the enrollment key becomes `node.key`, 0600), then deletes the enrollment key and the token file. `node.json`, which says "enrolled", goes last, once both certificates are known to be for the key: an answer the node can't use leaves it unenrolled, to ask again. An unknown or expired token, or a spent one presented with another key, is `403 invalid_token`, one answer for all three. ### `POST /fleet/v1/nodes/{nodeId}/heartbeat` With the node's clientAuth certificate, every `heartbeat_seconds` (5). ```json { "nodeId": "…", "sessionId": "…", "bootId": "…", "seq": 42, "daemonVersion": "0.2.0", "protocol": { "current": 1, "supported": [1] }, "features": ["…"], "runtimeUp": true, "reconciled": true, "capacity": NodeCapacity, "workloads": [{ "id": "…", "epoch": 3, "supersededBy": null, "state": "running", "specDigest": "…", "generation": 2, "memoryMb": 3072, "restartCount": 0, "exit": null, "lastFailureAt": null, "changedAt": "…", "ports": { "http": 42001 } }], "issues": [], "addresses": { "api": "10.0.0.5:7443", "edge": "10.0.0.5", "control": "10.0.0.5" }, "upgradeFailed": { "version": "0.3.0", "reason": "hermitboxd 0.3.0 exited with status 1 before it came up" } } ``` - **The whole state, every time**: every copy the node holds, whatever its epoch. The first beat after a restart or a partition is therefore a full resync. - The session id is new for each daemon run and `seq` counts from 1 within it; the control plane uses them to ignore delayed beats and to catch two hosts sharing one identity. - `issues` beside a workload is what the node found wrong with it and can't mend itself: a restart refused for want of room (`insufficient_capacity`), data over its spec's size (`over_storage`), each `{ "code", "detail" }`. Left out when there is none. The top-level `issues` are the host's. - `addresses` is where the node is reached as its configuration says now. The control plane follows a change (and records `node.addresses_changed`): the node's identity is its certificate, not its IP. - `upgradeFailed` is the last upgrade this node gave up on, putting back the binary it had: sent in every beat until it tries another, and left out when there is none (below). - `capacity` includes `snapshotBytes` (what local snapshots hold) and `reflink` (whether they share blocks with the data). `usedMemoryBytes` and `usedCpuCores` add up the latest samples of the workloads running now; they are null only while workloads run and none has been sampled yet. - The answer: ```json { "lifecycle": "active", "fences": [{ "workload": "…", "currentEpoch": 4 }], "heartbeatSeconds": 5, "leaseSeconds": 120 } ``` hermitboxd applies each fence as `POST …/fence` would, **then** takes the lease, so nothing the lease allows can be a copy the same answer superseded. Each fence is marked at once and carried out in the background: the next beats go out on time while a fenced copy's grace runs out. - **The execution lease** (`leaseSeconds`, counted from when the node sent the beat): while it lasts, hermitboxd may act on its own: restart a workload that failed, per its spec's policy, and resume one the host went down under (below). Without one (no answer yet in this run, or none for longer than the lease) it does neither. A node the control plane holds `lost` gets `0`. Requests carry their own authority (the epoch) and don't need the lease. A control plane that names no lease grants `restart_requires_contact_seconds`. - A control plane that doesn't answer changes nothing on the node: workloads carry on running. It only stops what the node would do unasked. - `renew: true` says the node's certificates end within the control plane's renewal window. The answer leaves `renew` out otherwise. - `upgrade: { "version": "0.3.0", "sha256": "…", "signature": "…" }` offers the node the hermitboxd the endpoint serves at `GET /fleet/v1/blocklyd`, to a node that lists `self-upgrade`; the answer leaves it out otherwise, and a node without the feature ignores it. `signature` is the release's `hermitboxd.sig` in hex: release.yml's ML-DSA-65 (FIPS 204) signature of the version and sha256, by a key only that workflow holds ([`src/upgrade/trust.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/upgrade/trust.rs) says what is signed). A node that lists `signed-upgrade` takes an offer only with a signature a key compiled into it made for that version and sha256, and only of a version no older than its own; it downloads nothing otherwise, and reports the offer failed. A control plane with no signature for its hermitboxd offers it to none of them. hermitboxd downloads it over this same mutual TLS and installs it only if its sha256 is the one offered and `--version` prints the version offered. It keeps the binary it ran as `hermitboxd.prev`, renames the new one into place under the state directory (`bin/hermitboxd`, which `/usr/local/bin/hermitboxd` links to), and exits cleanly so systemd starts it; workloads keep running. The new binary is on trial (`upgrade/trial.json`) until it has reconciled and a heartbeat is accepted, within 120 seconds; otherwise it puts `hermitboxd.prev` back and exits. One that can't start at all is put back by the unit's `ExecStopPost` (`hermitboxd.prev upgrade --exited`), and so is one still on trial 240 seconds after it started (a startup that hangs), which exits. The binary put back reports `upgradeFailed`. A download that fails for want of the control plane is tried again a minute later, while the offer stands; any other failure is reported. The control plane offers it to one node per region at a time ([operations](https://docs.hermitbox.dev/v0.2.0/operations.md#certificates-and-upgrades)). - A workload may include a `hostnameGateway` sample. Control accepts samples only for the placement's enrolled node and epoch. Optional observations share at most 256 KiB of the heartbeat's 4 MiB body after core state and any upgrade failure. When copies share the budget, the next acknowledged heartbeat resumes with the next copy. - Refusals: `400 invalid_json` (the body isn't JSON), `400 invalid_request` (a beat for another node), `401 certificate_required` (no client certificate from the fleet CA), `403 wrong_identity` (not this node's client certificate), `403 certificate_not_current` (not the node's pinned certificate), `403 retired`, `404 unknown_node`, `409 duplicate_identity`, `409 session_replaced` (a beat from a daemon run that has been replaced), `413 too_large` (a body over 4 MiB), and `500 internal`. ### `POST /fleet/v1/nodes/{nodeId}/renew` With the node's current clientAuth certificate: `{ "nodeId": "…", "csrPem": "…" }` for a **new** key made on the node. The answer is `{ serverCertPem, clientCertPem, caPem }`. - hermitboxd writes the new key and certificates as the next generation (`node-N.key`, `node-N.pem`, `client-N.pem`), checks they load and that both certificates are for the new key, then rewrites `node.json` to name generation N. That rename is the switch: a crash anywhere leaves one whole generation in use. - The API's certificate is replaced in place for new connections, and the next heartbeat uses the new client certificate. The control plane accepts the old certificate or the new one until the first beat that presents the new one, and then only the new one. - An answer naming another CA (compared as DER, as at enrollment) is refused: rotating the fleet CA re-provisions nodes. - A failed renewal keeps the current certificates and is tried again after ten minutes while the control plane still asks. A node whose certificates ended can't renew: it enrolls again with a new token ([operations](https://docs.hermitbox.dev/v0.2.0/operations.md#certificates-and-upgrades)). ## After the host restarts hermitboxd records, per workload, the boot of the host (the kernel's boot id) in which it last saw it running, and clears it once it sees it stop in that same boot. After the host restarts, a workload still marked with an earlier boot, never asked to stop, not superseded, and with an `on-failure` restart policy was running when the host went down. It reads `restarting`, and is started again once hermitboxd holds a lease (single-node: at once). A fence in the same answer wins; a node held `lost` gives the resume up, and forgets it. A restart of hermitboxd alone, in the same boot, resumes nothing: what died while it was down is reported, not restarted. A `suspended` workload's frozen process is gone with the host: after the restart it reads `stopped`, is never resumed, and a start boots it afresh on its data, with a deferred spec put in place first. A restart of hermitboxd alone leaves it suspended. ## How a control plane maps onto it A control plane keeps the node, epoch and host ports in whatever handle it issues. | Port method | Protocol | |---|---| | `ensureProvisioned(key, placement, spec)` | Choose the node, record the placement, then `PUT` the spec with the epoch and `POST start`. `RuntimeSpec` maps field for field. | | `apply(handle, spec)` | `PUT` with the handle's epoch. | | `start` / `stop` / `forceStop` | `POST start` / `stop` / `kill`, with the epoch. | | `waitRunning` | Poll `GET` until `running`. | | `exec` | `POST exec`, with the epoch. | | `snapshot` | `POST snapshots` on the sandbox's node, then `…/upload` to the archive store in the background. | | `exportSnapshot` | `…/upload` from the node while it holds the copy, else a copy within the store. | | `restore` | In place from the node's own snapshot (`{snapshot}`); elsewhere `PUT` with a new epoch on the chosen node, then `POST restore` from the archive, checked against its sha256. | | `relocate` | `POST export` from the stopped source with `exclude` (what the image remakes), then as a restore elsewhere; the old copy gets `POST fence` and `DELETE ?data=delete`. | | `goneSnapshots`, `deleteSnapshot` | The archive store and `DELETE …/snapshots/{snapshot}` on the node. | | `decommission` | `DELETE ?data=keep`. | | `destroy`, `release` | `DELETE ?data=delete`, confirmed, on every node that holds a copy. | | `observe`, `observeChanged`, `inventory` | Heartbeats, stored per node and copy: no call per sandbox. | | `endpoint(handle, port, audience)` | From the handle, which carries the node's addresses and the host ports. | | `locate` | Node, region, epoch and container name, from the handle. | | `tag` | A no-op; labels are fixed at creation. | | `prices` | A share of the node's monthly cost (its `monthly_cost_cents` label), by memory. | | `LogSource.recent` / `tail` | `GET logs?tail=N` / `?tail=0&follow=true`. | ## Format names Format v1 was first published with the `blocklyd-epoch` and `blocklyd-protocol` headers, `blocklyd.*` container labels (including `blocklyd.record`), `workload.json`, the `bk1.` token prefix and the fleet paths `/fleet/v1/enroll`, `/heartbeat`, `/renew`, `/blocklyd`, `/blocklyd.sha256`, `/blocklyd.json` and `/join.sh`. Those names, the record fields, spec digest, features and Docker daemon configuration stay until protocol v2. ## Optional store lease A host configured with store_lease.enabled announces `store-lease` in health/heartbeats after its independent cgroup watchdog passes startup checks. Other hosts do not announce it. Control first GETs `/v1/workloads/{id}/store-lease` for its fresh daemon-session identity, then may POST that endpoint with the ordinary epoch header and the additive `StoreLeaseGrant` schema before starting the copy. The grant's presigned URLs stay in memory; records and labels keep format v1 unchanged. A missing or expired grant refuses starts and exec with `409 store_lease_required`. Expiry freezes/kills the leased cgroup and reports issue `store_lease_expired`. This includes stopped/suspended placements that retain a grant for wake. See [store-lease.md](https://docs.hermitbox.dev/v0.2.0/store-lease.md) for conditional takeover, host prerequisites, fault model and maintenance behavior. The existing execution lease and all feature-off behavior remain as described above. ## Live exec A node advertising `exec-stream` accepts `POST /v1/workloads/{id}/exec-stream` with the same ExecRequest, epoch header and Idempotency-Key as `/exec`. Its NDJSON ExecEvent variants are stdout/stderr (`data`, `truncated`), exit (`code`, `timedOut`, `killed`, `durationMs`), and an error envelope for failure after headers. Validation before attachment retains HTTP errors. The Rust schema owns these shapes. `/exec` still returns its existing buffered JSON response. Both endpoints share the same idempotency cache; a cached stream replays bounded output, and concurrent callers wait for the original command. Active keys are never evicted for capacity; new keys are refused with exec_busy until room is available. Existing failure/retry semantics are unchanged: callers must inspect uncertain outcomes and never retry a command blindly. Docker output uses 16 KiB payloads with two queues of eight frames, per-stream UTF-8 decoding, and backpressure. Output retains the existing per-stream bound and truncation flags. The command timeout includes waiting for a queue and still kills the verified container process tree. Disconnecting HTTP does not cancel command containment or authorize a second execution. The v1 wire retains this endpoint. Control and SDK commands use the sandbox agent. ### Isolation selection The optional workload-spec field `isolation` accepts `container`, `gvisor`, `process`, `wasm` and `vm`. When a caller omits it, the node uses its configured default. It refuses an explicit tier it cannot serve. Both the persisted workload and its recovery label record the selected tier, including when the original request used the default. Nodes announce their configured default as `default-tier-` and each ready tier as `tier-`. Control checks the ready tier and its advertised capabilities when placing a workload. The local host document preserves its capability fields and adds `tiers`, each with state, evidence and action. `hermitboxd probe --config ` applies that configuration’s tier selection without starting compute. `hermitbox doctor` uses an owned managed configuration when it finds one. ### Tier-scoped optional capabilities A backend capability is advertised for the ready tier that provides it. For example, `tier-container:network-policy` means a ready container backend can enforce the requested network mode. Control checks the selected tier before placement and before changing the sandbox’s network. Node-wide protocol features are reported separately. The generated node OpenAPI document lists which features use tier-qualified names. --- # Machine providers Control persists an acquisition identity before contacting a vendor. 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 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 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 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. 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 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. 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. --- # Documentation **Install and connect.** [Install](https://docs.hermitbox.dev/v0.2.0/install.md) · [Hosting](https://docs.hermitbox.dev/v0.2.0/hosting.md) · [Deploy the release image](https://docs.hermitbox.dev/v0.2.0/deploy.md) · [Connect your code](https://docs.hermitbox.dev/v0.2.0/connect.md) · [Use with your agent](https://docs.hermitbox.dev/v0.2.0/agents.md) · [TypeScript SDK](https://docs.hermitbox.dev/v0.2.0/sdk/typescript.md) · [Python SDK](https://docs.hermitbox.dev/v0.2.0/sdk/python.md). **Hosts.** [Render](https://docs.hermitbox.dev/v0.2.0/host/render.md) · [Railway](https://docs.hermitbox.dev/v0.2.0/host/railway.md) · [Fly.io](https://docs.hermitbox.dev/v0.2.0/host/fly.md) · [Koyeb](https://docs.hermitbox.dev/v0.2.0/host/koyeb.md) · [Coolify](https://docs.hermitbox.dev/v0.2.0/host/coolify.md) · [DigitalOcean](https://docs.hermitbox.dev/v0.2.0/host/digitalocean.md) · [A machine of your own](https://docs.hermitbox.dev/v0.2.0/host/own-machine.md). **Using sandboxes.** [API](https://docs.hermitbox.dev/v0.2.0/api.md) · [Sandbox agent](https://docs.hermitbox.dev/v0.2.0/agent.md) · [Templates](https://docs.hermitbox.dev/v0.2.0/templates.md) · [Code interpreters](https://docs.hermitbox.dev/v0.2.0/interpreter.md) · [Desktop, browser, SSH and bucket tools](https://docs.hermitbox.dev/v0.2.0/native-tools.md) · [MCP](https://docs.hermitbox.dev/v0.2.0/mcp.md). **Isolation.** [Tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md) · [Capabilities](https://docs.hermitbox.dev/v0.2.0/compare.md) · [Host capabilities and guarantees](https://docs.hermitbox.dev/v0.2.0/host-capabilities.md) · [Process isolation](https://docs.hermitbox.dev/v0.2.0/process-tier.md) · [Kernel network policy](https://docs.hermitbox.dev/v0.2.0/bpf.md) · [Virtual machines](https://docs.hermitbox.dev/v0.2.0/vm.md) · [agentOS](https://docs.hermitbox.dev/v0.2.0/agentos.md) · [Container engines](https://docs.hermitbox.dev/v0.2.0/docker-api.md) · [Threat model](https://docs.hermitbox.dev/v0.2.0/threat-model.md). **Running a fleet.** [Architecture](https://docs.hermitbox.dev/v0.2.0/architecture.md) · [Operations](https://docs.hermitbox.dev/v0.2.0/operations.md) · [Node protocol](https://docs.hermitbox.dev/v0.2.0/protocol.md) · [Machine providers](https://docs.hermitbox.dev/v0.2.0/providers.md) · [Object-store execution lease](https://docs.hermitbox.dev/v0.2.0/store-lease.md) · [Edge client timeouts](https://docs.hermitbox.dev/v0.2.0/edge.md). **Integrations.** [Rivet and OpenOrange](https://docs.hermitbox.dev/v0.2.0/integrations/rivet.md) · [OpenOrange provider patch](https://docs.hermitbox.dev/v0.2.0/upstream/open-orange.md). **Reference.** [Measurements](https://docs.hermitbox.dev/v0.2.0/speed.md) · [Decisions](https://docs.hermitbox.dev/v0.2.0/decisions.md). --- # Interpreter and tool measurements Every cohort here has 30 validated samples, and percentiles are nearest-rank. Tier-wide latency, memory and capacity measurements are in [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md). ## Interpreter execution These samples come from one Linux x86_64 development host, through authenticated agent HTTP on loopback. Both sides use CPython 3.12.14 and the same pinned scientific wheels. The baseline launches a fresh Python process with NumPy, pandas and pyplot imported, measured directly at its supervisor without HTTP overhead, which favours the baseline. A fresh process has no kernel to reuse or restart, so those rows have no baseline. CPU and database checks ran on the same host; these are observations, not a capacity claim for a dedicated machine. | Operation | Fresh process p50 / p90 ms | Persistent kernel p50 / p90 ms | | --- | --- | --- | | Trivial `1+1` | 1237.4 / 2428.3 | 13.1 / 30.7 | | PNG chart | 1943.6 / 2733.0 | 435.8 / 559.0 | | First execution after reusing `python()` | Unavailable | 16.5 / 32.7 | | Restart and Jupyter-ready handshake | Unavailable | 3530.3 / 5345.8 | Both p90 budgets hold: trivial execution below 50 ms, a chart below 1 second. [The collector](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/examples/kernel-bench.rs) executes and validates every sample, with the same TCP_NODELAY setting as the real bootstrap. The deployment cohort runs in [the end-to-end suite](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/e2e/interpreter.e2e.test.ts), through the real control and edge. Its sandboxes request four default units (one CPU core, 2 GiB); the collector sets these explicitly, so the budgets are not attributed to an unspecified CPU quota. CI uploads every observation as `interpreter-measurements` and prints p50 and p90 in the job summary. | Operation | n | p50 ms | p90 ms | | --- | --- | --- | --- | | First run after `python()` on a warm-template clone | 30 | 5.8 | 6.2 | | Trivial `1+1`, loopback | 30 | 5.1 | 5.7 | | PNG chart, loopback | 30 | 156.4 | 162.0 | | Restart and ready handshake, loopback | 30 | 1621.3 | 1651.6 | The first-run timer starts after `python()` opens the warmed kernel; it does not measure sandbox creation. With a single default unit instead of four, the trivial loopback p90 is 81.6 ms, over the 50 ms budget. ## Native tools The native deployment suite collects warm-template create-to-first-PNG samples for the desktop and the browser through the real control and edge, at four default units (one CPU core, 2 GiB). Browser time includes starting its local deterministic page server and rendering the page. CI uploads the report as `native-tools-measurements` and prints p50 and p90 in the job summary. | Operation | n | p50 ms | p90 ms | | --- | --- | --- | --- | | Desktop warm create to first PNG | 30 | 751.7 | 774.9 | | Browser warm create to rendered-page PNG | 30 | 1859.6 | 2000.3 | These are end-to-end observations, not local X11 or standalone Chromium timings. No absolute latency budget is set for native images. The same deployment case checks desktop input and noVNC, raw SSH wake and revocation, real Mountpoint and rclone reads and writes, a read-only refusal, browser CDP, chroot denial for ordinary commands, and both SDKs. ## Startup by tool Each timer starts before sandbox creation and ends at the first validated result, through the real control and edge, including routing and kernel startup. Thirty fresh sandboxes per tool: | Operation from sandbox creation | n per collected tier | Container p50 ms | Container p90 ms | Process p50 ms | Process p90 ms | | --- | --- | --- | --- | --- | --- | | Python kernel to chart PNG | 30 | 1661.3 | 1791.5 | 10903.2 | 11443.0 | | JavaScript kernel to chart PNG | 30 | 742.6 | 796.2 | 7922.2 | 8042.6 | | Browser to rendered-page PNG | 30 | 1721.1 | 1767.4 | 8949.9 | 9028.5 | | Desktop to screenshot PNG | 30 | 739.6 | 846.3 | 8959.8 | 9056.8 | | SSH command and lease revocation | 30 | — | — | 8970.6 | 9006.4 | PNG timers end after validating the first returned image. Browser timing includes its own HTTP page-server startup. SSH timing includes writing the marker file, creating the lease, running the real OpenSSH command, observing running state and revoking the lease; it ends before sandbox deletion. There is no container SSH cohort. Percentiles use nearest ranks 15 and 27 of each sorted thirty-sample cohort. Images, templates and the native bundle are cached before timing. Each fresh process supervisor still verifies its bundle's complete inventory. Both tiers request four default units; containers enforce one CPU core and 2 GiB, while process CPU and memory guarantees are off. The tiers run on separate hosted runners, and the process tier's cohorts on three runners at once, each cohort whole on one; their report is joined only when the runners' host facts agree. The process tier runs as an ordinary installed account on x86_64 with host glibc 2.39, Landlock ABI 8 and no engine access, driven through TypeScript, the CLI and both Python SDK modes over the HTTP-only edge. On the container tier, the interpreter execution budgets hold in the same run: trivial p90 3.8 ms and chart p90 111.9 ms, with the clock points and limits of the deployment cohort above. --- # Object-store execution lease This feature is off on both host and control by default. Feature-off nodes keep the existing execution lease: a control outage prevents unasked restarts but does not stop sandboxes, and an operator supplies the fence before declaring a host lost. This object-store lease is separate. ## Host and control setup A lease host requires Linux cgroup v2 with cgroup.kill, rootful Docker's cgroupfs driver, writable cgroup controls, and a host/hypervisor that does not suspend leased execution. Drain/rest existing sandboxes before enabling it. The daemon refuses startup unless it can prepare the cgroups and start/fence a protected watchdog. Install deploy/hermitboxd-store-lease.conf as the documented systemd drop-in, reload systemd, and configure Docker's native.cgroupdriver=cgroupfs deliberately on a drained host. The ordinary unit retains ProtectControlGroups=yes. ```toml [store_lease] enabled = true non_suspending_host = true max_seconds = 60 ``` On control set HERMITBOX_STORE_LEASE=on. HERMITBOX_STORE_LEASE_SECONDS defaults to 30 and HERMITBOX_STORE_LEASE_RENEW_SECONDS to 10; the host enforces its maximum and a renewal interval below half of the usable term. Control uses its configured S3 store/runtime endpoint. At startup it probes conditional create, rejected duplicate create, conditional update, and rejected stale update. An incompatible store refuses enabled startup. Nodes must advertise store-lease in their accepted heartbeat before control sends POST /v1/workloads/{id}/store-lease with that epoch. The new request/object schemas come from Rust and are generated into the node contract. No spec, label, original record field, public API field, or format-v1 name is renamed. Grants contain presigned read/write URLs held only in memory; their Debug output omits credentials. URLs live for one day and upkeep refreshes them. A longer control outage eventually expires them and stops leased placements even if the store is reachable. Preserve the lease objects and disable bucket lifecycle rules for this prefix; no operator or external program may overwrite/delete them. ## Authority and fencing Each placement has a versioned object under deployment/store-leases/v1/workload.json, containing its node, fresh daemon session, epoch, generation and store-time expiry. Control conditionally creates/updates it before granting a node permission to run. A feature-gated GET on the same endpoint supplies the current in-memory daemon session; a restart or disk clone cannot share the prior session's live authority. The node GETs it, checks every identity field, and renews with If-Match from that GET. Failed or stale writes grant no time. A late reply cannot revive authority. HTTP Date supplies store time; CLOCK_BOOTTIME supplies local deadlines anchored before the request. The node also checks the PUT response's Date, refuses cached authority, and fences two seconds early for whole-second Date rounding and watchdog scheduling. The presigner leaves the changing If-Match header unsigned; transport and store conditional-write guarantees remain required. A protected process outside hermitboxd's service cgroup watches an stdin pipe and the boot clock. EOF, invalid input or expiry freezes the placement's parent cgroup and writes cgroup.kill, independent of Docker's API and Tokio. A root-only file lock and a preserved runtime directory serialize cgroup reuse across daemon restarts. The frozen parent prevents a Docker start that completes late from running a descendant. Starts, resumes, replacement restarts and exec need a live grant and the expected cgroup parent. Existing unleased execution is killed on enabled startup. A parent monitor also fences if the watchdog exits. Deleting or fencing a copy ends renewal. A stopped or suspended placement retains its lease for a quick wake; its request cost continues until rest/delete/fence. Graceful daemon upgrades/restarts can stop leased processes: drain/rest before maintenance. Enabled hosts latch their policy in the non-secret store-lease-mode-v1 file. Disabling is refused until an operator drains/rests every copy, waits out all published terms, and deliberately removes that marker; restoring retained data then takes a new epoch. This prevents an ordinary configuration toggle from silently starting an old leased epoch without its fence. Control never equates a network timeout with a fence. Once the store's Date passes the last published expiry, control must win a conditional overwrite with an exact fence marker. A racing renewal wins instead or loses to that marker; both cannot win the same ETag. Only then do a Postgres proof and displacement commit together. A crash between the store write and database commit is recovered by recognizing that exact generation marker. The whole node is not marked lost. Recovery uses a ready stored snapshot, excludes the prior host and takes a new epoch; missing snapshots or capacity leave the old data retained and placement displaced. Planned handoffs also wait out any remaining published term after the prior copy stops renewing. ## Fault model and limits This is an opt-in prototype for store/control partitions and daemon stalls/crashes on a trusted, non-suspending Linux host. It assumes the independent watchdog and kernel run within the reserved scheduling margin, and that the store supplies current Date plus linearizable conditional writes. It is not a hard real-time guarantee against an arbitrarily stalled kernel, a paused hypervisor, a compromised host, a live-memory VM clone, an externally killed watchdog plus daemon, or an administrator disabling containment. Whole-host suspension must stay disabled; use an external power fence before recovering such a host. non_suspending_host is an explicit host policy prerequisite, not a runtime proof of a hypervisor's behavior. Do not enable automatic lease recovery where this fault model cannot hold. No fault measurements are published for it yet. ## Request volume The steady-state renewal count is two requests (GET and conditional PUT) per interval: 720 requests per placement-hour at the default ten seconds, excluding startup, failures, signing and upkeep. Control's refresh adds two GETs per placement per minute (120 per hour), for 840 requests per placement-hour in all. These are calculations, not measurements. The watchdog and parent monitor have overhead of their own that is not profiled. ## The CI lease test CI's lease step runs after the other end-to-end suites on a disposable Ubuntu runner, switches that runner's Docker to cgroupfs, restarts its test stores, and runs: ```sh HERMITBOX_LEASE_E2E=1 HERMITBOXD_SUDO=1 HERMITBOXD_BIN=$PWD/target/debug/hermitboxd \ DATABASE_URL=... S3_TEST_ENDPOINT=http://127.0.0.1:9000 \ bun test control/e2e/store-lease.e2e.test.ts ``` It creates two real local nodes, cuts only root node traffic to a counting S3 proxy, records three 15-second renewal windows and three stop samples, asserts each stop precedes its ten-second term, conditionally fences the expired generation, and restores snapshot data on the other node under a higher epoch. A separate case stops hermitboxd with SIGSTOP and observes Docker's running state end while the daemon remains stopped. Raw counts, windows and nearest-rank p50/p90 go to JSON and the job summary. --- # Templates from code 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. `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.0/interpreter.md) and [native tools](https://docs.hermitbox.dev/v0.2.0/native-tools.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 hermitbox.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. ## A database or cache alongside a project Request `hermitbox.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. The build runs inside a sandbox. Node projects use their npm scripts and lockfile. Python projects use their `pyproject.toml` or `requirements.txt`; Django, FastAPI and Flask have starter commands. Native imports recognize Go modules, Cargo binary projects, Rack applications and PHP public document roots. Cargo honors a checked-in lockfile. Java projects use their committed Maven wrapper or a standalone `Main.java`. A configured Spring Boot plugin and launcher select its development server. .NET imports select a single executable or web project, 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Leaving the agent keeps the sandbox running until its idle deadline. `hermitbox connect ID` wakes it and opens another agent session. A disconnected terminal can be reattached with the printed process ID. `hermitbox fork ID` forks a snapshot and `hermitbox sandbox stop ID` 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 NAME` and `--sha256 DIGEST` for the sandbox architecture. --- # Threat model What hermitbox defends, against whom, where its trust boundaries are, and the invariants a change must keep. Reviewers, human or automated, use it to judge whether a change weakens hermitbox. It describes the code on `main`; each mechanism names the file that implements it. A change that moves a boundary updates this page in the same pull request and says why. ## What hermitbox protects - **The host from its sandboxes.** A workload can't read or write the host's files, credentials or other sandboxes' data, can't reach the host's own services, and can't take more memory, CPU or processes than the host admits for it. - **Sandboxes from each other.** One tenant's sandbox can't read, signal, dial or impersonate another's, through the host, the edge or a shared port. - **A sandbox's data, snapshots and secrets.** Data is never copied out through a link, a restore never damages the current data, a snapshot is never lost as the only copy, and a secret value never appears in a record, label, log, view or error. - **The fleet's control.** Only an enrolled node with its own key talks to control; only control calls a node; a copy of a sandbox never runs twice; a node runs only a signed hermitboxd. - **The public API and edge.** A credential reaches only what it was issued for, and only the edge's fronts face the internet. ## Adversaries - **Code inside a sandbox.** Assume it is fully hostile, including root inside its container or guest where the tier gives that. It controls everything in its data directory, its image, its guest kernel on the `vm` tier, and whatever its agent reports about it. - **Another tenant's sandbox** on the same node or elsewhere in the fleet. - **A network attacker** between nodes, control, edge, object store and clients. - **The holder of a leaked credential** of limited scope: a project API key, a sandbox capability, a file URL, a presigned URL, an enrollment token or the edge token. - **A malicious or tampered release or upstream artifact:** a daemon offered by a compromised control plane, a substituted bundle, an image a tenant chose. - **A request trying to relax the host's policy:** a spec or public request asking for less isolation, another image, another user, or a capability the host doesn't give. Out of scope: the host's own root, the operator and whoever holds the operator token or the fleet CA key, physical access, and bugs in the kernel itself, except where hermitbox chooses a tier because of them (the `vm` tier's own kernel; [tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md) on choosing one). ## Trust boundaries ### Sandbox and host What crosses: exec, files, logs, stats, port forwarding and the agent's own reports; the data directory, written by the workload and read by hermitboxd; images and specs. Host policy lives in the host's configuration, not in requests ([`src/config.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/config.rs)), and each backend fills every isolation setting from it. | Tier | What enforces the boundary | | --- | --- | | `container` | All capabilities dropped, no-new-privileges, never privileged, private IPC, PID limit, Docker restart policy `no` ([`src/runtime/docker/container.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/docker/container.rs)); images only from host `allowed_images` prefixes ([`src/config/validate.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/config/validate.rs)); the root-installed nftables table ([`src/isolation.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/isolation.rs)) | | `gvisor` | The container tier's settings under the engine's pinned `runsc` ([`src/runtime/docker/gvisor.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/docker/gvisor.rs), [`deploy/gvisor.json`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/gvisor.json)); never served by runc | | `process` | Landlock ABI 3 filesystem policy, required in full ([`agent/src/process_policy.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/process_policy.rs)); a seccomp filter denying mount, ptrace, bpf, namespace creation, keyrings, io_uring and UID or capability changes ([`agent/src/process_policy/filter.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/process_policy/filter.rs)); rlimits; a uid pool where the host allows it ([`src/runtime/process/journal.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/process/journal.rs)); namespaces through an unmodified bubblewrap where the host allows them ([`src/runtime/process/namespaces.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/process/namespaces.rs)); a cgroup of its own where controllers are delegated ([`src/runtime/process/resources.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/process/resources.rs)); eBPF network policy where the host allows it ([`src/bpf.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/bpf.rs)) | | `wasm` | A virtual kernel in a pinned agentOS sidecar, dropped to its own worker uid with no-new-privileges; only the explicit data mount enters the guest ([`src/runtime/wasm.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/wasm.rs), [`src/runtime/wasm/boot.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/wasm/boot.rs)) | | `vm` | A Firecracker guest with its own kernel under KVM; the monitor confined by Landlock and seccomp as an ordinary user, or by the unchanged jailer with a uid of its own per VM as root ([`agent/src/vm_monitor.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/vm_monitor.rs), [`src/runtime/vm/machine.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/machine.rs)); root VM authority only in the separate worker service ([`src/runtime/vm/worker.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/worker.rs)) | Never trusted from the sandbox side: - **Its data directory.** Every walk hermitboxd or the agent makes is descriptor-relative with `O_NOFOLLOW` at each step, refuses special files, and never leaves the directory ([`src/tree.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/tree.rs), [`agent/src/files.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/files.rs), [`src/tarball.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/tarball.rs)). - **Its guest kernel.** On the `vm` tier the host's packet helper decides every flow again, so a guest that drops its own rules gains nothing ([`src/runtime/vm/network.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/network.rs)); disks a guest wrote are checked and repaired only by confined tools on a staged copy ([`src/runtime/vm/disk.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/disk.rs)). - **Its claims about who owns a socket.** The process tier's port proxy proves the server socket belongs to the supervisor's tree from kernel evidence before sending any bytes; a shared UID or matching port is never proof ([`agent/src/process_peer.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/process_peer.rs)). - **Its private runtime state.** Process journals and agent signing keys live outside every data grant, snapshot and export ([`src/runtime/process/journal.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/process/journal.rs), [`src/manager/agent_keys.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/agent_keys.rs)). ### Sandbox and sandbox - **Containers** are kept from each other's addresses by the bridge's inter-container switch, and from each other's published ports by the nftables table ([`src/isolation.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/isolation.rs)). They share the host kernel and may share a numeric uid ([host-capabilities.md](https://docs.hermitbox.dev/v0.2.0/host-capabilities.md)). - **Process sandboxes** can't read each other's data or `/proc` (Landlock). With separate UIDs they can't signal each other. With kernel network policy, a host address reaches only the sandbox's own sockets ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)); without it they share the host's network and must be mutually trusted ([process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md)). - **Wasm sandboxes** share one sidecar, which is a shared fault domain ([agentos.md](https://docs.hermitbox.dev/v0.2.0/agentos.md)). - **VMs** each have their own kernel; as root each monitor has a uid pair no other VM holds. - **Credentials** are bound to one sandbox: a capability names its sandbox and epoch ([`agent/src/auth.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/auth.rs)); a project key's routes answer 404 for another project's ids ([api.md](https://docs.hermitbox.dev/v0.2.0/api.md)). A fork gets its own agent key, and a fork with memory reseeds its random generator from host entropy ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)). ### Sandbox and network - **Egress.** `network: none` is the boundary on every tier. Hostname policy (`egress`) runs only through gateways hermitboxd owns: a dedicated bridge and root firewall for containers ([`src/runtime/docker/egress.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/docker/egress.rs)), eBPF redirects for process sandboxes ([`src/runtime/process/network.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/process/network.rs)), guest rules plus host gateways on the `vm` tier. Address rules (`egressAddresses`) are the process tier's, with kernel policy. A tier or node that doesn't announce a policy refuses it by name; `gvisor` and `wasm` refuse hostname egress ([tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md)). - **Gateways** resolve once, refuse a name if any answer is non-public, an address of this host, or one the sandbox's rules refuse, and dial that resolution only ([`src/runtime/egress/gateway.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/egress/gateway.rs)). - **Always refused:** this host's own addresses, link-local and cloud metadata addresses, and other nodes' sandbox and API ports on private addresses ([`src/isolation.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/isolation.rs), [bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md), [vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)). - **Outbound on a sandbox's behalf.** Agent URL transfers and control's webhooks pin a public DNS answer, refuse private ones and redirects, and keep TLS verification ([`agent/src/transfer_target.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/transfer_target.rs), [`control/src/webhook-target.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/webhook-target.ts)). - **Ingress** reaches a sandbox only on ports hermitboxd published for it, from the edge or control. Never trusted from the network side: DNS answers, proxy variables in the sandbox, raw IP targets, a guest's own firewall. ### Node and control - **Mutual TLS.** The node API is TLS 1.3 only, with no 0-RTT; a client certificate must chain to the host's `client_ca`, carry `clientAuth` and name an allowed client ([`src/api/tls.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/api/tls.rs)). A node's key is made on the node and never sent ([`src/fleet/enroll.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/fleet/enroll.rs), [`src/fleet/identity.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/fleet/identity.rs)). Joining trusts the fleet CA only once it matches the token's hash ([`src/fleet/token.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/fleet/token.rs), [`src/cli/join.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/cli/join.rs)), and enrollment or renewal naming another CA is refused. Control pins each node's current client certificate and uses session ids and sequence numbers to catch two hosts sharing one identity ([`control/src/node-endpoint.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/node-endpoint.ts), [`control/src/registry.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/registry.ts)). - **Epochs and fencing.** Control raises a placement's epoch only by compare-and-set ([`control/src/ledger.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/ledger.ts)). Every mutating node verb checks it with `check_epoch` ([`src/manager/error.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/error.rs)): start, suspend, exec, export, snapshot and restore need exactly the copy's epoch; stop, kill and delete accept it or newer; a superseded copy refuses all but teardown. A fence stops a copy, keeps its data, and never starts it again ([`src/manager/fence.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/fence.rs)). A move fills the new copy before it fences the old one ([`control/src/rehoming.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/rehoming.ts)), and the edge closes connections from older epochs ([`edge/src/routes.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/edge/src/routes.ts)). - **Execution lease.** A node restarts or resumes on its own only while its last heartbeat's lease lasts ([`src/manager/fleet.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/fleet.rs), [`src/manager/restarts.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/restarts.rs)). No timer declares a host lost: an operator confirms it after fencing it outside hermitbox ([operations.md](https://docs.hermitbox.dev/v0.2.0/operations.md)). The opt-in object-store lease adds a watchdog that freezes and kills a leased cgroup when its term ends, and control displaces a copy only after winning a conditional fence in the store ([`src/store_lease/guard.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/store_lease/guard.rs), [`control/src/store-lease.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/store-lease.ts), [store-lease.md](https://docs.hermitbox.dev/v0.2.0/store-lease.md)). - **Never trusted from control:** a request for weaker isolation than host policy, an image outside `allowed_images`, an unannounced field (refused with `422`), or an upgrade that fails the checks below. Control decides what runs; it can't decide how weakly. - **Never trusted from a node:** a heartbeat for another node, a certificate that isn't that node's pinned one, or observations for a placement it doesn't hold ([protocol.md](https://docs.hermitbox.dev/v0.2.0/protocol.md)). ### Edge, sandbox and client - **Edge to control** uses the private `/edge/v1` with a bearer edge token compared in constant time ([`control/src/edge-api.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/edge-api.ts)). - **Sandbox capabilities** are `pa1.` tokens the node signs with Ed25519. They name one sandbox, one epoch and a scope (`sandbox`, `routes` or `file`), live at most five minutes with 30 seconds of clock skew ([`agent/src/auth.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/auth.rs)), and the edge verifies them offline before any wake ([`edge/src/sandbox-token.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/edge/src/sandbox-token.ts), [`edge/src/sandbox-proxy.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/edge/src/sandbox-proxy.ts)). A route-only capability can list port assignments but can't run commands or read data; a file URL is one path and one method for at most a minute ([agent.md](https://docs.hermitbox.dev/v0.2.0/agent.md)). The project key never reaches a sandbox. - **Client to API.** A project key is a bearer key stored only as its SHA-256 ([`control/src/keys.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/keys.ts)), and reaches only its own project. The operator API listens apart, on loopback by default, behind the operator token ([`control/src/operator-api.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/operator-api.ts), [`control/src/config.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/config.ts)). Authenticated requests are audited before they change state, without headers, bodies or query strings ([`control/src/audit.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/audit.ts)). - **The edge** binds its public fronts on purpose ([`edge/src/config.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/edge/src/config.ts)); its metrics stay on loopback. It terminates TLS only for agent and exposed-port hostnames; ordinary TLS routes pass through untouched. ### Releases, joins and bundles - **Upgrades** ([`src/upgrade/trust.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/upgrade/trust.rs)). Before anything is downloaded, a node checks that the offered version is `MAJOR.MINOR.PATCH` and no older than its own, and that the offer carries an ML-DSA-65 signature (FIPS 204), by one of the public keys compiled in from [`deploy/release-keys.pem`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deploy/release-keys.pem) (a release key and a recovery key), over exactly `hermitboxd release`, the version and the lowercase sha256, one per line. It then keeps the download only if its sha256 matches and it prints the offered version, and rolls back if it doesn't reconcile and beat in time ([`src/upgrade.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/upgrade.rs)). Only a debug build also takes the key `HERMITBOXD_TEST_RELEASE_KEY` names. A control plane or its fleet CA can pass a signature on but can't make one. - **Joins and installs.** The CLI verifies the fleet bootstrap and the server asset manifest with the same compiled keys; the fleet CA authenticates transport only ([`cli/src/join-trust.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/cli/src/join-trust.ts), [`cli/src/bundle-trust.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/cli/src/bundle-trust.ts)). Preview builds carry a separate identity that can't replace production keys ([install.md](https://docs.hermitbox.dev/v0.2.0/install.md)). - **Pinned upstream.** The VM descriptor comes from the signed installation, never a workload, and pins its bundle by size, SHA-256 and a per-file inventory checked before any program runs ([`src/runtime/vm/policy.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/policy.rs), [`src/runtime/vm/bundle.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/vm/bundle.rs)). The agentOS distribution is checksum-pinned ([`src/config/wasm.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/config/wasm.rs)); gVisor and bubblewrap are pinned releases; Rust dependencies are locked and checked by [`deny.toml`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/deny.toml). - **Tenant images** are untrusted input: allowed only by host prefixes, and on the `vm` tier each layer is checked against its digest and converted by confined tools ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)). ### Storage and object store - Exports and snapshots go to presigned URLs, used once and never logged or stored; their query strings are redacted wherever they are printed ([`src/protocol/transfer.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/protocol/transfer.rs)). - A restore is checked against the sha256 control recorded, unpacked with links, devices and traversal refused, assembled in `data.restoring/` and swapped in whole ([`src/store/restore.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/store/restore.rs), [`src/tarball.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/tarball.rs)). - The store lease trusts the store's `Date` and linearizable conditional writes, and nothing else ([store-lease.md](https://docs.hermitbox.dev/v0.2.0/store-lease.md)). Archive contents are never trusted. ## Invariants a change must keep 1. **A request never relaxes the host's hardening.** Capabilities, mounts, images, users, network rules and limits come from host configuration ([`src/config.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/config.rs)); a request can't remove a deployment requirement ([`control/src/public-model.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/public-model.ts)). 2. **A requested isolation or capability is given or refused, never weakened in silence.** A named tier is never substituted, and a mutation is never retried on another tier ([`src/runtime/router.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/runtime/router.rs), [`src/manager/tiers.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/tiers.rs)); required features are checked on create and on an unchanged wake ([`control/src/workload-capabilities.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/workload-capabilities.ts)); unannounced guarantees read false ([`control/src/guarantees.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/guarantees.ts)). 3. **No walk follows a link** out of a sandbox's data ([`src/tree.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/tree.rs)). 4. **No secret value in a record, label, log, view or error.** Secret values have no `Debug` and never enter the spec digest ([`src/protocol/spec.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/protocol/spec.rs)); control seals them at rest ([`control/src/sealed-secrets.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sealed-secrets.ts)); signing keys stay out of records and responses ([`agent/src/auth.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/auth.rs)). 5. **No listener on a public address unless it is meant to be.** An unauthenticated listener may bind only loopback or a private address (`private_or_loopback` in [`src/config.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/config.rs)); workload ports are private; the edge's fronts are the intended public ones. 6. **Certificate checks are never loosened.** mTLS stays TLS 1.3 with client certificates, and no HTTPS call turns off certificate or hostname verification. The one unverified fetch, the fleet CA at join, is checked against the token's hash before anything uses it. 7. **A mutating verb checks the epoch** through `check_epoch`. 8. **A restore never touches current data before it is whole.** 9. **A snapshot's deletion never drops the only copy.** Rest uploads before it releases local data and keeps it if the upload fails ([`control/src/sandboxes.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/sandboxes.ts)); a node's local snapshots upload before its copy is deleted ([`control/src/transfers.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/transfers.ts)); a template's snapshot can't be deleted while a version uses it. 10. **Verbs that aren't safe to repeat aren't retried.** Node verbs are idempotent and exec takes an `Idempotency-Key` ([`src/manager/exec.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/manager/exec.rs)); an exec with an uncertain outcome is never replayed ([`control/src/operations.ts`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/control/src/operations.ts)); a container start whose answer timed out is inspected, never repeated ([tiers.md](https://docs.hermitbox.dev/v0.2.0/tiers.md)). 11. **Copyleft code is never linked.** `deny.toml` admits permissive licences; GPL and LGPL programs run as separate executables; every licence is in [decisions.md](https://docs.hermitbox.dev/v0.2.0/decisions.md) before use. 12. **Only signed hermitboxd runs on a node,** and never an older one (`src/upgrade/trust.rs`). ## Known limits and accepted risks - **The process tier shares the host kernel.** A kernel escape from a process sandbox escapes its enclosing container. In the plain mode it has no PID, mount or network namespace. - **Shared-UID process sandboxes** (an ordinary-user install) share per-UID limits and may signal each other and same-user services. Use them only for mutually trusted work; creation can require `separate-users`. - **Without kernel network policy,** Internet-enabled process sandboxes can dial the host's and neighbours' listeners, separate UIDs or not. An Internet-enabled process sandbox never has `private-network`. - **Without delegated cgroups,** process memory is a sampled budget, not a hard cap. - **Wasm** shares one sidecar with no per-VM CPU rate; host service limits bound it as a whole. - **Containers** share the host kernel; rootless Docker is refused at `data-owner-mapping`; Podman has no host firewall. - **The `vm` tier** needs x86_64 and KVM that hermitboxd's user can open. Elsewhere it is off and a `vm` request is refused. A move between two VM nodes is untested ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)). - **The store lease** is an opt-in prototype with stated assumptions, not a hard real-time fence. Without it, failover waits for an operator's confirmed fence. - **A compromised fleet CA** cuts nodes off until each re-enrolls; dual CA trust isn't implemented. - **The edge sees agent and exposed-port traffic in clear,** since it terminates that TLS. - **Not post-quantum today:** release, bundle and join signatures are ML-DSA-65, but sandbox capabilities are Ed25519; the node mTLS key exchange uses rustls's ring provider, whose groups are X25519 and NIST curves ([`src/tls.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/src/tls.rs)); public WebPKI certificates and SSH host keys (Ed25519, [`agent/src/tools/ssh.rs`](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/agent/src/tools/ssh.rs)) are classical too. ## Reporting Report a weakness privately, as [SECURITY.md](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/SECURITY.md) says. Don't open a public issue. --- # Sandbox tiers | Tier | Runs | Needs | | --- | --- | --- | | `process` | Native commands as your user | Nothing extra | | `wasm` | agentOS registry packages | Nothing extra | | `container` | Images | Docker or Podman | | `gvisor` | Images, under gVisor | Docker with gVisor's `runsc` | | `vm` | amd64 images with their own kernel | x86_64 with KVM | A request that names a tier gets it, or a refusal that says what the host is missing. A node with `runtime = "auto"` serves every backend its measured host capabilities permit. Container, VM, process and Wasm workloads can coexist under one capacity and reservation ledger. Each workload keeps its chosen tier for its lifetime and reports that tier's guarantees. A named unavailable tier is refused; it is never substituted. For an unnamed request, control chooses container, then VM, then process, then Wasm among healthy nodes that meet `require` and accept the supplied source: images need containers or VMs, image-free requests use process or Wasm, and package requests need Wasm. Snapshots and templates retain their saved tier. The [VM tier](https://docs.hermitbox.dev/v0.2.0/vm.md) needs working KVM, ordinary-user monitor confinement and the signed installation's immutable bundle descriptor; hermitboxd running as root serves it through its separate VM worker. Its measurements are [below](#vm-tier-measurements). `HERMITBOX_DEFAULT_ISOLATION=process` fixes one tier; a comma-separated list changes the priority. Local installations retain this preference across user-manager restarts and upgrades. The image and local installations use auto mode by default. Without an engine, the usual first choice is **process**, with Wasm available alongside it. Set `HERMITBOX_RUNTIME` to `container`, `process` or `wasm` to serve only that backend. Local installations save the selected runtime for restarts and upgrades. Both doctors list enabled tiers and reasons for those that are off. Each workload records its chosen tier at creation and keeps it across restarts. A missing record can be rebuilt from its runtime label. An unreadable record stays on disk, and the node reports it for repair. Each measurement table below states its own runner, path and conditions. Tables from different runners or paths sit beside each other; their numbers are not directly comparable. ## Rootless engine measurements Measured on an x86_64 Ubuntu 24.04 hosted runner. Podman is the pinned Ubuntu `4.9.3+ds1-1ubuntu0.2` package, with vfs storage and no delegated controllers. Each fresh workload reserves 256 MiB for admission and explicitly accepts missing memory enforcement; CPU, PID and memory-sleep limits are off. The same run checks nonzero identity, readonly root, zero kernel capabilities, PID and network separation, HTTP ingress, snapshot and fork retention, stop and wake, and bounded exec-tree cancellation. A separate private-network case checks published ingress, no default route and denied external egress, after an internet-mode canary first shows the target is reachable. These are **direct node-manager measurements**. They include neither the public API nor the edge, and do not replace the public-edge cohorts and budgets below. All 30 serial samples use a locally available image and a new workload identity. Create includes ensure and start; exec runs `true` after writing the service's data file outside the exec timer; network is one HTTP request through the engine's published loopback port, returning that file. Image pulling, strict deletion and installer startup are outside these timers. Percentiles use nearest rank. A failed collection keeps its partial sample count and cannot report completion. | Engine and host context | Completed samples | Create ms p50 / p90 | Exec ms p50 / p90 | HTTP round trip ms p50 / p90 | | --- | ---: | ---: | ---: | ---: | | Rootless Podman, ordinary runner user | 30 | 2247.29 / 2472.42 | 75.68 / 265.73 | 3.07 / 3.20 | | Standard rootless Docker 29.9.2 mapping | 0 | Unavailable | Unavailable | Unavailable | The standard Docker mapping cannot expose daemon-owned data to the required nonzero sandbox user: default and host namespaces deny the write, keep-id is unsupported, the engine has no bind ID-map option and a kernel ID-mapped bind does not attach. It refuses `data-owner-mapping` before data or compute, while other tiers remain available; an engine whose map gives the workload the data owner's identity (Podman keep-id, or a rootless daemon mapped so) turns it on. On rootless Docker, `network: "none"` uses no bridge: the container gets Docker's `none` network (loopback only), and the node reaches its declared ports through the engine's exec attachment, by the protected static agent injected at create. `network-policy` is announced only where that agent is installed; elsewhere `network: "none"` is refused by name before data or compute. The transport is tested on hosted standard rootless Docker without sandbox data: TCP with half-close, UDP, an undeclared port refused, no address or default route, host loopback and a neighbour unreachable, helper retirement and owner adoption after a restart. On standard rootless Docker, every sandbox is still refused at `data-owner-mapping` first, so no sandbox there reaches this path yet. Podman uses native published ingress for internal bridges. Rootless memory/CPU guarantees require both engine support and an enforced limit observed on that sandbox copy. Nodes announcing `observed-resource-limits` include the copy's guarantees in heartbeats; the public API uses the report matching its node and placement epoch. Missing observations keep these guarantees off. A controller enabled later therefore leaves an older unlimited copy's limits off until a configured replacement is observed. Placement still uses the node's available capabilities, and legacy/rootful reporting retains its existing contract. ## Comparison method `control/bench/tiers.ts one-box|image output-prefix` runs all three tiers from the same release source and build profile on the same runner. Container and process are the reference cohorts and wasm is the added candidate. Both CI jobs upload their measurement summaries, on failure too. Each requested latency and incremental memory cohort has 30 samples; nearest-rank p50 and p90 are computed from every successful sample, with partial counts retained on failure. Concurrent admission records all 30 attempted waves, including capacity refusals; only waves that admit all 50 enter the full-50 latency and memory percentiles. Cold creation uses a new sandbox identity, no template and a locally available runtime image. It includes API admission and running acknowledgement. `true` and `echo hi` use the real agent through the edge. Cold and 50-way cohorts use an explicit common 256 MiB / 100 CPU-millis unit; hot and package cohorts use two units, 512 MiB / 200 CPU-millis. These measurement configurations are not a capacity claim or a replacement for the product's normal unit defaults. A declared 2× CPU admission overcommit lets fifty idle 100-CPU-millis sandboxes fit the four-core runner; the reports record it. Node memory capacity uses the actual host with its normal reservation; fifty idle sandboxes request 12,800 MiB on the observed 16 GiB-class runner. Enforcement differs: container uses cgroups, process uses a cgroup of its own where the host delegates one and native limits and priority otherwise, and wasm uses virtual heap/process bounds in a shared worker without a per-VM CPU-rate quota. Equal requests do not imply identical host enforcement. Each shell emits a validated readiness marker before its memory sample. The node baseline is refreshed after each deletion, while its initial fixed overhead is recorded separately. Memory is proportional resident memory from Linux `smaps_rollup`, in bytes, including the node's process tree and container workload trees. Reports distinguish fixed node memory from incremental idle, shell and 50-sandbox memory. The ordinary-image tree includes embedded services, so its fixed overhead is not a per-VM claim. Shared executable pages count once proportionally; retained allocator pages and host noise remain in the samples, including negative incremental readings. Absolute idle and running-shell context PSS are retained too: Wasm disposal can release a prior shell's heap during the next sample, making its paired increment negative. Such a delta is not a negative per-VM footprint. Absolute context PSS includes the fixed node/services and retained allocator memory, rather than attributing every resident page to the one active VM. The 50-way latency ends when every creation reports running; its memory read and deletion are outside that latency timer. Every wave issues all 50 requests without retry or downsizing. After all responses settle, `concurrentCapacity` records the requested count, confirmed running count, refused count, elapsed time, baseline and current context PSS, paired PSS delta, and each refusal's code, HTTP status, message and count, **before deleting any successful creation**. A structured SDK `no_room` response produces `capacity_refused`; the tier's final status is `capacity_limited` if any wave is refused. This is a successful measurement. Later waves and tiers still run. Partial waves do not count as full-50 latency successes. All other creation errors, invalid running results, missing memory readings and failed cleanup remain fatal. The public API also uses `no_room` for unavailable admission, so a refusal is an observed admission result, not proof that physical RAM alone set the limit or that the fitted count is a universal maximum. After the checkpoint, teardown deletes every admitted sandbox once, in sequence, outside the creation timer and memory reading. All fifty creation requests remain concurrent. Teardown does not add a second fifty-way mutation load; every delete is attempted and any failure is fatal, without retry. Raw failures retain nested SDK phase/status/code/public-message evidence while omitting request details, private error text and stacks. The one-box and ordinary-image jobs upload these raw records and append every wave's running/refused counts, memory and refusal to their GitHub job summaries, including on failure. The one-box collector reuses its node across all thirty 50-way batches. Its temporary listener pool is derived below the host kernel's ephemeral range so outgoing connections cannot race listener allocation. It has 2,048 ports and retains the normal ten-minute quarantine, allowing all 1,500 concurrent-cohort creations plus scalar cohorts without immediate port reuse. The ordinary-image collector prepares a fresh context outside each 50-way timer on all three tiers: the product's unchanged ten-minute port quarantine and thousand-port pool cannot immediately reuse ports for 1,500 creations. Image startup and baseline memory sampling are outside this creation timer; each sample still creates fifty sandboxes at once. New image state likewise chooses a thousand-port pool below the kernel's outgoing range; stored explicit and legacy implicit pools remain stable across restarts. The ordinary-image comparison supplies an explicit bounded edge profile: 64 simultaneous greetings per address, a burst of 128 connections and 64 new connections per second. This admits the fifty-client experiment without disabling any guard. Default/forced-Wasm goal cohorts retain the normal edge limits. Raw reports identify the comparison profile. A container start whose answer times out is inspected once, and counts as started only if Docker reports the container `Running`; start is never repeated. Other states and errors remain failures. Snapshots and forks use exactly 100,000,000 bytes of repeated byte 42, validated before capture and after fork. This compressible fixture measures the same workload on each tier; it is not an incompressible-data throughput claim. Snapshot timing ends at the API acknowledgement of local capture; background object-store upload is not a remote-durability timing. Each package installation uses a fresh sandbox prepared outside its timer. Native pip installs `peppercorn==0.6` into a new target and verifies its import path, version and behavior. The wasm micropip shim lacks `--target`, so it installs into a fresh VM after an assertion that the package is absent; creation, that assertion, import verification and deletion are outside the install timer. The sidecar resolves npm's CLI from the operator's host PATH; the image includes that userland. Npm installs `is-number` at version 7.0.0 with scripts disabled and verifies its behavior. Commands and exact package versions are recorded in the collector source. An unavailable tool has an explicit n=0 reason, never an invented timing or a passing test. The no-engine process and wasm image cohorts use ordinary `docker run` without privileged mode, added capabilities, security options, a Docker socket or host mounts. A container sandbox requires an engine; its reference runs on the same runner's host node and is explicitly marked as that different topology. A container tier inside an engine-free image is unavailable. `control/bench/tiers-default.ts` measures the actual image without a tier override, and a separate invocation measures the forced wasm candidate. Both use normal product resource defaults and record 30 SDK create-to-hello samples plus 30 compiled `hermitbox run -- echo hello` samples separately. It also records create acknowledgement and first-byte components; whole-command timings include waiting for exit, and CLI totals include cleanup. The 100 ms create-to-output target is assessed separately below; it is missed on both candidates. These are fresh sandboxes, without a pre-created VM or warmed command. ### Capacity refusal One Wasm wave on a single local host shows the refusal path end to end: | Context / tier | Waves | Requested | Confirmed running | Refused | Baseline PSS MiB | PSS before cleanup MiB | Delta MiB | Refusal | | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- | | Local host / Wasm | 1 | 50 | 31 | 19 | 80.84 | 150.37 | 69.53 | 19 × HTTP 503 `no_room`: "No node can complete this request" | All 50 responses settled in **128,992.20 ms**. The outcome is `capacity_refused`, the final report status is `capacity_limited`, cleanup completed and the collector exited **0**. The 31 running sandboxes were still present when memory and refusal were checkpointed. This partial wave contributes **zero full-50 latency samples**. Its admitted count describes this observation, rather than establishing a physical memory ceiling or a runner-independent maximum. This node had no prior workload or retained allocator history, so its PSS is not comparable with the reused-node CI memory below. Neither set of totals measures memory per VM. ## gVisor tier and the namespaced process mode The server preset installs the pinned static release agent automatically. An independently configured gVisor agent must also be a static ELF; a GNU debug build with an image-controlled loader is refused. The node keeps a digest-named execute-only copy outside sandbox data, so Linux and gVisor protect its memory and descriptors before the process becomes visible. An exec's successful cleanup is authenticated. An exec runs to its own end even when its caller goes away; one that ends without that authenticated cleanup, or still runs 30 seconds past its deadline, retires that same sandbox run, and a lost engine answer or output stream is reported without a kill, since the agent inside keeps the deadline. An earlier exec can never retire a later stop/start generation. Node exec removes the agent's bootstrap variables and preserves ordinary workload variables. Async work belongs to the agent's process API; a completed node exec retains no detached descendants. The `gvisor` tier is the container backend with the engine's gVisor `runsc` runtime (release 20261109.0, Apache-2.0, deploy/gvisor.json): the same images, limits, ports, bridge and firewall, served beside containers wherever the engine lists `runsc`. A request naming `container` is never run by runsc and one naming `gvisor` never by runc. Each sandbox runs on gVisor's own kernel, not the host's (`uname -r` differs; `own-kernel` stays a VM's). What gVisor can't do as a container does is handled or refused by name: a node exec's deadline is kept inside the sandbox by the injected agent (`hermitbox-agent exec-deadline`), and only an agent-less workload's exec past its deadline is refused (`exec-timeout`); hostname egress policies are refused (Docker's embedded resolver is unreachable from gVisor's network stack); host FUSE devices are never mapped into it. Its syscall-heavy figure below is the systrap platform's cost per system call: runsc already runs with directfs, the rootfs overlay and systrap's fast path, its documented defaults. Every tool and interpreter template (the Python and Node kernels, the browser, the desktop and SSH) runs on it, the browser with its own sandbox off and reported off, as in a default Docker container. The namespaced process mode is a guarantee, not a tier ([process isolation](https://docs.hermitbox.dev/v0.2.0/process-tier.md)): a `process` request gets whichever mode the host gives and reports it. Thirty samples each, nearest-rank p50 / p90 in milliseconds, on one x86_64 Ubuntu 24.04 hosted runner, host kernel 7.0.0-1014-aws; gVisor's sandboxes report 4.19.0-gvisor. They are **direct node-manager measurements**, without the public API or the edge, so they sit beside each other, not beside the public-API cohorts on this page. Container and gvisor run alpine 3.22 on the runner's Docker 28.0.4, gvisor through runsc release-20261109.0 on its systrap platform; their exec is a node exec (Docker's). The process rows run the real agent, whose exec is the agent's own: namespaced on the runner, after the AppArmor profile `hermitbox doctor` printed for its helper, and plain inside a default `docker run` of Ubuntu 24.04 as root. Create is ensure and start until running; syscall-heavy is `dd if=/dev/zero of=/dev/null bs=1 count=200000`; the stream is 256 KiB of command output back through the exec path; the transfer is 16 MiB read from the workload's published port (process sandboxes have none with network none). | Tier or mode | Create | Exec `true` | Syscall-heavy | 256 KiB exec stream | 16 MiB transfer | | --- | ---: | ---: | ---: | ---: | ---: | | Container | 124.66 / 129.52 | 28.10 / 51.33 | 217.90 / 279.85 | 27.70 / 68.43 | 8.89 / 9.84 | | gVisor | 128.38 / 135.60 | 42.39 / 114.04 | 5,762.68 / 5,893.10 | 21.23 / 83.14 | 71.38 / 76.64 | | Process, plain (default `docker run`) | 21.10 / 21.63 | 4.71 / 4.82 | 65.99 / 66.70 | 18.42 / 19.07 | — | | Process, namespaced | 15.97 / 16.46 | 5.69 / 5.89 | 70.61 / 71.39 | 19.16 / 19.72 | — | gVisor's systrap platform makes each system call a trap into its own kernel: the 400,000 one-byte reads and writes cost about 26 times what they cost a container, and the published-port transfer about 8 times, while start and an exec cost about the same. The namespaced process mode costs nothing measurable over the plain one at start and about 1 ms an exec; its system calls are the host kernel's own. ## Capabilities | Capability | Container | gVisor | Process | Process, namespaced | wasm | vm | | --- | --- | --- | --- | --- | --- | --- | | Arbitrary image | Yes | Yes | No | No | No; explicit 422 image problem | `linux/amd64` images, pulled without a daemon | | Native Linux binaries | Image architecture | Image architecture, on gVisor's kernel | Host architecture and policy | Host architecture and policy | No; compatible WASM software | The image's, on the guest kernel (x86_64) | | Python | Install in image | Install in image | Bundled CPython | Bundled CPython | Embedded Pyodide | Install in image | | Node | Install in image | Install in image | Bundled Node | Bundled Node | Embedded V8 compatibility runtime | Install in image | | Shell | Static agent fallback | Static agent fallback | Static agent shell | Static agent shell | Verified agentOS coreutils shell | The image's shell | | Isolation | Shared host kernel, namespaces and cgroups | gVisor's user-space kernel inside the container's namespaces and cgroups | Landlock, seccomp, process groups; dedicated UIDs when root; shared host network, policed in the kernel where `kernel-network-policy` is on, otherwise mutually trusted Internet workloads | The same Landlock, seccomp and limits inside its own user, mount, PID and IPC namespaces, a private /tmp, and its own empty network for network none; otherwise the host's network, policed as the plain mode's | Virtual kernel, WebAssembly and V8; shared unprivileged sidecar | Its own kernel on KVM; Firecracker monitor under Landlock and seccomp as an ordinary user; own network stack or none | | Kernel per sandbox | No | gVisor's own kernel per sandbox; not a guest kernel | No | No | No native kernel; a virtual kernel per VM | Yes, Linux 6.18.56 in each guest | | CPU enforcement | Per-sandbox cgroup quota and weight | The container's cgroup quota and weight | Where hermitboxd's cgroup is delegated, the sandbox's own cgroup quota (`cpu-limit`, [process-tier.md](https://docs.hermitbox.dev/v0.2.0/process-tier.md#limits)); elsewhere admission reservation and best-effort nice, a ceiling refused; weights refused | As the plain process mode | Admission reservation; hard CPU limits/weights refused | Whole vCPUs, the guest's size; fractions and weights refused | | Sleep retains files | Yes | Yes | Yes | Yes | SQLite root and explicit persistent data mount | Yes, its ext4 disk | | Egress policy | Bridge firewall (`host-firewall` with root's firewall loaded); hostname egress through host gateways | The container's bridge firewall; hostname egress refused | Where `kernel-network-policy` is on (root, the server preset's unit included, or CAP_BPF and CAP_NET_ADMIN with a delegated cgroup): per-sandbox cgroup programs give `host-firewall`, hostname egress, address rules and, from other machines, only the published ports ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)); elsewhere only `network: none` | As the plain process mode, the same programs on its cgroup | `network: none`; hostname egress refused | Guest firewall and host-owned gateways ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md)) | | Application ingress | TCP/UDP according to host policy | TCP/UDP according to host policy; no hostname egress policy | Host TCP according to policy | Host TCP according to policy; none with network none, whose agent answers on listeners the node passes in | HTTP over TCP; no UDP, raw TCP, TLS passthrough or app WebSockets | Declared TCP through host-owned relays; UDP refused | | Sleep retains processes and terminals | Frozen container | Frozen sandbox | Its cgroup frozen where it has one, else a suspended process group | As the plain process mode | No; VM is disposed and recreated | As an ordinary user, yes: the guest's memory is written beside its disk and restored on a host of the same class; otherwise the guest stops and boots again | agentOS 0.4.7 has no per-VM suspend operation in its published client. Suspending its shared sidecar would pause unrelated sandboxes, so it cannot implement sleep that retains processes. The additive `memory-sleep` guarantee is false on this tier; data sleep still works. The collector records that unsupported alternative with n=0 and measures disposal plus recreation with filesystem validation instead. ## Complete comparison Every tier completes every requested cohort, including thirty verified pip installs, thirty verified npm installs and thirty batches of fifty creations. | Runner | CPU model | Visible cores | RAM bytes | Kernel | Bun | | --- | --- | ---: | ---: | --- | --- | | one-box | AMD EPYC 9V74 80-Core Processor | 4 | 16,760,348,672 | 7.0.0-1017-azure | 1.4.4 | | image | AMD EPYC 7763 64-Core Processor | 4 | 16,760,344,576 | 7.0.0-1017-azure | 1.4.4 | Each context compares all three tiers sequentially on its own single runner. The two contexts use separate runners; cross-context differences are not attributed solely to the deployment. All six use the same release daemon build. The one-box release image and the ordinary image contain the same checksum-pinned agentOS 0.4.7 distribution described in [agentos.md](https://docs.hermitbox.dev/v0.2.0/agentos.md). Resource requests, enforcement differences, context resets, port quarantine and the bounded comparison gateway profile are specified above and in each summary. ### One-box services All cells are p50 / p90; every requested cohort has n=30. | Latency (ms) | Container | Process | Wasm | | --- | ---: | ---: | ---: | | Cold create to running | 700.59 / 982.53 | 803.10 / 833.25 | 1,922.30 / 1,986.85 | | Agent true | 1.44 / 1.59 | 1.78 / 1.85 | 434.69 / 446.06 | | Echo first byte | 1.43 / 1.68 | 1.63 / 1.81 | 421.10 / 429.65 | | Sleep then wake | 417.39 / 1,000.66 | 887.07 / 992.57 | 994.51 / 1,034.36 | | Snapshot 100 MB | 665.22 / 1,232.55 | 568.88 / 988.59 | 686.02 / 923.79 | | Fork 100 MB | 772.08 / 1,730.24 | 941.49 / 955.35 | 1,087.66 / 1,136.90 | | pip install | 1,494.94 / 1,520.58 | 573.22 / 584.50 | 3,659.82 / 4,041.77 | | npm install | 2,464.77 / 2,515.95 | 416.03 / 439.78 | 4,971.42 / 5,194.99 | | 50 concurrent to running | 5,085.35 / 6,110.38 | 2,646.52 / 3,082.58 | 68,308.21 / 85,753.49 | | Memory (MiB) | Container | Process | Wasm | | --- | ---: | ---: | ---: | | Idle context PSS | 18.30 / 18.38 | 18.80 / 18.80 | 334.44 / 368.13 | | Idle paired PSS delta | 5.21 / 5.25 | 6.19 / 6.20 | -39.60 / -39.28 | | Running-shell context PSS | 21.14 / 21.24 | 19.29 / 19.29 | 426.45 / 464.48 | | Running-shell paired PSS delta | 8.07 / 8.11 | 6.68 / 6.69 | 49.90 / 64.04 | | 50-sandbox context PSS | 52.79 / 52.87 | 54.18 / 54.28 | 679.56 / 683.75 | | 50-sandbox paired PSS delta | 37.29 / 37.42 | 39.84 / 39.91 | 2.44 / 5.57 | Fixed context PSS (n=1, MiB): container 11.56, process 10.77, wasm 64.84. ### Ordinary image All cells are p50 / p90; every requested cohort has n=30. | Latency (ms) | Container | Process | Wasm | | --- | ---: | ---: | ---: | | Cold create to running | 629.19 / 653.16 | 777.98 / 786.75 | 1,791.04 / 1,817.37 | | Agent true | 1.96 / 2.06 | 2.70 / 2.84 | 466.69 / 472.86 | | Echo first byte | 1.90 / 2.38 | 2.55 / 2.95 | 452.86 / 462.80 | | Sleep then wake | 600.61 / 1,026.34 | 819.61 / 1,025.14 | 980.40 / 1,029.71 | | Snapshot 100 MB | 388.85 / 440.72 | 241.74 / 248.19 | 461.73 / 471.22 | | Fork 100 MB | 738.72 / 771.98 | 961.51 / 985.50 | 1,000.84 / 1,044.90 | | pip install | 2,055.52 / 2,172.08 | 564.06 / 694.86 | 4,969.76 / 5,127.07 | | npm install | 3,261.74 / 3,316.12 | 569.64 / 584.98 | 6,565.43 / 6,825.03 | | 50 concurrent to running | 7,116.82 / 7,146.71 | 1,915.59 / 2,905.34 | 68,769.87 / 70,949.82 | | Memory (MiB) | Container | Process | Wasm | | --- | ---: | ---: | ---: | | Idle context PSS | 20.14 / 20.16 | 333.51 / 339.76 | 654.07 / 694.60 | | Idle paired PSS delta | 5.20 / 5.21 | 6.80 / 9.36 | -40.11 / -37.91 | | Running-shell context PSS | 22.99 / 23.07 | 334.08 / 339.83 | 742.80 / 798.99 | | Running-shell paired PSS delta | 8.03 / 8.13 | 7.35 / 8.95 | 50.93 / 68.91 | | 50-sandbox context PSS | 53.34 / 53.40 | 429.88 / 433.31 | 548.85 / 555.47 | | 50-sandbox paired PSS delta | 39.92 / 39.98 | 118.86 / 123.59 | 182.72 / 195.10 | Fixed context PSS (n=1, MiB): container 13.43, process 307.57, wasm 365.40. ## VM tier measurements `deploy/vm-installed-measurements.ts` collects these on a hosted `ubuntu-24.04` runner with KVM, as the signed ordinary-user installation's own user, after that installation's VM acceptance passes. Each cohort uses the public API and the real agent, the first pinned image (Alpine 3.24.4) already cached with the VM bundle, one unit, the default network and n=30. The 100 MB snapshot and fork use the same fixture as the other tiers. Memory is the installation's whole supervisor tree's PSS, VM and packet helpers included, with the increment over the baseline sampled before each create. No start failed. | Measurement, installed ordinary-user VM | p50 / p90 | | --- | --- | | Cold create to running (ms) | 1,353.56 / 2,128.79 | | Create to first output (ms) | 1,616.82 / 2,395.14 | | Agent `true` (ms) | 44.28 / 47.89 | | Wake from sleep (ms) | 1,507.54 / 1,594.81 | | Snapshot 100 MB (ms) | 1,656.97 / 1,690.15 | | Fork 100 MB (ms) | 2,458.16 / 2,529.85 | | Idle context PSS (MiB) | 554.45 / 555.79 | | Idle paired PSS delta (MiB) | 131.61 / 131.91 | The context PSS is the installation's whole supervisor tree (control, edge, node, every VM and packet helper); before each create it was 423.41 / 424.75 MiB. These figures come from another runner, installation and release build than the tables above, so they sit beside them rather than in them. On another runner, cold create to running measured 2,363.52 / 2,388.05 ms and create to first output 2,618.67 / 2,653.04 ms, with every other cohort within 2 % of the rows above: cold create varies between runners by about a second at p50. ### Memory sleep and wake Measured on a hosted `ubuntu-24.04` runner with KVM, as the runner's ordinary user, by `memory_acceptance` through the runtime a sandbox uses: an Alpine guest with 256 MiB and one vCPU, whose entrypoint keeps a counter going, slept and woken thirty times in a row. A sleep is the guest's signed freeze of its workload, flush and hold, the pause, the full snapshot into the runtime's private state and the monitor's retirement; a wake is the restore, the guest's signed resume (clock, host entropy and gateway ports) and its agent's answer through a new forwarder. | Measurement, ordinary-user VM, n=30 | p50 / p90 | | --- | --- | | Sleep with memory (ms) | 395.04 / 464.10 | | Wake with memory (ms) | 220.05 / 235.62 | In every sample the same process ran on after the wake, with its counter past where it was and its `/tmp` file kept; after the last, the guest's wall clock was within two seconds of the host's. A wake whose state file had been corrupted, and a wake whose image recorded another host class, each booted the disk instead, with what was written before the sleep there and the memory gone; a stop while asleep ended the memory and reported a SIGKILL's exit. Measured through the node API, a wake splits into its restore (15 to 17 ms), the guest's resume (34 to 110 ms) and the agent's first answer (126 to 132 ms). Three forks with memory of one sleeping source were made in 1.63 to 2.18 ms (a copy of the disk and links to the memory); two woke in 193.07 and 201.89 ms. The two forks and the source then each ran the source's process under its own hostname, and the 32 bytes each read from `/dev/urandom` first after its wake differed between all three; each fork refused the source's agent token. The source's workload appended 16 random bytes a line to its disk every 10 ms: the third fork, refused its restore by another host class, booted the flushed disk with all 84 lines the memory held, and the first line each restored copy drew after its restore differed between all three. The guest kernel has no VM generation ID driver (`0` in each guest, as its configuration says), so the different bytes are the resume hook's host entropy and forced reseed. A guest with a network, public and under a hostname policy, passed the production network probe (DNS, the allowed request, every refusal) after a wake with memory, in its fork with memory, and in the source woken after the fork. A minimal guest fixture, not a sandbox, boots from launch to a validated filesystem and vsock report in p50 717.035 ms and p90 725.265 ms, over thirty boots with one vCPU and 256 MiB. It is not a create, agent or memory figure for this table. ## Measured default and create-to-output target Keep **process** as the image default when no Docker socket is usable. In the ordinary-image comparison its cold-create p50 is **777.98 ms**, versus **1,791.04 ms** for Wasm; hot echo first byte is **2.55 ms** versus **452.86 ms**; fifty creations finish in **1,915.59 ms** versus **68,769.87 ms**. Its idle context PSS is **333.51 MiB** versus **654.07 MiB**, and running-shell context PSS is **334.08 MiB** versus **742.80 MiB**. Wasm wins none of those selection measures. These memory totals include services; the paired deltas and fixed overhead are reported above. Process also runs native host binaries. Wasm offers its virtual-kernel boundary and compatible Python/JavaScript software as an explicit option; a shared worker remains a shared fault domain. The result does not establish a universal winner for arbitrary applications or host policies. A Docker host still defaults to container, preserving arbitrary-image support. The following separate cohorts use the ordinary image, normal **512 MiB / 250 CPU-millis** resource defaults and normal gateway limits. There is no tier override for process; Wasm is explicitly forced to measure the same hello path. Every command prints exactly `hello` plus newline, with zero exit status and no stderr; cleanup is checked. All cells are p50 / p90 milliseconds, n=30 for every cell. | Path | Implicit process default | Forced Wasm | | --- | ---: | ---: | | SDK create acknowledgement | 983.06 / 987.05 | 2,048.53 / 2,078.72 | | SDK first echo after create | 7.67 / 8.14 | 907.84 / 921.21 | | SDK create to first byte | 990.38 / 994.28 | 2,960.64 / 2,983.88 | | SDK create to completed echo | 990.50 / 994.42 | 2,976.27 / 3,002.76 | | Compiled CLI to first byte | 968.53 / 984.71 | 2,947.15 / 2,976.99 | | Compiled CLI total including cleanup | 998.71 / 1,016.82 | 3,000.34 / 3,033.40 | **The 100 ms goal is missed.** Forced-Wasm SDK create-to-first-byte p50 is **2,960.64 ms**; compiled `hermitbox run -- echo hello` first-byte p50 is **2,947.15 ms**. The normal process default is **990.38 ms** through the SDK and **968.53 ms** through the compiled CLI. These measurements include fresh creation and API running acknowledgement. The observed Wasm components are **2,048.53 ms** to create acknowledgement and **907.84 ms** from acknowledgement to first echo; process is **983.06 ms** and **7.67 ms**, respectively. Percentiles of components do not add exactly to the percentile of their sum. The pinned sidecar's VM/root initialization and first command through its process/output bridge are on this measured path; a millisecond VM boot does not describe end-to-end hermitbox creation. These component timings locate the cost, without claiming an isolated profiler attribution. No pre-created sandbox or relaxed product limit is used. ## Paired budget checks The ordinary-image runner also runs the budget collectors. Every numeric cell below has n=30. Values are milliseconds at the stated percentile. | Budget | Percentile | Measured | Required | | --- | --- | ---: | ---: | | Public exec | p50 | 46.80 | < 50 | | Template create | p50 | 181.93 | < 1,000 | | Suspended wake | p50 | 27.56 | < 1,000 | | Agent run | p90 | 2.24 | < 20 | | Agent first byte | p90 | 2.11 | < 10 | | Agent expose to first 200 | p90 | 5.71 | < 200 | | Process image run | p90 | 2.82 | < 20 | | Process image first byte | p90 | 2.93 | < 10 | | Process image expose to first 200 | p90 | 60.60 | < 200 | | Process image startup | p90 | 6,475.04 | < 10,000 | Every budget passes. The same source's container deployment measures 2.20 ms to run, 2.12 ms to first byte and 7.57 ms to expose and answer 200, at p90. The 100 ms create-to-output goal above remains missed. ## Policy and convenience tools Hostname egress allow/deny is available on container nodes that announce `egress-hostnames` after root firewall installation. Each such sandbox has a dedicated bridge and HTTP/TLS gateways; no sandbox proxy setting can bypass the firewall. An ordinary-user node whose only tier is `vm` announces it too, with guest rules and host-owned gateways ([vm.md](https://docs.hermitbox.dev/v0.2.0/vm.md#as-an-ordinary-user)). A process node announces it, with `egress-addresses`, where its kernel network policy is on ([bpf.md](https://docs.hermitbox.dev/v0.2.0/bpf.md)); elsewhere process and wasm return an explicit refusal. `network:none` remains the all-tiers network boundary. Workdir uses the `workload-options` feature; user selection is restricted to the operator container user. Metrics use cached tier counters and preserve null where unavailable. These policy fields are refused when the destination no longer announces the feature, including on a wake whose specification is unchanged. They are never silently dropped. The default Internet network remains compatible with old nodes. Git requires an image/userland installation on native tiers. The verified optional wasm Git package is staged with the distribution and loaded only on request. Stateful shells use pipes on every tier. --- # Prepared OpenOrange provider registration This patch is not part of upstream OpenOrange. OpenOrange 1.0.2 does not offer `hermitbox`; an unmodified release cannot select this provider. The patch targets Apache-2.0 OpenOrange commit `1cabf2e9db300361c9f0b751c7723da7eb706f5e`. `source.json` pins the exact original files. No OpenOrange implementation is shipped in hermitbox. The proposed change adds `ORANGE_SANDBOX_PROVIDER=hermitbox`, lazy SDK imports and validation of `HERMITBOX_API_URL`/`HERMITBOX_API_KEY`. Its Actor continues to store provider name and sandbox id. The public SDK owns lifecycle, execution and file access. The binding uses the connected sandbox's persistent directory and native binary files and directory metadata, instead of requiring GNU file tools. Recursive list never descends into symlinks. Preview requests call `hermitboxPortAddress` and use hermitbox's edge, retaining request bodies, paths, query parameters and the edge URL's prefix. Git defaults to the backend's working directory. Other providers keep their existing working directories. To offer this upstream, apply `change.patch` to that commit and install the SDK release containing `hermitbox/provider` next to Orange. Add that same released SDK as an optional peer and a pinned development dependency for Orange's typecheck. Extend Orange's provider settings documentation and tests with the name, URL/key requirements, missing-sandbox reconnection, native byte writes and preview forwarding. Then run its full typecheck and test suite before publishing. The existing OpenOrange adapter bridge maps combined output to stdout; this patch retains that behavior. Complete `Files.stat/lstat` metadata stays partial. Session/code-context and container-only methods keep their existing refusals. hermitbox's CI end-to-end job applies this exact patch to digest-verified upstream files, typechecks and builds the registration and exercises its create/connect, binary files, directory listing, execution, edge preview and destroy against the same real hermitbox deployment as the SDK provider. It does not bundle or run OpenOrange or Rivet's control plane in a hermitbox installation. The local command `bun control/tools/open-orange-patch.ts` only prepares ignored validation output. The browser binding is deliberately unchanged: hermitbox's short-lived, rotating browser capability cannot be a fixed `ORANGE_BROWSER_CDP_URL`. A future refresh contract would be needed; the current bridge makes no Browser Rendering claim. --- # 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 `hermitbox run --isolation vm --image alpine -- uname -r`, or require one of its guarantees. 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.0/tiers.md)). A VM sandbox reports these [guarantees](https://docs.hermitbox.dev/v0.2.0/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.0/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/templates/vm-tools/monitor-REBUILD.md)). The kernel is pinned in [kernel-selection.json](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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, mounts `/tmp`, `/run` and `/dev/shm` at the spec's temporary size, sets the hostname and the guest's PID limit, applies the guest firewall, and only then starts 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. ## Reaching 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. ## Networking ### 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. The signed installation's acceptance runs one such rule (`deploy/vm-installed-acceptance.ts`). - **`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 may 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, and 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), 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/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/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. ## Sleep, snapshot, fork, export, restore, move - **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 its workload's cgroup, flush its disk and hold a connection to the host; the monitor is then paused, writes a full snapshot of its state and memory, and 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, points its redirects at the gateways this wake listens on (their ports are new, and the resume names them), 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), places a fork from that snapshot on the node that holds it when that node has room, and 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. ## What 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, delete, 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.0/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. --- # Python SDK ## Install On Python 3.12 or later: ```sh pip install https://github.com/hermitbox/hermitbox/releases/download/v0.2.0/hermitbox-0.2.0-py3-none-any.whl ``` Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` to the values the installer printed. ## Quickstart ```python import os from hermitbox import Hermitbox # Connect with the URL and key the installer printed. with Hermitbox( url=os.environ['HERMITBOX_API_URL'], key=os.environ['HERMITBOX_API_KEY'], ) as hb: # Create a container sandbox that sleeps after ten idle minutes. box = hb.sandbox(image='node:22', idle='10m') try: # Write a file and run it. box.write('hello.js', 'console.log("hello")') result = box.run('node /data/hello.js') # Stop if the command failed. if result.code != 0: raise RuntimeError(result.stderr) print(result.stdout) # hello finally: # Delete it, even when something failed. box.delete() ``` On a host whose default tier is `process` or `wasm`, leave out `image`. ## Reference Durations are positive seconds or `s`, `m`, `h`, `d` strings. String commands use `sh -c`; argv bypasses the shell. Commands default to persistent storage; `cwd` overrides it. Paths are relative to persistent storage (`/data`). Binary data streams through the agent while running and through the node while stopped. No shell tools are required for file operations. Commands receive one generated idempotency key per call; no mutation retries automatically. Output capture and observation queues are bounded. Overflow is explicit; the result remains available. A missing exit is an unknown outcome. Disconnect does not terminate the process. `HermitboxError` preserves status, code and details. Credentials never enter serialized views. Use `async with Hermitbox(url=..., key=...) as hermitbox` for asynchronous handles with the same names. Await I/O methods and `run`; use `async for` on streams. `stream.result()` is awaited. Sync `run` returns `RunResult` immediately after completion; it needs no `wait()` call. Python result fields use snake_case (`timed_out`, `stdout_truncated`, `duration_ms`). Create/process identity uses `key=`, options use keyword arguments, and `timeout=` accepts durations. | Method | Behavior | | --- | --- | | `hermitbox.sandbox(options \| id)` | Create with env, labels, name, workdir, user, autoDelete, egress, metadata or repo; name-only looks up; lookup wakes unless wake:false. | | `hermitbox.sandboxes(filters)` | Filter project handles by name, labels and state. | | `hermitbox.project()` | Project usage and limits. | | `hermitbox.run(image, command, options)` | Create, run and delete in a finally block. | | `box.run(command, options)` | Start now; return the result (a native asyncio Task on the async handle). | | `box.stream(command, options)` | Start now; iterate live chunks once, synchronously or asynchronously. | | `stream.lines()` | Iterate complete stdout/stderr lines. | | `stream.result()` | Await the same command result without starting it again. | | `box.spawn(command, options)` | Start a process; stdin accepts one-shot string or bytes. | | `box.start()` | Start sandbox compute. | | `box.stop()` | Stop compute; retain data. | | `box.sleep()` | Suspend or stop while retaining data. | | `box.wake()` | Resume or recreate compute. | | `box.rest()` | Archive data and release compute. | | `box.refresh()` | Refresh the view and invalidate its cached capability. | | `box.delete()` | Delete sandbox and owned data. | | `box.read(path)` | Read UTF-8 persistent data. | | `box.read_bytes(path)` | Read persistent bytes. | | `box.read_stream(path)` | Read a byte stream without collecting the file. | | `box.write(path, data)` | Write strings, bytes, streams or async iterables. | | `box.snapshot()` | Create a snapshot handle. | | `box.snapshots()` | List snapshot handles. | | `snapshot.fork(options)` | Create a sandbox from the snapshot. | | `snapshot.delete()` | Delete the snapshot. | | `box.endpoints()` | List assigned application endpoints. | | `box.events(options)` | Iterate lifecycle records with since and follow. | | `box.logs(**options)` | Read or follow agent logs. | | `box.terminal(options)` | Open a PTY with optional rows and cols. | | `box.mcp_url()` | Scoped sandbox-local MCP URL. | | `box.expose(port)` | Publish a spare port and return its URL. | | `box.unexpose(port)` | Release an exposed spare. | | `box.network(mode)` | Replace compute with internet or none policy. | | `process.wait()` | Wait for its terminal status. | | `process.events()` | Read agent output/exit frames. | | `process.stream()` | Read decoded stdout/stderr chunks. | | `process.lines()` | Read complete lines. | | `process.stdin.write(data)` | Send string or bytes. | | `process.stdin.close()` | Close input. | | `process.signal(signal)` | Signal the process. | | `process.kill()` | Kill the process. | | `process.resize(cols, rows)` | Resize its PTY. | | `terminal.stdin.write(data)` | Send terminal input. | | `terminal.resize(cols, rows)` | Resize the terminal. | | `terminal.signal(signal)` | Signal the terminal process. | | `terminal.events()` | Read terminal frames. | | `terminal.stream()` | Read terminal output. | | `terminal.close()` | Close the terminal. | | `files.read(path)` | Read UTF-8 text. | | `files.read_bytes(path)` | Read bytes. | | `files.read_stream(path)` | Stream bytes. | | `files.write(path, data)` | Write persistent data. | | `files.list(path)` | List directory entries. | | `files.stat(path)` | Read file metadata. | | `files.mkdir(path)` | Create directories. | | `files.move(from, to)` | Move a persistent entry. | | `files.delete(path)` | Delete a persistent entry. | | `files.watch(path)` | Ready frame, then bounded changes. | | `files.url(path, method)` | Grant one file operation for at most one minute. | | `files.upload(local, remote, options)` | Stream caller disk to the sandbox with onProgress. | | `files.download(remote, local, options)` | Stream to caller disk with onProgress. | | `box.processes()` | List retained process handles. | | `box.kill_all()` | Signal all running processes once. | | `process.wait_for_port(port, options)` | Await owned TCP or HTTP readiness; timeout and early exit differ. | | `process.wait_for_log(pattern, timeout)` | Await a bounded regular expression match in either stream. | | `process.wait_for_exit(timeout)` | Await exit with a deadline. | | `process.logs()` | Read retained process stdout/stderr chunks. | | `box.shell(options)` | Open a persistent shell with cwd and env. | | `shell.run(command, options)` | Run serially with exact separate streams and exit code. | | `shell.close()` | Close and terminate that session. | | `files.exists(path)` | Test existence without following links. | | `files.find(glob)` | Find relative paths within the agent search budget. | | `files.grep(pattern, options)` | Return path, line and matching text; paths scope the search. | | `files.replace(pattern, text, options)` | Replace literal text at regex matches; preserve modes. | | `files.chmod(path, mode)` | Set ordinary permission bits. | | `files.upload_dir(local, remote, options)` | Stream a bounded tar; preserve files and empty directories. | | `files.download_dir(remote, local, options)` | Extract a bounded tar; refuse links and traversal. | | `box.sync(local, remote)` | Upsert changed content by SHA-256; never delete. | | `box.git.clone(url, options)` | Clone public/HTTPS credentials with path, branch and depth. | | `box.git.status()` | Parsed clean flag and entries, plus raw result. | | `box.git.diff(options)` | Parsed patch, optionally staged, plus raw result. | | `box.git.branch(name?)` | List or create branches, plus raw result. | | `box.git.checkout(ref, options)` | Checkout or create a branch, plus raw result. | | `box.git.add(paths)` | Stage paths without shell interpolation. | | `box.git.commit(message, options)` | Commit with optional author; return hash and raw result. | | `box.git.push(options)` | Push with an optional one-call token helper. | | `box.git.pull()` | Fast-forward pull, plus raw result. | | `box.git.log(options)` | Parsed commit records with limit, plus raw result. | | `box.keep_alive(duration)` | Extend access and touch activity within project ceilings. | | `box.set_ttl(duration)` | Set TTL from now within the project ceiling. | | `box.set_idle(duration)` | Set the idle timeout within the project ceiling. | | `box.metrics(options)` | Latest node sample, or retained minute series with since. | | `box.wait_until(state, timeout)` | Poll the public state until reached or timed out. | | `hermitbox.template(options)` | Build copy/run/ready on a node with from_, publish a snapshot version. | | `template.rebuild()` | Build a new immutable version from the same local context. | | `hermitbox.templates()` | List project template versions. | | `hermitbox.webhook(options)` | Register lifecycle delivery and show its secret once. | | `hermitbox.webhooks()` | List registrations without secrets. | | `webhook.delete()` | Delete this registration. | | `webhook.deadletters()` | Inspect exhausted deliveries. | Handles expose `id`, `state`, `isolation`, `units` and `files`. Option and result models are exported alongside the seven handle/error classes. Models come from the committed OpenAPI; `python sdk/python/generate.py check` checks generation with the pinned generator lock. See [agent security](https://docs.hermitbox.dev/v0.2.0/agent.md) and [tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md). Git defaults to `repo`; clone changes that handle’s path. Tokens use a one-call credential helper, never a credential file. Public clone requires permitted internet and Git in the image/userland (the wasm Git package is staged on demand). Shells use serialized pipes with independent stdout/stderr markers. Search/tar budgets and link refusals are in [agent security](https://docs.hermitbox.dev/v0.2.0/agent.md). Container hostname egress requires the advertised host firewall feature; process sandboxes take it where their node announces kernel network policy ([bpf](https://docs.hermitbox.dev/v0.2.0/bpf.md)), and wasm refuses it with the tier named. Webhook signatures and retry limits are in [the API reference](https://docs.hermitbox.dev/v0.2.0/api.md). Git clone/push/pull default to five minutes; other Git operations use the normal command budget. Every method accepts a timeout override. Wasm clones keep metadata in persistent guest storage and checkout files in data; both survive stop and snapshots. Automatic background maintenance and all Git trace destinations are disabled during helper calls. With the sandbox root in scope, the AI tools can also snapshot, fork an owned snapshot, sleep and wake the bound sandbox. Read-only access and subdirectory scopes omit these whole-sandbox actions. ### Anthropic Messages SDK Install `hermitbox[ai-anthropic]` and pass an existing asynchronous sandbox handle to `hermitbox_tools(box)` from `hermitbox.ai.anthropic`. The tools read, write, list and search sandbox files. Set `read_only=True` or pass an `allow` list of tool names to limit access, and `cwd="project"` to scope the paths. [Messages runner example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-anthropic/read_project.py) ### OpenAI Agents SDK Install `hermitbox[ai-openai]` and pass the tools from `hermitbox.ai.openai.hermitbox_tools(box)` to an Agent. The same directory and tool selection options apply. [Agents runner example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-openai/read_project.py) ### Pydantic AI Install `hermitbox[ai-pydantic]` and pass `hermitbox.ai.pydantic.hermitbox_tools(box)` as an Agent's `tools`. [Pydantic AI example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-pydantic/read_project.py) ### LangChain and LangGraph Install `hermitbox[ai-langchain]`. The LangChain structured tools returned by `hermitbox.ai.langchain.hermitbox_tools(box)` run in LangGraph tool nodes and LangChain agents. With `stream_mode="custom"`, project tasks emit bounded stdout and stderr chunks as they arrive. The tool result includes the exit status. [LangGraph-backed agent example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-langchain/read_project.py) Install `hermitbox[ai-llamaindex]` to pass the tools returned by `hermitbox.ai.llamaindex.hermitbox_tools` to a LlamaIndex function agent. [LlamaIndex example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-llamaindex/read_project.py) ### CrewAI Install `hermitbox[ai-crewai]` for CrewAI tools. Use the asynchronous agent entry point with your AsyncSandbox. [CrewAI example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-crewai/read_project.py) ### Google ADK Install `hermitbox[ai-adk]` for Google ADK tools. The ADK selects websockets 15.0.1. The regular SDK also supports 17.4. [ADK example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-adk/read_project.py) For project tasks, `hermitbox_tools(box, commands=[['npm', 'test']], ports=[3000])` lets the model run that exact argument vector and open the selected preview port. The run tool waits for the exit status. A background start returns a process ID for the output tool. Results include a truncation flag and a pointer to the SDK stream when output exceeds the model's budget. Read-only and subdirectory catalogs omit task and preview tools. --- # TypeScript SDK ## Install ```sh npm install https://github.com/hermitbox/hermitbox/releases/download/v0.2.0/hermitbox-0.2.0.tgz ``` Set `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` to the values the installer printed. ## Quickstart ```ts import { Hermitbox } from 'hermitbox' // Connect with the URL and key the installer printed. const hb = new Hermitbox({ url: process.env.HERMITBOX_API_URL!, key: process.env.HERMITBOX_API_KEY!, }) // Create a container sandbox that sleeps after ten idle minutes. const box = await hb.sandbox({ image: 'node:22', idle: '10m' }) try { // Write a file and run it. await box.write('hello.js', 'console.log("hello")') const result = await box.run('node /data/hello.js') // Stop if the command failed. if (result.code !== 0) throw new Error(result.stderr) console.log(result.stdout) // hello } finally { // Delete it, even when something failed. await box.delete() } ``` On a host whose default tier is `process` or `wasm`, leave out `image`. ## Reference Durations are positive seconds or `s`, `m`, `h`, `d` strings. String commands use `sh -c`; argv bypasses the shell. Commands default to persistent storage; `cwd` overrides it. Paths are relative to persistent storage (`/data`). Binary data streams through the agent while running and through the node while stopped. No shell tools are required for file operations. Commands receive one generated idempotency key per call; no mutation retries automatically. Output capture and observation queues are bounded. Overflow is explicit; the result remains available. A missing exit is an unknown outcome. Disconnect does not terminate the process. `HermitboxError` preserves status, code and details. Credentials never enter serialized views. | Method | Behavior | | --- | --- | | `hermitbox.sandbox(options \| id)` | Create with env, labels, name, workdir, user, autoDelete, egress, metadata or repo; name-only looks up; lookup wakes unless wake:false. | | `hermitbox.sandboxes(filters)` | Filter project handles by name, labels and state. | | `hermitbox.project()` | Project usage and limits. | | `hermitbox.run(image, command, options)` | Create, run and delete in a finally block. | | `box.run(command, options)` | Start immediately; return a native promise of the bounded result. | | `box.stream(command, options)` | Start immediately; iterate live {stream, data} chunks once. | | `stream.lines()` | Iterate complete stdout/stderr lines. | | `stream.result()` | Await the same command result without starting it again. | | `box.spawn(command, options)` | Start a process; stdin accepts one-shot string or bytes. | | `box.start()` | Start sandbox compute. | | `box.stop()` | Stop compute; retain data. | | `box.sleep()` | Suspend or stop while retaining data. | | `box.wake()` | Resume or recreate compute. | | `box.rest()` | Archive data and release compute. | | `box.refresh()` | Refresh the view and invalidate its cached capability. | | `box.delete()` | Delete sandbox and owned data. | | `box.read(path)` | Read UTF-8 persistent data. | | `box.readBytes(path)` | Read persistent bytes. | | `box.readStream(path)` | Read a byte stream without collecting the file. | | `box.write(path, data)` | Write strings, bytes, streams or async iterables. | | `box.snapshot()` | Create a snapshot handle. | | `box.snapshots()` | List snapshot handles. | | `snapshot.fork(options)` | Create a sandbox from the snapshot. | | `snapshot.delete()` | Delete the snapshot. | | `box.endpoints()` | List assigned application endpoints. | | `box.events(options)` | Iterate lifecycle records with since and follow. | | `box.logs(options, signal)` | Read or follow agent log history; abort with signal. | | `box.terminal(options)` | Open a PTY with optional rows and cols. | | `box.mcpUrl()` | Scoped sandbox-local MCP URL. | | `box.expose(port)` | Publish a spare port and return its URL. | | `box.unexpose(port)` | Release an exposed spare. | | `box.network(mode)` | Replace compute with internet or none policy. | | `box.toJSON()` | Serialize the public sandbox view. | | `process.wait()` | Wait for its terminal status. | | `process.events()` | Read agent output/exit frames. | | `process.stream()` | Read decoded stdout/stderr chunks. | | `process.lines()` | Read complete lines. | | `process.stdin.write(data)` | Send string or bytes. | | `process.stdin.close()` | Close input. | | `process.signal(signal)` | Signal the process. | | `process.kill()` | Kill the process. | | `process.resize(cols, rows)` | Resize its PTY. | | `terminal.stdin.write(data)` | Send terminal input. | | `terminal.resize(cols, rows)` | Resize the terminal. | | `terminal.signal(signal)` | Signal the terminal process. | | `terminal.events()` | Read terminal frames. | | `terminal.stream()` | Read terminal output. | | `terminal.close()` | Close the terminal. | | `files.read(path)` | Read UTF-8 text. | | `files.readBytes(path)` | Read bytes. | | `files.readStream(path)` | Stream bytes. | | `files.write(path, data)` | Write persistent data. | | `files.list(path)` | List directory entries. | | `files.stat(path)` | Read file metadata. | | `files.mkdir(path)` | Create directories. | | `files.move(from, to)` | Move a persistent entry. | | `files.delete(path)` | Delete a persistent entry. | | `files.watch(path)` | Ready frame, then bounded changes. | | `files.url(path, method)` | Grant one file operation for at most one minute. | | `files.upload(local, remote, options)` | Stream caller disk to the sandbox with onProgress. | | `files.download(remote, local, options)` | Stream to caller disk with onProgress. | | `box.processes()` | List retained process handles. | | `box.killAll()` | Signal all running processes once. | | `process.waitForPort(port, options)` | Await owned TCP or HTTP readiness; timeout and early exit differ. | | `process.waitForLog(pattern, timeout)` | Await a bounded regular expression match in either stream. | | `process.waitForExit(timeout)` | Await exit with a deadline. | | `process.logs()` | Read retained process stdout/stderr chunks. | | `box.shell(options)` | Open a persistent shell with cwd and env. | | `shell.run(command, options)` | Run serially with exact separate streams and exit code. | | `shell.close()` | Close and terminate that session. | | `files.exists(path)` | Test existence without following links. | | `files.find(glob)` | Find relative paths within the agent search budget. | | `files.grep(pattern, options)` | Return path, line and matching text; paths scope the search. | | `files.replace(pattern, text, options)` | Replace literal text at regex matches; preserve modes. | | `files.chmod(path, mode)` | Set ordinary permission bits. | | `files.uploadDir(local, remote, options)` | Stream a bounded tar; preserve files and empty directories. | | `files.downloadDir(remote, local, options)` | Extract a bounded tar; refuse links and traversal. | | `box.sync(local, remote)` | Upsert changed content by SHA-256; never delete. | | `box.git.clone(url, options)` | Clone public/HTTPS credentials with path, branch and depth. | | `box.git.status()` | Parsed clean flag and entries, plus raw result. | | `box.git.diff(options)` | Parsed patch, optionally staged, plus raw result. | | `box.git.branch(name?)` | List or create branches, plus raw result. | | `box.git.checkout(ref, options)` | Checkout or create a branch, plus raw result. | | `box.git.add(paths)` | Stage paths without shell interpolation. | | `box.git.commit(message, options)` | Commit with optional author; return hash and raw result. | | `box.git.push(options)` | Push with an optional one-call token helper. | | `box.git.pull()` | Fast-forward pull, plus raw result. | | `box.git.log(options)` | Parsed commit records with limit, plus raw result. | | `box.keepAlive(duration)` | Extend access and touch activity within project ceilings. | | `box.setTtl(duration)` | Set TTL from now within the project ceiling. | | `box.setIdle(duration)` | Set the idle timeout within the project ceiling. | | `box.metrics(options)` | Latest node sample, or retained minute series with since. | | `box.waitUntil(state, timeout)` | Poll the public state until reached or timed out. | | `hermitbox.template(options)` | Build copy/run/ready on a node and publish a snapshot version. | | `template.rebuild()` | Build a new immutable version from the same local context. | | `hermitbox.templates()` | List project template versions. | | `hermitbox.webhook(options)` | Register lifecycle delivery and show its secret once. | | `hermitbox.webhooks()` | List registrations without secrets. | | `webhook.delete()` | Delete this registration. | | `webhook.deadletters()` | Inspect exhausted deliveries. | `Sandbox` exposes `id`, `state`, `isolation`, `units` and `files`. Result and option types are exported with `Hermitbox`, `Sandbox`, `Snapshot`, `Process`, `Terminal`, `Files` and `HermitboxError`. See [agent security](https://docs.hermitbox.dev/v0.2.0/agent.md) and [tiers](https://docs.hermitbox.dev/v0.2.0/tiers.md). Git defaults to `repo`; clone changes that handle’s path. Tokens use a one-call credential helper, never a credential file. Public clone requires permitted internet and Git in the image/userland (the wasm Git package is staged on demand). Shells use serialized pipes with independent stdout/stderr markers. Search/tar budgets and link refusals are in [agent security](https://docs.hermitbox.dev/v0.2.0/agent.md). Container hostname egress requires the advertised host firewall feature; process sandboxes take it where their node announces kernel network policy ([bpf](https://docs.hermitbox.dev/v0.2.0/bpf.md)), and wasm refuses it with the tier named. Webhook signatures and retry limits are in [the API reference](https://docs.hermitbox.dev/v0.2.0/api.md). Git clone/push/pull default to five minutes; other Git operations use the normal command budget. Every method accepts a timeout override. Wasm clones keep metadata in persistent guest storage and checkout files in data; both survive stop and snapshots. Automatic background maintenance and all Git trace destinations are disabled during helper calls. With the sandbox root in scope, the AI tools can also snapshot, fork an owned snapshot, sleep and wake the bound sandbox. Read-only access and subdirectory scopes omit these whole-sandbox actions. ### Vercel AI SDK With the optional AI SDK and Zod peers installed, pass an existing sandbox to `hermitboxTools(box)` from `hermitbox/ai`. Its file tools read, write, list and search persistent data. For example, `hermitboxTools(box, { readOnly: true, cwd: 'src' })` lets the model inspect files under `src`. Use `allow` to select individual tool names. Large results identify the sandbox path and SDK method for the full contents. [Runnable example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-vercel/read-project.ts) ### OpenAI Agents SDK Import `hermitboxTools` from `hermitbox/ai/openai` and pass its result to an Agent's `tools`. It accepts the same sandbox, directory and access options as the Vercel adapter. [Scripted runner example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-openai/read-project.ts) ### Anthropic Messages SDK Pass the result of `hermitboxTools(box, options)` from `hermitbox/ai/anthropic` to `client.beta.messages.toolRunner`. The runner sends the selected sandbox tools with the message and returns their results on its next turn. [Messages runner example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-anthropic/read-project.ts) ### LangChain and LangGraph Pass `hermitboxTools(box, options)` from `hermitbox/ai/langchain` to a LangChain agent's `tools` or a LangGraph tool node. [Graph-backed agent example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-langchain/read-project.ts) ### Claude Agent SDK Pass the tools from `hermitbox/ai/claude` to `createSdkMcpServer`. Limit the session to that server and its selected tools. [Claude project reader](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-claude/read-project.ts) ### Mastra Mastra accepts the tool record from `hermitbox/ai/mastra` in its Agent. [Mastra project reader](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-mastra/read-project.ts) ### LlamaIndex LlamaIndex workflows accept the function tools from `hermitbox/ai/llamaindex`. [LlamaIndex project reader](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/ai-llamaindex/read-project.ts) ### Commands and ports for the model `hermitboxTools(box, { commands: [['npm', 'test']], ports: [3000] })` lets the model run that exact argument vector and open the selected preview port. The run tool waits for the exit status. A background start returns a process ID for the output tool. Results include a truncation flag and a pointer to the SDK stream when output exceeds the model's budget. Vercel streams preliminary chunks. Mastra and LangGraph pass the chunks to the active stream writer. Read-only and subdirectory catalogs omit task and preview tools. ### Rivet sandbox provider Rivet's sandbox provider is a separate entry point, `hermitbox/provider`: `hermitboxProvider()` reads `HERMITBOX_API_URL` and `HERMITBOX_API_KEY`; `hermitboxPortAddress(id, port)` returns an edge preview. See [the integration guide](https://docs.hermitbox.dev/v0.2.0/integrations/rivet.md) and [the runnable example](https://github.com/hermitbox/hermitbox/blob/f9b5d4aa3cc4636cd916d6b84e56d6ba38b271a7/examples/rivet-provider.ts), including the current OpenOrange registration and required-guarantee boundaries.