Skip to content
codeband is pre-release. These docs describe its first release, and some of what they describe is still being built.

codeband.toml

codeband.toml is the config file of codeband daemon and codeband dev. It has five kinds of table. Each [factories.NAME] table names a factory and the address of its code server. [env] names the environment variables that every agent step and every shell step gets, and where each value comes from. Each [sandbox.NAME] table is a sandbox definition that a pipeline can name. [github] names the token with which the daemon opens a pull request and files GitHub issues, and the repositories whose issues start runs. [run_result] limits the new tickets of a run.

codeband daemon needs the file, because it needs at least one [factories.NAME] table. codeband dev works without the file and fails when the file has a factories table, because it serves only the factory in its working folder. Without [env], an agent step on Claude Code gets its login from CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY in the daemon’s environment. Without a [sandbox.NAME] table, every pipeline that names no sandbox runs its steps as processes on the daemon’s machine. Without [github], codeband run --pr fails.

codeband.toml
[factories.factory]
code_server = "http://factory-codeserver:8080"
[factories.webshop]
code_server = "unix:/var/run/codeband/webshop.sock"
[env]
CLAUDE_CODE_OAUTH_TOKEN = { command = ["op", "read", "op://Private/claude/token"] }
DATABASE_URL = { env = "DATABASE_URL" }
GOPRIVATE = { value = "example.com/*" }
[sandbox.go]
kind = "host"
[sandbox.go.env]
GOFLAGS = { value = "-mod=readonly" }
[github]
token = { command = ["gh", "auth", "token"] }
repositories = ["acme/webshop"]

With this file, the daemon serves the pipelines of two factories, such as factory/implement and webshop/release. Each attempt and each shell step gets a token that the 1Password CLI reads at the moment it starts, the DATABASE_URL of the daemon’s environment and a fixed GOPRIVATE. The attempts and shell steps of a pipeline that names the sandbox go also get GOFLAGS. A pull request gets the token of the GitHub CLI’s login, and a label such as codeband/webshop/release on an issue of acme/webshop starts a run.

The daemon reads one file, once, when it starts. It takes the first of these that exists and never merges two files:

Order File
1 The path of --config, or of CODEBAND_CONFIG. The daemon exits with code 1 when this file does not exist
2 codeband.toml in the working folder of the daemon
3 codeband.toml in $XDG_CONFIG_HOME/codeband, or in ~/.config/codeband when XDG_CONFIG_HOME is not set

The daemon logs the path of the file it read, or the places it searched:

Nov 25 16:43:55.206 INF Read the config file comp=daemon path=~/src/my-pipelines/codeband.toml
Nov 25 16:43:57.233 INF Read no config file comp=daemon searched="codeband.toml, ~/.config/codeband/codeband.toml"

No other command reads the file. A changed file applies after a restart of the daemon.

Each [factories.NAME] table is one factory of the daemon. NAME is the name of the factory, and it holds lowercase letters, digits, - and _. Whoever runs the daemon gives the name; the code server never learns it. Every command, every output and every screen of the web interface names a pipeline as NAME/PIPELINE, such as factory/implement, and never by its name alone.

Key Type Holds
code_server string The address of the code server of the factory, as unix:PATH or http://HOST:PORT. Required

The daemon dials each address when it starts, and starts no code server. Start each one with codeband codeserver in its factory, with the same address, before or after the daemon. Two tables with the same address are an error, because one code server runs the code of one factory. A pipeline of one factory calls only the agents and the function steps of that factory. Every factory gets the variables of the one [env] table.

A factory whose code server does not answer, or whose code does not load, has failed. The daemon starts anyway, logs the name of the factory with the reason, and serves the other factories. The runs of the failed factory wait until it is back. codeband check reports it, and the pipelines screen of the web interface shows it with its reason.

To add, remove or rename a factory, change its table and restart the daemon. Runs go on after the restart. A run whose factory is no longer in the file waits, as it does while its code server does not answer, until the factory is back or a person cancels the run.

The daemon and its code servers run in one network, and that network protects them: whoever reaches the address of a code server can run its function steps. Keep http:// addresses inside a private network.

Each key of [env] is the name of an environment variable. Its value is an inline table with exactly one of three keys, its source:

Key Type The value of the variable It has a value when
value string The string The string is not empty
env string The variable of that name in the daemon’s environment The daemon’s environment sets it, and not to an empty string
command array of strings The standard output of the program, without its last newline The program exits with code 0 within 30 seconds and prints something

The daemon reads every source again when an attempt or a shell step starts, and keeps no copy of a value. A token that you rotate in your password manager applies from the next attempt, without a restart of the daemon.

The first string is the program, a name on the daemon’s PATH or a path, and the others are its arguments. No shell reads them, so ["sh", "-c", "..."] is how to write a pipe. The program runs in the working folder of the daemon and with the daemon’s whole environment, so that a password manager finds its session. Its standard input is empty.

A program that is still running after 30 seconds is killed, and the variable has no value. A command source runs at every attempt start and every shell step start, so a pipeline that runs its tests in a loop runs the command each time. Agent steps that run in parallel run their commands at the same time.

Each harness has login variables, in its order of preference:

Harness Login variables
Claude Code CLAUDE_CODE_OAUTH_TOKEN, then ANTHROPIC_API_KEY
Fake None

When [env] lists none of the login variables of a harness, the daemon adds the first one that its own environment sets, and leaves out the others. When [env] lists one of them, the daemon adds none for that harness. With ANTHROPIC_API_KEY in [env], a CLAUDE_CODE_OAUTH_TOKEN in the daemon’s environment does not reach any agent step.

Each [sandbox.NAME] table is one sandbox definition, from which the daemon makes the sandbox of each attempt and each shell step of the pipelines that name it. NAME is the name that a pipeline gives, such as go for @cb.pipeline(sandbox="go"). The pipeline names the sandbox, and the file says what the name means, so one factory runs on a laptop and on a server with different definitions.

Key Type Holds
kind string The kind of the sandboxes. host runs each attempt and each shell step as a process on the daemon’s machine, without isolation. docker runs each in a new Docker container. Required
image string The image of the containers of the kind docker, as docker pull names it, such as ghcr.io/example/go-agents:1.25. Required for docker, and refused for host
docker table The settings of each container of the kind docker, with the field names of the HostConfig type of Docker’s API, as The kind docker describes. Refused for host
env table Variables for this definition only, each with one source as in [env]. They come after the variables of [env], and a variable of the definition wins over one of [env] with the same name
codeband.toml
[env]
GOFLAGS = { value = "-mod=mod" }
[sandbox.go]
kind = "host"
[sandbox.go.env]
GOFLAGS = { value = "-mod=readonly" }
CGO_ENABLED = { value = "0" }

With this file, the attempts and shell steps of a pipeline that names go get GOFLAGS=-mod=readonly and CGO_ENABLED=0. Those of the other pipelines get GOFLAGS=-mod=mod, and no CGO_ENABLED.

The kind host protects nothing: an agent with full permissions reads and changes every file that the person who runs the daemon can. Use the kind docker for an agent that you do not watch.

A pipeline that names no sandbox uses the definition default. Without a [sandbox.default] table, default is of kind host and has no variables of its own, so its attempts and shell steps get the variables of [env]. A [sandbox.default] table replaces it.

The step request of an agent step records the name of its sandbox definition, the kind and, for the kind docker, the ID of the image that ran, such as sha256:4f6c…. The run journal records the same for a shell step. Neither records a setting or a value of a variable.

An agent step of a pipeline whose sandbox name the file does not define fails with the attempt failure kind setup after one attempt. The message names the sandbox and the file:

the pipeline names the sandbox go, which ~/.config/codeband/codeband.toml does not define: add a [sandbox.go] table

A shell step of such a pipeline gets ok=False, with the same message after codeband: as the one line of its output. codeband check does not test sandbox definitions. For a pipeline in a sandbox of the kind docker, it also skips the test of the harness program.

codeband.toml
[sandbox.go]
kind = "docker"
image = "ghcr.io/example/go-agents:1.25"
[sandbox.go.docker]
NetworkMode = "agents"
Memory = 8589934592
[[sandbox.go.docker.Mounts]]
Type = "volume"
Source = "gocache"
Target = "/home/agent/.cache"

With this file, each attempt and each shell step of a pipeline that names go runs in a new container of the image ghcr.io/example/go-agents:1.25, on the Docker network agents, with at most 8 GiB of memory and the volume gocache at /home/agent/.cache. The daemon removes the container at the end of the attempt or shell step, also after a failure and a cancellation. Files outside a volume do not reach the next attempt or shell step.

The daemon finds Docker as the docker program does: DOCKER_HOST first, then the context that DOCKER_CONTEXT names, then the current context of the Docker config in DOCKER_CONFIG or ~/.docker, then /var/run/docker.sock. Docker Desktop works without a setting. It talks to Docker through its API, not through the docker program.

The docker table takes Docker’s own field names, with the fields of the container’s resources, such as Memory and NanoCpus, at the top level of the table. The daemon matches them without regard to case. A key that HostConfig does not have stops the daemon at start. PortBindings cannot be set. codeband adds no setting of its own and sets no network rules, so a container reaches the internet unless the table limits it. Limit the network of a Docker sandbox limits it to the domains of an allow list.

The image holds everything that runs in the container: git, sh, cat, mktemp, sleep, tr, grep and the program of every harness that the pipeline’s agents use. The daemon installs nothing in a container and never pulls an image. It mounts no folder of its machine, and the workspace is a git repository inside the container. The sandbox that a harness brings, such as the one of Claude Code, is off in a container.

The workspace’s repository reads old commits from the repository cache of its target repository: a Docker volume named codeband-cache- and 16 hex digits, which each container mounts read-only at /codeband/cache. The daemon makes the volume when a run first needs it. Before the first sandbox of a run opens its workspace, the daemon adds the commits up to the run’s start commit that the volume lacks. It writes them from a container of the same image, which runs as root, without a network, and runs only git. That container does not get the settings of the [sandbox.NAME.docker] table. No key turns the cache off. The volume carries the label codeband.state-dir with the daemon’s state folder, and the daemon never removes it. When you delete it with docker volume rm, the next run builds it again.

Every program in the container runs as the user of the image. The example examples/docker-sandbox builds an image with git, Claude Code and Codex CLI and the user agent, which is not root. Copy its Dockerfile and add the toolchain of your target repositories, as Run a pipeline in a Docker sandbox shows. A volume needs a folder of the image that belongs to that user, such as /home/agent/.cache: Docker creates a missing mount point as a folder of root.

The daemon labels each of its containers with its state folder. When it starts, it removes the containers that an earlier daemon of the same state folder left behind, for example after a crash, and logs Removed the containers that an earlier daemon left behind. A daemon whose config file has no definition of the kind docker does not connect to Docker.

An agent step whose image is not on the machine fails with the attempt failure kind setup after one attempt, and the message holds the command that gets the image:

start the sandbox: the image ghcr.io/example/go-agents:1.25 is not on this machine, and codeband pulls no image: run docker pull ghcr.io/example/go-agents:1.25

An agent step that reaches no Docker also fails with setup, and the message says where the daemon looked. A shell step in either case gets ok=False, with the message after codeband: as its output. Run problems has the fixes.

The program of each attempt and of each shell step gets these variables, in this order. When two have the same name, the later one wins:

Order Variables
1 For the kind host, PATH, HOME and USER of the daemon’s environment. For the kind docker, the variables of the image, such as PATH, and the HOME of its user
2 The variables of [env], then those of the env table of the pipeline’s sandbox definition, and the default login variables
3 For a shell step, the variables that its env names, from the daemon’s environment
4 The variables that codeband sets: the config folder of the harness and the git identity of the agent’s commits

The harness program of an agent step, the commands that its agent runs and the program of a shell step get the same variables from codeband. A PATH in [env] reaches both, and codeband finds the harness program and the program of a shell step on that PATH. Nothing else of the daemon’s environment reaches them.

A harness can add variables: the Bash tool of Claude Code reads your shell profile, such as ~/.zshrc, before it runs a command, and a shell step reads no profile. A tool that your profile sets up, such as asdf with its ASDF_DATA_DIR, then passes in an agent step and fails in a shell step. Add each variable that such a tool needs to [env], as A shell step fails, but the same command passes in an agent step shows.

The run journal records the sorted names of the variables of rows 2 and 3 for each attempt and each shell step, and never a value.

A program that prints its environment puts each value, a login among them, into what its attempt or shell step gives. The daemon replaces the value of each masked variable with *** in the agent transcript, the step output, the message of an attempt failure and the output of a shell step, before it records them and before codeband run and the web interface get them. It also replaces the form that a value has inside a JSON string, such as a value with a quote or a newline. Your pipeline code gets the masked step output, at the first run and at each run replay.

Variable Masked
A variable of [env] or of a sandbox definition whose source is env or command Yes
A default login variable Yes
A variable that a shell step names in its env Yes
A variable whose source is value No
A variable that codeband sets, such as the git identity No

Put each secret into an env or a command source. A fixed value is not masked, because CGO_ENABLED = { value = "0" } would replace every 0. The daemon replaces a masked value wherever it appears, also a short one in ordinary text. A step output that no longer fits its output type after that fails the attempt with invalid_output. A line of the raw agent transcript that is no longer JSON after that is left out when the web interface reads the transcript of an ended attempt. The daemon does not find a value that an agent changed, such as an encoded login.

A variable without a value stops the attempt or the shell step before its program starts. The message names the variable and the reason. For a failed command, the reason holds the exit code or the time limit and the first line of the program’s standard error, never its standard output.

An attempt fails with the attempt failure kind setup:

the variable CLAUDE_CODE_OAUTH_TOKEN has no value: its command ran past its time limit of 30s

An agent step on Claude Code also fails with setup when no login variable of Claude Code has a value:

the harness claude has no login: set one of CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY in codeband.toml or in the environment of the daemon

A shell step gets ok=False and one line for each variable in its output, as for a variable of env that the daemon’s environment does not set:

codeband: the variable DATABASE_URL has no value: the daemon's environment does not set DATABASE_URL

For a pull request, the daemon pushes the branch of the code change over HTTPS and opens the pull request through the GitHub REST API with this token. It files the run’s new tickets as issues of the same repository with it too. The token is never part of an attempt or a shell step.

Key Type Holds
token inline table The source of the token, with exactly one of the keys value, env and command, as for a variable of [env]
api_url string The root URL of the GitHub REST API. Without it, https://api.github.com. Tests point it at a fake server
repositories array of strings The GitHub repositories whose issues start runs, each as OWNER/NAME, such as acme/webshop. Without it, no issue starts a run

The token needs read and write access to the contents, the pull requests and the issues of the repository. A fine-grained personal access token with the permissions Contents, Pull requests and Issues set to Read and write fits, and so does the token of gh auth token.

The daemon polls the issues of each repository in repositories with the token. An issue starts a run when a person with write or triage access sets the label codeband/FACTORY/PIPELINE, as Start runs from GitHub issues shows. To check that role, and the role of each person who answers in the issue’s thread, the token also needs read access to the collaborators of the repository, which the permission Metadata gives. The daemon creates the label of each pipeline that takes a ticket in each repository. When the token does not allow that, the daemon logs a warning and codeband check names the missing permission. Runs start anyway, and you create the labels by hand. We recommend an env or command source over value, so that the file holds no secret.

The daemon reads the token when it checks a run request with --pr, before the run starts, and again when it delivers the run’s code change. It keeps no copy, so a new token applies to the next run without a restart. A token without a value rejects the run request, and codeband run exits with code 1:

start run: run request rejected: github.token has no value: the daemon's environment does not set GH_TOKEN

Without a [github] table, the message is codeband.toml sets no github.token.

Limits on what a run delivers.

Key Type Holds
max_new_tickets integer The most new tickets that one run delivers. Without it, 5. The run journal keeps each new ticket over the limit with the reason over the limit of N new tickets
[run_result]
max_new_tickets = 10

The daemon checks the file when it starts. On an error it prints the path of the file and the key, and exits with code 1:

The daemon prints Because
config file …/codeband.toml: unknown key env.X.comand A key that the file format does not have, here a typo of command
config file …/codeband.toml: unknown table [sources]: codeband.toml has the tables [factories.NAME], [env], [github] and [sandbox.NAME] A table that the file format does not have, here [sources.hello]
config file …/codeband.toml: unknown key sandbox.go.images A key that a [sandbox.NAME] table does not have
config file …/codeband.toml: unknown key sandbox.go.docker.Memroy A key of [sandbox.go.docker] that the HostConfig type of Docker’s API does not have, here a typo of Memory
config file …/codeband.toml: sandbox.go: no kind: set kind = "host" or kind = "docker" The table of go has no kind
config file …/codeband.toml: sandbox.go.kind: unknown kind "podman": the kinds are host and docker The kind of go is not a kind of sandbox
config file …/codeband.toml: sandbox.go: no image: set image = "NAME", the image of the containers The table of go is of the kind docker and has no image
config file …/codeband.toml: sandbox.go.image: only the kind docker has an image The table of go is of the kind host and has an image
config file …/codeband.toml: sandbox.go.docker: only the kind docker has a docker table The table of go is of the kind host and has a docker table
config file …/codeband.toml: env.X: no source: set one of value, env and command The table of X is empty
config file …/codeband.toml: env.X: 2 sources: set only one of value, env and command The table of X has more than one source
config file …/codeband.toml: env.X: empty command The command of X is an empty array, or its program is an empty string
config file …/codeband.toml: github.token: no source: set one of value, env and command The table of token is empty. The other errors of a source apply to github.token and to a variable of [sandbox.NAME.env], such as sandbox.go.env.GOFLAGS, as to a variable of [env]
config file: stat …: no such file or directory The file of --config or CODEBAND_CONFIG does not exist

The daemon also exits with code 1 when the file has no factories table, when the name of a factory holds another character than lowercase letters, digits, - and _, when a [factories.NAME] table has no code_server or an address of another form, or when two tables have the same code_server. The last error names both tables: config file …/codeband.toml: factories.factory and factories.webshop: the same code_server "http://127.0.0.1:8081": give each factory a code server of its own. codeband dev exits with code 1 when the file has a factories table.

  • codeband CLI: the flags of the daemon, --config among them.
  • Python SDK: the env of a shell step, which adds variables of the daemon’s environment.
  • Run problems: what to do when an agent step fails with the attempt failure kind setup, or when a shell step fails where an agent step passes.
  • Sandbox: where each attempt and each shell step runs, and what the kinds of sandbox protect.
  • Run result: what the daemon pushes for a pull request and when it reuses one.