---
title: "A/B route and roll back"
lesson_id: "04"
---

# A/B route and roll back

- **Lesson ID:** 04
- **Goal:** Route two prompt ids with a stable bucket. Roll back by setting live to the last good id.
- **Human lesson:** [04-ab-and-rollback.html](04-ab-and-rollback.html)

## Prerequisites

- Lesson 03, or a Dynamic Profile that reads the registry.

## Inputs, outputs, and artifacts

- **Inputs:** Two PromptRecords and a user bucket.
- **Outputs:** A/B routing and a rollback function.
- **Artifacts:** Progressive `.flow` diagrams and a sketch.

## Agent build steps

1. Show two record ids and a bucket in the profile body.
2. Keep the assignment stable per user.
3. Show rollback as a status change.
4. Warn that a flip can raise TTFT.
5. Link eval harness and streaming metrics.

## Constraints

Keep the language simple, friendly, and literal. iOS 27 and macOS 27 only. No quizzes, Mermaid, or em dashes. Do not invent API names. Mark sketches as sketches and tell the reader to confirm them in the Xcode 27 SDK.

## Key concepts

- A/B is two record ids plus a stable user bucket. Apple does not ship A/B.
- Rollback flips status: the target id goes live, the former live is retired.
- Unstable bucket assignment can invalidate the KV cache and raise TTFT.
- Roll back a harmful live prompt first. Eval second for non-urgent changes.

## Takeaways

- Rollback is a status change, not a new App Store build.
- Keep bucket assignment stable per user.
- Run evals on both ids before switching live for non-urgent changes.

## Acceptance checks

- A/B and rollback are both shown.
- Rollback does not require a new app build.
- Sibling links, progressive `.flow` diagrams, and an Agent brief link are present.
- [ ] Proceed to [lesson 05 brief](05-ship-the-registry.llms.md).
