Every agent's container starts life as a clone of a shared Incus snapshot, agentbox-base/ready
(or a project's own saved base), rather than being provisioned from scratch each time — see
An agent's lifecycle.
internal/image tracks the image with a version string, image.Version
(image.go). agentbox image build, or Setup's Build base image, makes it and snapshots it as
agentbox-base/ready:
- With no optional component, it downloads the image AgentBox publishes for that version from
https://downloads.agentbox.linting.dev/images/, or from theimage-<version>release athttps://github.com/leciric/agentbox/releaseswhen that fails, a few parts at a time, checks them against the release'sSHA256SUMS, joins them and imports the image into Incus. It is compressed with zstd, which Incus unpacks several times faster than gzip. A download that is interrupted (the connection drops, AgentBox restarts or the build is cancelled) carries on from where it got to the next time.AGENTBOX_IMAGES_URLin the daemon's environment points it somewhere else (several URLs, separated by spaces, are tried in order). That image is Debian 13 withprovision.shapplied and every tool intools.txtexcept Claude Code, its ACP adapter and Cursor's SDK, which AgentBox may not redistribute: the machine installs those itself, at theirtools.txtversions, before making the image its own. - With a component (Codex, OpenCode, the Android tools, the development caches, Incus), with
agentbox image build --local, withAGENTBOX_IMAGES_URL=offin the daemon's environment, or when the download or its checksum fails, it builds the image here instead, fromimages:debian/13, by runningprovision.shagainst a fresh container, which takes a few minutes longer. The build log says which it did and why.
Only the newest image version is published, so an AgentBox older than the latest image builds its
own. The image release is a prerelease, never marked latest, so it doesn't show up as an AgentBox
update. Next to each image are packages-<arch>.txt, its Debian packages with their exact versions, and
SOURCES-<arch>.md, where the source of each is on snapshot.debian.org and the licenses of the agent tools
in it.
Changing provision.sh means bumping image.Version: that's what tells an existing
machine's Setup page the installed image is outdated, and asks for a rebuild.
A new AgentBox that only moves the agent tools on (Claude Code, Codex, OpenCode, the GitHub CLI and the like) doesn't ask for a rebuild: on start, the daemon updates them in the base image in place, in the background, installing only the tools that changed and checking every one. Setup says "Updating agent tools…" while it runs, and new agents are made from the current image until the updated one is in place. If the update fails, the image stays as it was and keeps working, and Setup says why and offers Rebuild base image.
To get new Claude Code releases without waiting for an AgentBox release, turn on Keep Claude Code up to date in Settings → Models. Once a day, and when AgentBox starts, the daemon asks npm for the newest Claude Code and its chat adapter and updates them in the base image the same way, checking every tool before the new image is used. Agents created after that start on the new versions; existing agents move to them when their chat next starts, or before the next turn of a chat that is running, never in the middle of one. If an update fails, agents keep the versions they have and Settings says why. The version an AgentBox release ships with is the oldest it ever uses, and turning the setting off goes back to it. Check now checks at once.
Run inside the container before it's snapshotted:
- base packages —
curl,git,tmux,build-essential, Docker, Python, and the rest an agent needs to work; - a display stack for the desktop tools: a VNC server, Chromium, an Openbox desktop, a terminal,
ffmpegfor recordings, and (opt-in,AGENTBOX_WITH_ANDROID)scrcpyfor the Android emulator screen; - mise, and through it the tools pinned in
tools.txtthat every agent gets: Go, Node, Claude Code, the GitHub CLI, the Playwright MCP server, and Codex/OpenCode where requested. OpenCode 2 is not intools.txtor the image: each agent installs its npm platform package at its first OpenCode 2 start (needs the network then) and links it asopencode2in the user's~/.local/bin, the host's lead does the same the first time it needs it, and the installation settingopencode_versionchooses which one agents and the project chat run; - a placeholder user,
agent(UID/GID 1000), in thesudoanddockergroups; - a check at the end that every pinned tool actually reports the version it was asked to install.
Agents that run Docker pull Docker Hub's images through one cache that AgentBox's daemon keeps in
its VM, on the agents' disk, so an image several agents use is downloaded and stored once. It's on
by default, holds at most 20 GiB or an eighth of its disk, whichever is less (the least recently used
images go first), and never fills the disk past its floor. A --max bigger than the disk can hold is
capped, with a warning.
Settings → Storage and machine → "Share Docker images between agents" turns it off, changes its size, shows
what it holds and empties it; so does agentbox docker-cache [on|off] [--max 30GiB] [--clear].
- Each agent's
/etc/docker/daemon.jsonlists the cache inregistry-mirrors, athttp://127.0.0.1:47500inside the agent;docker info | grep -A2 Mirrorsshows it. Agents that already exist get it when they next start: no rebuild needed. - Only Docker Hub goes through it. Images from
ghcr.io,quay.ioand other registries are pulled from them directly by every agent, because Docker's mirror setting only covers Docker Hub. - If the cache can't answer (the daemon is restarting, or Docker Hub is unreachable from it), Docker pulls from Docker Hub itself, as it does whenever a mirror fails.
Agents' package managers download into caches that AgentBox keeps in its VM and every agent shares,
so a new agent installs from what earlier ones fetched instead of downloading it all again: pnpm's
store, npm's cache and npx, Yarn 2+ (Berry), Go's module and build caches, pip, uv, Corepack's
package managers and Playwright's browsers. They're on the agents' disk, outlive the agents, are on
by default, hold at most 20 GiB together or an eighth of their disk, whichever is less (what was used
longest ago goes first), and never fill the disk past its floor.
Settings → Storage and machine → "Share package caches between agents" turns them off, changes their size,
shows what they hold and empties them; so does agentbox package-cache [on|off] [--max 30GiB] [--clear].
- They're mounted at
/var/cache/agentbox/packagesin every agent, and the agent's environment points the tools there (npm_config_cache,pnpm_config_store_dir,GOMODCACHE,GOCACHE,PIP_CACHE_DIR,UV_CACHE_DIR,COREPACK_HOME,PLAYWRIGHT_BROWSERS_PATH). pnpm 10 and older read~/.config/pnpm/rc, Yarn Berry~/.yarnrc.yml; a value you set there yourself is kept. Agents that already exist get them when they next start. - Only downloads go there. Logins, tokens,
.envfiles and npm's logs stay in each agent. Every agent of every project reads them, though, so a private package one project installs is in the cache for the others too. - Yarn 1 keeps a cache per agent, as it can't share one between agents installing at the same time.
- A project's
node_modulesis copied from pnpm's store rather than hard-linked, as the two are on different disks: still much faster than downloading. - Turned off, agents go back to caches of their own when their shells next start.
agentbox-base/ready still has the placeholder agent user in it when it's built.
personalise.sh renames that user to the host's own — same
UID/GID or a new one, same group memberships and subordinate UID/GID ranges, /etc/sudoers.d/ 90-agentbox and /etc/subuid//etc/subgid rewritten to match — the moment before a machine
snapshots its own container as ready to clone from. It can be checked without Incus at all:
sudo scripts/check-personalise.sh runs it against a real Debian 13 root filesystem (pulled via
Docker) in a chroot, across cases like a plain rename, a new UID/GID, a clash with an existing
system account, and a placeholder left unchanged.
The Base image workflow builds the image the way a new
machine does, on pull requests that touch internal/image/, so a provision.sh change is checked
end to end. It publishes nothing.
The Published image workflow builds the image that is
downloaded, for amd64 and arm64, on pushes to main that touch internal/image/, and publishes
it with scripts/github-images.sh as the image-<version> release, which
deletes the previous image release and its tag. GitHub caps an asset at 2 GiB, so the image is split
into parts of 1 GiB that Setup joins.