Skip to main content

Node image reference

The node image runs the Breign CLI as an execution node. It is configured only through environment variables, so the same image serves every node of a cluster. To set up a cluster, start with Run a cluster of execution nodes.

Get the image​

Build it from the Breign CLI sources, with Podman or Docker, at the root of the repository:

podman build -f container/Containerfile -t breign-node .
docker build -f container/Containerfile -t breign-node .

Then push it to the registry your cluster pulls from.

Build options​

ArgumentEffect
WITH_CLAUDE=1Adds Claude Code (and Node.js)
WITH_OPENCODE=1Adds OpenCode
docker build -f container/Containerfile --build-arg WITH_CLAUDE=1 -t breign-node:claude .

Without them, the node only has fx, the base runtime: the node downloads it on first start, keeps it on its volume and follows its new versions. fx uses the agent's model, set in Breign, through the Breign AI Gateway: there is no account to connect.

Environment variables​

Connection​

VariableRole
BREIGN_SERVERRequired. The Breign API, for example https://api.breign.eu
BREIGN_API_KEYRequired, or BREIGN_API_KEY_FILE. The API key of the account that owns the node
BREIGN_API_KEY_FILEA file that contains the API key (a Kubernetes or Docker secret). Read by every breign command in the container
BREIGN_ORGThe organization (id, slug or name) in which BREIGN_NODE_GROUP is looked up by name
BREIGN_NODE_GROUPThe group to join: its name in BREIGN_ORG (case-insensitive), or its id

On every start, once connected, the node associates itself with the group's organization, then joins the group. Both steps do nothing if they were already done. If the group cannot be found or the account is not allowed to join it, the node stops with an error.

Without BREIGN_NODE_GROUP, the node only connects. You can then add it to a group from Breign App, or bind agents to it directly.

Node​

VariableRoleDefault
BREIGN_NODE_NAMEThe node's name in Breign<container hostname> (CLI)
BREIGN_NODE_SLOTSExecutions the node runs at the same time (1 to 32)1
BREIGN_NODE_WORKSPACESThe working folders, see belowworkspace=/workspace
BREIGN_NODE_TOOLSThe tools Claude Code uses without asking, separated by spacesRead Edit Write Glob Grep Bash
BREIGN_NODE_MODEL_CLAUDEThe model imposed on Claude Codethe CLI's choice
BREIGN_NODE_MODEL_OPENCODEThe model imposed on OpenCodethe CLI's choice
BREIGN_FX_VERSIONPins fx to this versionlatest, followed
BREIGN_LOGLog level: info or debuginfo

Working folders​

BREIGN_NODE_WORKSPACES lists the folders where agents may work, separated by commas, each written alias=path or alias=path=label:

BREIGN_NODE_WORKSPACES="workspace=/workspace=Workspace,docs=/srv/docs"
  • Only the alias is sent to Breign. An agent bound to a group works in a folder chosen by its alias: every node of the group must declare it.
  • An alias has lowercase letters, digits and dashes, 63 characters at most.
  • Missing folders are created. Folders removed from the list are removed from the node on the next start.
  • In a folder that is a git repository, each conversation gets its own worktree, so the node can run several of them at once. In any other folder, the node runs one execution at a time.

Runtimes​

VariableRole
ANTHROPIC_API_KEYSigns Claude Code in (image built with WITH_CLAUDE=1)

OpenCode reads its usual configuration and provider variables. The Breign API key is never passed to Claude Code, OpenCode or fx during turns.

Volumes​

PathContent
/var/lib/breignTo keep, one per node. The node's identity, settings, queue, environments kept for conversations, cloned Git repositories (repos/, envs/), fx, and the home folder of the CLIs
/workspaceThe default working folder

Without a volume on /var/lib/breign, each start creates a new node in Breign, and the previous one stays listed, offline. A lock prevents two nodes from running on the same volume on one machine; on a network volume, this lock is not guaranteed.

Git repositories​

An agent can work on Git repositories instead of a folder (see Work on Git repositories). The node then:

  • keeps a shared partial mirror of each repository in /var/lib/breign/repos (purged after 14 days without use), and one worktree per conversation in /var/lib/breign/envs/<environment>/<folder>;
  • clones in the background, at most 4 repositories at a time: the turn waits in the queue meanwhile;
  • gets Git credentials from Breign when Git asks for them, through the breign binary used as a credential helper, only during the turn: nothing is written to disk. Only HTTPS repositories are supported;
  • removes the dependencies and build outputs ignored by Git (node_modules, target, .next…) of environments idle for an hour, and of every idle environment above 80 % of the disk;
  • never deletes an environment with uncommitted changes or commits that aren't pushed, even when Breign asks it to release it;
  • reports its disk to Breign, which stops giving it new environments above 90 % (MATE__DISK_HARD_LIMIT_PERCENT).

Dependencies weigh far more than code (around 2 GB for a typical JavaScript repository once installed). Plan 15 to 20 GB for /var/lib/breign on a node that clones repositories; 2 GB is enough otherwise.

User and signals​

  • The node runs as user breign (uid and gid 10001). On Kubernetes, set fsGroup: 10001 so the volumes are writable.
  • SIGTERM (or SIGINT) interrupts the running turn, then disconnects the node. Allow at least a few seconds before the container is killed (60 s in the examples).

Health checks​

CommandSucceeds whenUse
breign-node-healthcheckthe node runs and Breign sees it connectedreadiness
breign-node-healthcheck --livethe node runsliveness

Do not use the full check for liveness: a Breign outage would restart every node.

The image also declares a Docker HEALTHCHECK (full check). Podman only keeps it when building with --format docker.

Commands in the container​

docker exec (or kubectl exec) runs a command next to the running node, with the same configuration. A command passed to docker run replaces the node's start.

docker exec breign-node breign node status
docker exec breign-node breign node envs
docker exec breign-node breign node unpair
CommandEffect
breign node statusIdentity, folders, CLIs, and what Breign knows about the node
breign node envsEnvironments kept for conversations
breign node join <group> / breign node leave <group>Joins or leaves a group (name in BREIGN_ORG, or id)
breign node unpairRevokes the node: it receives no more turns and forgets its identity