agentOS on Hermitbox
Run a sandbox on Hermitbox's wasm tier on this x86_64 host.
The wasm tier gives each sandbox its own agentOS VM on x86_64, with a virtual kernel and no
container engine needed. Ask for it by name. A user install without Landlock ABI 3 selects
it by default.
hermitbox run --isolation wasm -- echo helloClients use the same authenticated agent API and edge routes as on every other tier. Behind them,
hermitboxd owns the VMs through the published Rust client and a separate native sidecar, and
control keeps placement, projects, units, epochs, leases and the lifecycle.
The dependency is agentOS 0.4.7, published from
a4c049b2e25ceb2098889a307b71853526de2bdf.
The client and native protocol make no cross-version compatibility promise, so 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, and section 4 permits different terms for the aggregate.
That lets Hermitbox, under AGPL-3.0-only, use this dependency without relicensing agentOS. Its
Apache licence and notice ship under the distribution’s licenses/ and NOTICE paths. Bundled
software keeps 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. It 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
Files survive sleep, wake, snapshot and fork; running processes don’t survive sleep.
The sandbox data directory holds root.sqlite, the VM’s chunked SQLite root, and 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, keeping 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 and start follow the same filesystem rule.
The measured alternatives and the selected image default are in tiers.md.
The shared sidecar has a no-network manager VM that keeps its worker alive between sandbox creations. Its fixed memory cost is separate from each VM’s incremental 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 and disposal are durably recorded before their effects, and stay pending after uncertain outcomes. Environment values, including signing seeds and project secrets, are excluded from this journal. After a 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 and 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 and npm.
Host-owned wasm.max_ingress_requests (default eight) bounds simultaneous exposed-application
requests across VMs, on top of 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 keeps its authenticated WebSocket terminal and streaming routes. All listeners use the host-selected audience addresses. Safe GET/HEAD requests can wait up to three seconds for a newly starting listener; mutations and started responses are never repeated. The default wasm terminal uses the bundled shell’s minimal input backend to keep pasted multi-line commands whole; in the pinned release, its rich line editor drops pasted lines after the first.
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 stays bounded and sequenced; sidecar callbacks only wake readers of retained output. An uncertain process termination fences that VM’s work.
image is refused on wasm with 422 invalid_request, field image, and problem
this host runs the wasm tier; images are not available. packages is optional, accepts
registry names rather than URLs or host paths, and is sent only to nodes advertising
wasm-packages. The eight bundled default packages need no runtime download. Additional
names use the matching release catalog and fail if it is unavailable; operators can configure
the upstream client’s HTTPS registry mirror. No package mutation is retried automatically.
Run agentOS as a Hermitbox guest
Hosted agentOS has two services: Rivet’s control plane, and Rivet Services, which owns its
agentOS actor and VMs. The embedded Core library needs neither. Its public groups cover
processes, terminals, filesystem/mounts, JavaScript, TypeScript, Python, contexts, networking,
software and cron. Core supports ephemeral roots, chunked SQLite roots and chunked S3 mounts;
durable files survive recreation, while running processes and contexts do not.
The current AgentOsSandboxProvider.start boundary still supplies an external process and
filesystem client with disposal. The prepared provider patch
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
and is not part of upstream agentOS. 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 contracts too.
Local real-sidecar checks
Stage the distribution into a new directory, then run the ordinary Rust suite unprivileged:
# Stage the pinned distribution.
python3 scripts/fetch-agentos.py /tmp/hermitbox-agentos-test
# Run the Rust suite against it.
HERMITBOX_AGENTOS_DISTRIBUTION=/tmp/hermitbox-agentos-test cargo test --lockedThe 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.
$curl -fsSL https://hbx.sh | shInstall Hermitbox and set it up for me