Based on AgentRun release · Synced .
boxd
import { providerFor } from "@parcha/agentrun-computer";
// The key is the caller's to pass (serve's BOXD_API_KEY), and the @boxd-sh/sdk package is the host's own (npm 0.3.1).
const boxd = await providerFor("boxd", { apiKey, org: "my-org", region: "fra" });
const made = await boxd.create({ image: "default", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
A boxd computer is a boxd machine: a KVM microVM running Ubuntu 24.04, with its own
kernel and disk. It is kind linux by default, and kind desktop with kind: "desktop": computerd starts Xvfb itself,
as on E2B and a Docker desktop, and its X11 shim drives it. boxd runs on the shared machine-host adapter
(PROVIDERS.md): src/boxd.ts is boxd's MachineHost, its SDK slice and the mapping of a boxd machine
to a machine, and src/hosted/provider.ts does everything that is not boxd's own (the computer's name, idempotent
create, the upload, the install, init's start, the stdio bridge, the probe, the janitor's extend, delete-then-wait-gone,
the sweep of a create that lands late). Every call goes through the host's boxd TypeScript SDK, the @boxd-sh/sdk
package's Boxd class, of which src/boxd.ts names only the slice it calls and imports nothing at load. The package is
the host's to install, as E2B's and Modal's are; this repository pins it as a root devDependency for the live tests.
The desktop snapshot
boxd's own image ("default") has Xvfb but lists none of a desktop's stock apps (Xfce's text editor and terminal,
xterm), so a boxd desktop starts from a snapshot that adds one. prepareImage() answers it by name,
agentrun-desktop-<12 hex>, the hash of the recipe in src/boxd.ts, so a new recipe is a new snapshot. When the
key's org has none, it builds it once, telling onWait "build" first:
machines.createof an isolated machine of boxd's own image, namedagentrun-desktop-build-<8 hex>, with no labels (a restore carries a snapshot's labels over to every machine made from it) and boxd's delete timer at 2 hours;- the recipe as root through the image user's passwordless sudo:
apt-get install mousepad(Ubuntu's universe), itsorg.xfce.mousepad.desktopchecked; snapshots.createunder the name, read until boxd saysready;- the build machine deleted and read gone, pass, fail or cancel: the id create answered, read through
get(a lagging list can't hide it), and any machine of its name in the org's list, so a create whose reply was lost is cleaned up too. One that can't be deleted within 2 minutes fails the call in words (after the build's own error, when it failed), and boxd's delete timer ends it.
A cancelled call makes no build machine, and a cancel while one starts stops the wait. Two servers that build the first snapshot of an org at once each pay for a build machine; both captures land under the one name, and boxd keeps the latest.
The snapshot stays in the org: it is the image of every boxd desktop, and the next prepareImage() finds it with no
build. One that failed, or that boxd archived (it makes no machine from an archived snapshot), is refused in words:
delete it with boxd snapshots remove, and the next call builds it anew. A sandbox's prepareImage() answers
"default" with no call.
A desktop asked for on "default" is refused in words, and so is a desktop with vcpu and memory: a restore keeps
the size the snapshot was captured at (the org's default). The box image's recipe (box/install.sh) is not used here:
it is written for Debian's python:3.12-slim, not Ubuntu, and it takes sudo away, while boxd's exec runs as the
image's user, which reaches root through sudo alone.
Settings
create(options) takes the key as options.apiKey and nowhere else, and refuses in words without it. It reads no
setting from the environment: serve passes its own BOXD_API_KEY, BOXD_ORG and BOXD_REGION, and the conformance
module the COMPUTER_BOXD_* names it reads. The provider gives the SDK the key, the API's address and the region
explicitly, so the SDK takes none of them from the environment.
| Option | Meaning | Unset |
|---|---|---|
apiKey |
the boxd API key | required |
org |
the org machines are made in and listed from, by name or id | the key's own |
region |
the region machines are made in (fra, nyc) |
the API's home region |
baseUrl |
the API's address | https://boxd.sh:9443 |
vcpu, memory |
a boxd size: 1 and 4G, 2 and 8G, 4 and 16G, or 8 and 32G; both or neither; a sandbox's alone |
the org's default |
kind |
linux or desktop (from the desktop snapshot) |
linux |
maxLifetimeMs |
the longest lifetime check takes, at most 30 days |
24 h |
daemonUser |
uid:gid the daemon runs as; never root, never the image's own user (1000) | 2510:2510 |
daemonPath, desktop, timeouts, probeTargets |
as on E2B |
The mapping
| MachineHost | boxd |
|---|---|
create |
machines.create with the adapter's name and labels, the org, isolated: true (the machine joins none of the org's networks and holds no in-machine credential), config.autoSuspendTimeout: 0 and the size; any image but "default" is a snapshot, restored with fromSnapshot; deleteAfter at the request's backstopAt, 5 minutes past the most it may live. Its own client, bounded by createMs and never sent twice. Then machines.waitUntilReady, setEgressAllow(id, ["none"]) and setAutoHibernateTimeout(id, 0): boxd's idle timers watch network traffic, and a computer's programs may work for a long time with none |
get |
machines.get: the labels, the state and createdAt; a machine of another org is none |
list |
machines.list by the labels, in the org |
delete |
machines.delete; not found is done |
exec |
one machines.streamExec of the argv quoted; boxd runs it as the image's user (boxd, uid 1000) with passwordless sudo, and the adapter's scripts sudo -n to root. kill cancels the stream: boxd ends the process group |
upload |
files.upload |
extend |
machines.updateLabels({ set }) of the janitor's deadline label |
errorCode |
the SDK's error names (NotFoundError, AuthenticationError, RateLimitError, ConflictError, ...), then an APIStatusError's gRPC code (3 invalid, 4 and 14 timeout, 8 limit, 9 refused) |
check |
"default" or a snapshot's name, a desktop's a snapshot alone, and no snapshot when the provider names a size (a restore has the snapshot's); no cpus or memoryMb in the spec (the size is the provider's); label names of 1 to 63 of a-z0-9._/-, not boxd/ |
get reads the state: suspended (standby that wakes on the next call) and migrating run; hibernated and
stopped are stopped; failed, destroyed and any status it does not know are gone. boxd keeps a name to one
machine, so a create that loses a race for its name is exists, and the adapter's retry finds the machine by its name.
boxd's in-machine agent, which carries the SDK's exec and file calls, listens on TCP 57073. Init starts with
--own-network, so the daemon and every program it starts run in a network namespace of their own, their loopback
alone (see Init, the socket and the bridge): vendorAgentPorts declares 57073, and
isolation.vendor-agent checks that a program of the computer's user reaches it on neither loopback.
Capabilities
| Capability | Declared | Why |
|---|---|---|
kind |
linux (default) or desktop |
options.kind; a desktop's X server is computerd's own, on the desktop snapshot |
lifetime |
janitor |
the janitor deletes a computer past its deadline label, and init ends every process at the deadline itself; boxd's own delete timer ends it 5 minutes past the most it may live, even when the server that made it is gone |
network |
none |
the egress allowlist ["none"], and the daemon's own network namespace, read from inside by the probe |
networkReadBack |
false |
as on every vendor on the adapter |
isolation |
microvm |
a KVM microVM with its own kernel |
daemon |
child |
boxd's agent runs the commands; init is a detached command it starts |
groups |
exec, files, processes, and on a desktop screen, input.pointer, input.keys, apps |
checked against hello on every connect |
maxLifetimeMs |
24 h, up to 30 days | options.maxLifetimeMs; boxd sets no cap of its own |
release |
delete |
machines.delete |
mount |
none | the run's folder on an Archil disk needs box/Dockerfile's tools in the machine; not built for boxd yet |
vendorAgentPorts |
[57073] |
boxd's in-machine agent |
Conformance on boxd
AGENTRUN_COMPUTER_LIVE_BOXD=1 COMPUTER_BOXD_API_KEY=... npm run conformance -w @parcha/agentrun-computer -- --provider boxd
AGENTRUN_COMPUTER_LIVE_BOXD=1 COMPUTER_BOXD_API_KEY=... npm run test:boxd -w @parcha/agentrun-computer
node packages/computer/dist/conformance/sweep.js --provider boxd --before /tmp/boxd-before.json # then --after
The conformance module, dist/conformance/boxd.js, checks AGENTRUN_COMPUTER_LIVE_BOXD=1 before it reads anything
else, then reads COMPUTER_BOXD_API_KEY (apiKey, required), COMPUTER_BOXD_ORG (org), COMPUTER_BOXD_REGION
(region), COMPUTER_BOXD_DAEMON (daemonPath), COMPUTER_BOXD_KIND (kind) and COMPUTER_BOXD_USER
(daemonUser), never BOXD_API_KEY, and caps every computer of a run at 30 minutes. conformanceImage() is
COMPUTER_BOXD_IMAGE, else "default" for a sandbox and for a desktop the desktop snapshot, which it finds or builds
first through the provider's prepareImage() (so a desktop run may build it, and leaves it in the org on purpose), and createDriftedProvider() uploads a daemon built with Go as
<version>-drift. createHost() is the generic sweep's host, and sweepScope() names where it lists (the org, the
region and the key by its sha256 prefix), so --after refuses a before file listed with another. test/boxd/conformance.boxd.test.mjs runs the suite
with computerd-fixture built for linux/amd64, and skips unless the switch and COMPUTER_BOXD_API_KEY are both set.
Live runs
On 2026-11-12, against boxd with an org key, the provider as first written (before it moved onto the shared adapter)
passed Core on both kinds: kind linux 62/62, kind desktop 68/68, and the CLI's run of --provider boxd 63/63.
Every run left no computer behind. On 2026-11-14, the host on the shared adapter passed Core on kind linux, 63/63
(Full 5/36, the rest not declared), in 179 s, and the sweep after it read {"swept":0,"gone":0,"stillThere":[],"leftAlone":0}.
On 2026-11-16, kind linux passed Core again and kind desktop did not: 0 cases failed, but six Core cases were
skipped, five because the run passed no --fixture, and apps.launch-terminate because boxd's own image lists none
of the stock apps. The desktop snapshot above is the fix for the last; it has not run live yet.
