Quickstart
In about ten minutes you build codeband from source, start its two long-running processes with codeband dev and run intake, the example pipeline in examples/py-factory. At the end, codeband run prints no code change and the paths of two tickets, 01-fix-the-crash-on-start.md and 02-add-a-dark-mode.md, in a folder named after the run in /tmp/py-factory-tickets. If a function step fails, see Troubleshooting at the end of this page.
| Term | Meaning |
|---|---|
| Pipeline | A function in your code that codeband runs. Here it is intake. |
| Run | One execution of a pipeline for one input, from start to end. |
| Function step | A function the pipeline calls whose result codeband records, so it runs only once per run. |
| Factory | The folder that holds your pipelines. Here it is examples/py-factory, under the name py-factory. |
| Factory code server | The process that loads your factory and runs its pipeline code. The docs call it the code server for short. |
| Daemon | The process that starts runs and records what happens in them. |
The Glossary defines every term the docs use.
Before you start
Section titled “Before you start”| Tool | Version | Used for | Check |
|---|---|---|---|
| Git | 2.42 or later | Cloning codeband, and the workspaces of runs | git --version |
| Go | 1.27.2 or later | Building codeband |
go version |
| uv | any recent | Python and the Python SDK for the example | uv --version |
| just | any recent | Building codeband and starting codeband dev in the example |
just --version |
You don’t need to install Python. uv downloads Python 3.12 the first time the example needs it.
intake runs no agent, so you need neither Claude Code nor a Claude Code login, and the run costs nothing. A pipeline whose agents run on Claude Code needs Claude Code 2.1.330 or later and a login, in the environment of the daemon or in codeband.toml. An agent step without them fails with the attempt failure kind setup.
How the parts fit together
Section titled “How the parts fit together”codeband run asks the daemon to start a run, and the daemon asks the code server to run the pipeline. The daemon and the code server keep running, and codeband dev runs both in one terminal. They find each other through Unix sockets in one state folder, $XDG_STATE_HOME/codeband or, when XDG_STATE_HOME is not set, ~/.local/state/codeband. Architecture shows all the parts and follows one run through them.
-
Clone and build codeband
In a terminal, clone the repository and build the binary:
Terminal window git clone https://github.com/dennis-tra/codebandcd codebandjust buildjust buildprints the two Go commands it runs and writes the binary tobuild/codeband. If Go has not downloaded codeband’s modules before, it also prints ago: downloadingline for each module it fetches.Output go build ./...go build -o build/ ./cmd/...Run every command on this page from the
codebandfolder. -
Start the daemon and the code server
Open a second terminal, change to the
codebandfolder you cloned and startcodeband devin the example:Terminal window just examples/py-factory/devOn the first start, uv creates a Python environment in
examples/py-factory/.venv, installs the Python SDK and prints its progress, shown as…below.codeband devlogs that it found no config file and the version of git that it checked, serves the web interface and prints its address with a secret token, then starts the code server, which logs the pipelines it loaded,intakeamong them.codeband devwrites the records of both processes in one format, andcompnames the part that logged each one:daemon,weborcodeserver. Then the daemon starts and asks the code server which pipelines its source defines. Both keep running:Output uv run go run ../../cmd/codeband dev…Nov 24 10:16:33.066 INF Read no config file comp=daemon searched="codeband.toml, ~/.config/codeband/codeband.toml"Nov 24 10:16:33.072 INF Checked programs comp=daemon git=2.53.0Nov 24 10:16:33.073 INF Serving the web interface comp=web addr=127.0.0.1:8765http://127.0.0.1:8765/?token=6EGHLUQPNTZGR2EWX2HUGA3KWQNov 24 10:16:33.073 INF Started code server comp=daemon command=…/codeband/examples/py-factory/.venv/bin/codeband-codeserver pid=19472Nov 24 10:16:33.074 INF Waiting for the code server comp=daemon code_server=unix:…/codeband/codeserver.sockNov 24 10:16:33.657 INF Loaded pipelines comp=codeserver pipelines="[intake run_program ship_feature write_hello]" folder=…/codeband/examples/py-factoryNov 24 10:16:33.684 INF Serving pipelines comp=codeserver address=unix:…/codeband/codeserver.sockNov 24 10:16:33.696 INF Starting daemon comp=daemon state_dir=…/codeband store_dir=…/codeband/store rate_limit_backoff="[5m0s 15m0s]" version=(devel)Nov 24 10:16:33.697 INF Listening comp=daemon socket=…/codeband/daemon.sockcodeband devserves the factory in its working folder under the name of that folder,py-factory. Every command and every page of the web interface names a pipeline after its factory, sointakeispy-factory/intake.Your token is different:
codeband devmakes a new one at each start. Open the address with the token in a browser. The page keeps the token, sohttp://127.0.0.1:8765/?pipeline=py-factory/intakethen shows the preview graph ofintakein this browser. -
Run
intakeBack in the first terminal, make a folder for the tickets and start a run:
Terminal window mkdir -p /tmp/py-factory-ticketsbuild/codeband run py-factory/intake --tickets /tmp/py-factory-tickets \--input '{"title": "Release 1.2", "body": "- Fix the crash on start\n- Add a dark mode"}'--inputis the run input, as JSON: a request for work whose body has one Markdown bullet per ticket. The run works on the git repository of the folder you start it in, here your codeband clone at itsHEADcommit.intakechanges no code in it and ends the run with one new ticket per bullet.--ticketsnames the folder that codeband writes the new tickets to. Without it, they go next to the patch file of the run, in the current folder.codeband runprints the ID of the run, a line for each function step of the run, how the run ended and the path of the file of each new ticket, then exits with code 0. Your run ID is different:Output Started run 1kv1d7fngj✓ received_at#0 function step✓ post_summary#0 function stepno code changenew ticket: Fix the crash on start: /tmp/py-factory-tickets/1kv1d7fngj/01-fix-the-crash-on-start.mdnew ticket: Add a dark mode: /tmp/py-factory-tickets/1kv1d7fngj/02-add-a-dark-mode.md -
Check the tickets
Show the first ticket, with your run ID in place of
RUN_ID:Terminal window cat /tmp/py-factory-tickets/RUN_ID/01-fix-the-crash-on-start.mdThe file has the ticket’s tags in YAML front matter, its title as the first heading, its body and a line that names the run:
Output ---tags: ["bug","small"]---# Fix the crash on startPart of the request Release 1.2.From codeband run 1kv1d7fngj.Leave
codeband devrunning for the optional stop below. To stop the daemon, the code server and the web interface, press Ctrl-C in its terminal.codeband devlogsStopping code serverand exits once the code server has stopped. To remove the tickets, runrm -rf /tmp/py-factory-tickets.
What the run did
Section titled “What the run did”intake is the pipeline function below. plan_tickets is plain pipeline code: it makes one ticket per bullet and gives the same plan for the same input. received_at and post_summary are function steps. post_summary sends a summary to the webhook in PY_FACTORY_WEBHOOK. You didn’t set one, so it sent nothing. The function returns a run result with the tickets and no code change, and the daemon writes each ticket as a file. The pipeline holds no code that writes tickets.
"""The pipelines of this factory. pyproject.toml lists them under [tool.codeband]."""
import contextlibfrom datetime import datetime
import codeband as cb
from py_factory.function_steps import post_summary, received_atfrom py_factory.models import Plan, Ticketfrom py_factory.planning import plan_tickets
@cb.pipelinedef intake(title: str, body: str, max_tickets: int = 5) -> cb.RunResult | None: """Plan one ticket per Markdown bullet of the body of a request for work, as a person writes it.
The run stops when the body has no bullet or more than max_tickets. It ends with the tickets in its run result and no code change, and the daemon delivers the tickets. """ plan = plan_tickets(title, body) if not plan.tickets: raise cb.Stop("the request has no tickets: write each one as a '- ' bullet")
if len(plan.tickets) > max_tickets: raise cb.Stop(f"the request has {len(plan.tickets)} tickets, more than {max_tickets}: split it")
received = received_at()
# The run still ends with its tickets when the summary fails to send. The run journal keeps the function step's # error. with contextlib.suppress(cb.FunctionStepFailedError): post_summary(_summary(plan, received))
return cb.RunResult(tickets=[_new_ticket(plan, t) for t in plan.tickets])
def _new_ticket(plan: Plan, ticket: Ticket) -> cb.NewTicket: return cb.NewTicket(title=ticket.title, body=f"Part of the request {plan.title}.", tags=[ticket.kind, ticket.size])
def _summary(plan: Plan, received: datetime) -> str: lines = [f"{plan.title}: {len(plan.tickets)} tickets at {received:%Y-%m-%d %H:%M:%S} UTC"] lines += [f"- {t.kind}, {t.size}: {t.title}" for t in plan.tickets]
return "\n".join(lines)The terminal of codeband dev shows the run from both processes. The daemon logs each step, named after its function step with a counter, and requested_by is your user name. The code server logs three Invoked pipeline records with pipeline=intake, one per invocation. The code server does not know the name of its factory, so only the daemon’s records say py-factory/intake:
Nov 24 10:16:35.081 INF Invoked pipeline comp=codeserver pipeline=intake end=function_step_finishedNov 24 10:16:35.142 INF Started run comp=daemon run=1kv1d7fngj pipeline=py-factory/intake requested_by=…Nov 24 10:16:35.143 INF Step started comp=daemon run=1kv1d7fngj step=received_at#0Nov 24 10:16:35.143 INF Step finished comp=daemon run=1kv1d7fngj step=received_at#0Nov 24 10:16:35.157 INF Invoked pipeline comp=codeserver pipeline=intake end=function_step_finishedNov 24 10:16:35.158 INF Step started comp=daemon run=1kv1d7fngj step=post_summary#0Nov 24 10:16:35.158 INF Step finished comp=daemon run=1kv1d7fngj step=post_summary#0Nov 24 10:16:35.174 INF Invoked pipeline comp=codeserver pipeline=intake end=finishedNov 24 10:16:35.201 INF Run finished comp=daemon run=1kv1d7fngj status=finished reason=""An invocation runs the pipeline function from the start. Each function step that already ran returns its recorded value instead of running again, and the invocation ends after the first function step that has no record. Running the pipeline function again against the recorded values is called run replay. It runs each function step once per run, however often the pipeline function runs.
The first invocation comes before the daemon’s Started run line, because the daemon creates the run only after the code server accepts the run input. The daemon logs a step when it records the function step’s result, so each Step line comes a little after the invocation that ran the function step.
Optional: Stop a run on purpose
Section titled “Optional: Stop a run on purpose”Start a run whose body has no bullet:
build/codeband run py-factory/intake --input '{"title": "Release 1.3", "body": "Fix the crash on start"}'intake raises cb.Stop, so codeband run prints the reason and exits with code 3:
Started run h730zgtqgmstopped: the request has no tickets: write each one as a '- ' bulletThe code server logs one invocation. The daemon logs the same reason, and the run writes no tickets:
Nov 24 10:16:36.300 INF Invoked pipeline comp=codeserver pipeline=intake end=finishedNov 24 10:16:36.301 INF Started run comp=daemon run=h730zgtqgm pipeline=py-factory/intake requested_by=…Nov 24 10:16:36.317 INF Run finished comp=daemon run=h730zgtqgm status=stopped reason="the request has no tickets: write each one as a '- ' bullet"Press Ctrl-C in the terminal of codeband dev to stop the daemon, the code server and the web interface, and delete the tickets with rm -rf /tmp/py-factory-tickets.
Troubleshooting
Section titled “Troubleshooting”For an error that the steps on this page don’t cover, see Run problems.
no daemon answers on …: start one with 'codeband daemon'
Section titled “no daemon answers on …: start one with 'codeband daemon'”No daemon listens in the state folder that codeband run uses, and the command exits with code 2. Start codeband dev as in step 2. If you set XDG_STATE_HOME or CODEBAND_STATE_DIR in one terminal, set the same value in the other.
check git: …
Section titled “check git: …”git is missing from the PATH, or older than the version in Before you start, and codeband dev exits with code 1. The rest of the line names the version it found. Install or update git, then start codeband dev as in step 2.
the code server exited: …
Section titled “the code server exited: …”The code server stopped on its own before it answered, so codeband dev stopped the daemon and exited with code 1. The records with comp=codeserver above the error say why. Fix that cause, then start codeband dev as in step 2.
another daemon uses the state folder …
Section titled “another daemon uses the state folder …”A daemon already runs with this state folder, in another terminal or in the background, and codeband dev exits with code 1. Stop that daemon with Ctrl-C, then start codeband dev as in step 2.
start run: run request rejected: the pipeline does not accept the input: …
Section titled “start run: run request rejected: the pipeline does not accept the input: …”The run input misses title or body. Copy the command of step 3 whole: the \ at the end of its first line continues the command on the next line.