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

Scorer

A scorer is a function of your factory that judges one finished run and returns its scores. A score is a named judgement of the run: a number, a pass or a fail, or a label from a fixed set, with an explanation.

Scores answer the question that a run journal alone does not: is this factory getting better? One run tells you what happened. The scores of a hundred runs tell you what a pull request costs, how often ci passes on the first try, and whether the run forks on another model did better than their parents. The dashboard of each factory shows them over time, and the page for a run shows them next to its run forks.

The factory factory of the codeband repository has the pipeline ship_ticket, whose agent implementer writes a code change and whose shell step ci checks it. A run of ship_ticket ends with a pull request.

  1. The run ends. The engine asks the code server of the factory to run each of its scorers on the run, and each built-in scorer of the SDK too.
  2. Each scorer gets a read-only view of the finished run: its run input, its run result, every step with its step request, step output, agent transcript, cost and time, and the parent run of a run fork.
  3. Each scorer returns its scores, each under a name. The scorer ci_first_try returns a pass, because the first ci#0 passed. A scorer whose run lacks the evidence for a score returns no score for that name.
  4. The daemon stores the scores next to the run. They are not part of the run journal, because a run never changes.
  5. A week later, the pull request merges. The scorers that read the pull request run again: pr_merged returns a pass, and time_to_merge returns the six days from the start of the run to the merge.

A missing score is never a score of zero. A run that ended without a pull request has no time_to_merge, and the dashboard counts it as missing, not as a merge after zero days.

Value Fits when Example
A number, with an optional unit You measure an amount cost of 2.14 with the unit USD
A pass or a fail A run meets a rule or not ci_first_try passed
A label from a fixed set A judge sorts runs into kinds tests_run or tests_skipped

Each score also has an explanation in text, such as ci#0 passed, which the page for a run shows next to the value.

The SDK ships scorers that run for every run of every factory, without code of yours:

Scorer Value Score
cost Number, USD The cost of the run’s agent steps
time Number, seconds The time from the start to the end of the run
agent_steps Number The number of agent steps
attempt_failures Number The number of attempts that failed
human_steps Number The number of human steps
ci_first_try Pass or fail Whether the first shell step named ci passed. No score for a run without one
pr_merged Pass or fail Whether the run’s pull request merged. No score until it merges or closes
merged_without_human_commit Pass or fail Whether the pull request merged without a commit by a person. No score for a pull request that did not merge
time_to_merge Number, seconds The time from the start of the run to the merge. No score for a pull request that did not merge

The last three score a run with a pull request, and run again when the pull request merges or closes.

A scorer is a function of your factory, next to its pipelines and agents. This one counts the review cycles of a run of ship_ticket:

factory/scorers/review_cycles.py
import codeband as cb
@cb.scorer
def review_cycles(run: cb.ScoredRun) -> cb.Score | None:
"""Count the agent steps of standards_reviewer."""
if run.pipeline != "ship_ticket":
return None
reviews = [step for step in run.steps if step.id.startswith("standards_reviewer#")]
return cb.Score(value=len(reviews), unit="cycles", explanation=f"{len(reviews)} reviews of the code change")

A scorer that needs a model calls an agent as its judge, such as an agent with read access that reads the agent transcript of implementer#0 and returns the label tests_run or tests_skipped. The engine runs that scorer in a scoring run, a run of its own whose run journal records the judge’s agent steps. So a judge’s work is recorded, its cost shows, and you can fork a scoring run at the judge’s agent step like any other run. A scorer with a judge scores a share of runs that you set, all of them by default.

Python SDK lists @cb.scorer, cb.Score and cb.ScoredRun.

You change a scorer, or add one, and want scores for the runs that ended before. The page for a run and the dashboard score one run, or all runs of a pipeline, again. The new scores are added next to the old ones, and the latest score of each name counts. A scorer that changed gives new scores only when you score again, so the dashboard never mixes two versions of a scorer without your choice.

The dashboard of a factory is a screen of the web interface. For each scorer and each week, it shows the median of a number, the share of passes of a pass or a fail, and the share of each label. Next to each value it shows how many runs were scored and how many scores are missing. You filter it by pipeline and group it by model or harness, such as the runs on Claude Code next to the runs on Codex CLI.

The dashboard shows where to look, not why a value changed. A week in which cost went up holds the runs to open, and their pages show what happened.

Return no score when the evidence is missing

Section titled “Return no score when the evidence is missing”

A run without a pull request has no time to merge. Return None, or leave out that name, so that the dashboard counts the run as missing and keeps the median of the runs that have one.

A scorer gets the recorded run. Information from outside, such as the state of a pull request, reaches it through the built-in scorers of the pull request, which the daemon runs again when the pull request changes. A scorer that calls another system scores a run differently each time you score again.

  • Run fork: the runs that the page for a run compares by their scores.
  • Run: the run journal that a scorer reads.
  • Agent: the role that a judge of a scorer is.
  • Web interface: the dashboard and the scores on the page for a run.