Skip to content
The AI Agent Factory

36.5 Evolution: from candidate to release

Approved by
Panaversity ·
10 min read

In everyday life. A new recipe in a restaurant chain is tried in one kitchen for a week before every kitchen uses it. If customers complain, the chain goes back to the old recipe. It cannot take back the meals already served.

What you will learn. The nine states of a candidate, how code enforces the moves between them, what a release is, and what a rollback can and cannot do.

Why it matters. Validation says a change is good on test cases. Release decides whether real work gets it, and how much, and how fast you can take it back.

Nine states

StateMeaningWho moves it here
ProposedDreaming wrote itDreaming
EvaluatingThe runner is testing itThe evaluation runner
RejectedIt failed, or a person said noThe runner, or a person
ValidatedIt passed every testThe runner
ApprovedA person with the right role said yes; here every candidate needs one, unlike Chapter 31's low-risk tierA person, through the review page
CanaryA small share of new assignments use itRelease code, after approval
ActiveAll new assignments use itRelease code, after the canary passes
Rolled backThe previous release is restoredA person, or an automatic stop rule
RevokedIt may never be used againA person

Six states in a row, each moved into by a named actor: Proposed, by dreaming; Evaluating, by the runner; Validated, by the runner; Approved, by a person, highlighted in gold; Canary, by release code; and Active, by release code. Two arrows lead down to Rejected: from Evaluating, when the candidate fails a test, and from Validated, when a person says no. Two arrows lead down to Rolled back: from Canary, when a stop rule fires, and from Active, when a person decides. A box below says: approval binds the approver, tenant, worker, the exact candidate hash and an expiry, so changing one character makes a new candidate; Revoked is the ninth state, where a person may revoke any release and it may never be used again, and running work keeps its release unless that release is revoked; a rollback restores the previous release but never undoes a payment already posted.

Figure 36.2. The table says who may move a candidate into each state. The figure shows which moves exist.

Step 5. Build src/evolution.ts. Store candidate states in Postgres. Allow only the moves in the table, each by the actor named, and check the approver's role against the worker's contract (Chapter 35). Approval binds the approver, tenant, worker, the exact candidate hash and an expiry. Write the tests first: dreaming cannot move a candidate past proposed; an expired approval cannot be used; a candidate whose content changed after evaluation cannot be approved.

The last test matters. The approval is for the exact candidate that was evaluated, by its hash. If anything changed after evaluation, it is a different candidate.

Releases are manifests

A release is a manifest: a list of exact versions.

{
  "release": "ap-acme-36.4",
  "worker": "brightline-ap-acme",
  "contract": "ap-rc-3",
  "prompt": "sha256:9f1c...",
  "skills": { "partial-delivery": 4, "credit-notes": 2 },
  "memories": "memset-2026-11-28",
  "tools": { "acme-footer-po": 1 },
  "routes": "routes-12",
  "processes": { "reconcile-month": 2 }
}

A manifest never changes. A new candidate makes a new manifest. Switching the active release uses compare-and-swap in the worker's coordinator, as Chapter 34 showed: switch from 36.3 to 36.4 only if 36.3 is still active. Two releases switched at once cannot both win.

Running work keeps its release. A conversation or a reconciliation that started on 36.3 finishes on 36.3, as in Chapters 33 and 34, unless the release is revoked. Only new assignments get 36.4.

The canary

After approval, the release goes to a canary: for example, 10% of new assignments for a week, chosen by a hash of each assignment's ID. The rest stay on the previous release. You compare the two groups on the measures in 36.8: accepted without correction, review minutes, errors, cost. The canary passes if it is no worse on any of them, and better on the one it was meant to improve. Then it becomes active.

Set a stop rule in advance. If the canary's critical error count is above zero, or its correction rate is more than a set amount above the baseline, roll back automatically and tell a person.

What rollback can and cannot do

Rollback makes the previous eligible release active again. It is fast, because the old manifest still exists.

It does not undo what the release did in the world. A payment posted under 36.4 stays posted. A supplier email stays sent. That is why the payment checks from Chapter 33 and the contract checks from Chapter 35 stay in force under every release. It is also why a candidate that touches payments needs a person's approval.

And some old releases may not be eligible to come back. If a release used a memory that has since been deleted at a client's request (Chapter 35), restoring it would restore the deleted data. Rollback checks current deletion and revocation records first.

What the worker may never change

The initial platform excludes changes to its own harness and Workflow code from the learning loop. Dreaming can propose a memory, a skill, a route or a tool definition. Code changes to the platform go through normal engineering: Claude Code writes them, a person reviews them, tests pass, and they are deployed by trusted means. That includes the typed tools in the next page.

The invariant. A change reaches real work only by the states in order, with a person's approval of the exact version tested. Every release can be rolled back, but no rollback undoes a payment.

Check yourself. A candidate was validated on Monday. On Tuesday someone fixes a typo in it and asks Ana to approve. Can she? (No. The candidate's hash changed, so it is a new candidate that has not been evaluated. Fix the typo as a new candidate and run it through evaluation; it will be quick.)

  • Building Affordable, Self-Improving AI Workers (Panaversity, 29 November 2026), section 10.4, and companion appendix A6
Owner
Panaversity