Skip to content

    AI Architect Case Files

    Case File: Canary Release for a Prompt Change

    A prompt change passed the offline gate and quietly hurt one customer segment. A version pin, shadow run, canary gate and alias rollback limit the damage.

    By Published 7 min read

    • ai-architect
    • case-file
    • industry-saas-b2b
    • pattern-canary-release
    • failure-quality-regression
    • kind-composite
    Share

    Composite scenario, not a real company. Assembled from common industry patterns; every number is illustrative and its assumptions are listed at the end.

    This case belongs to LLMOps and observability for AI systems.

    Context

    • A B2B software vendor runs an assistant that drafts replies to customer support tickets. Agents edit and send them.
    • Volume: 40,000 drafts a day. About 10% (4,000) come from tenants whose tickets are long email threads, the long-thread segment.
    • Quality signal: the accepted-draft rate, the share of drafts an agent sends with light edits or none. Baseline: 0.90.

    Problem statement

    A shorter, cheaper prompt (v14) passed the offline gate and went to all traffic on a Tuesday. In the long-thread segment the accepted-draft rate fell from 0.90 to 0.82. Support agents complained on Friday.

    Measure Value
    Drafts exposed before anyone noticed 12,000 (4,000 a day for 3 days)
    Extra rewrites 960 (12,000 x 0.08)
    Change in the all-tenant rate 0.8 points (0.90 to 0.892)
    Target Catch a segment drop of this size in 1 day, with at most about 200 segment drafts exposed, and roll back without a deploy

    Constraints

    • Fixed: the accepted-draft rate arrives only after an agent acts, so it lags the request.
    • Fixed: prompts change several times a week; a release process that takes days will be skipped.
    • Limit: the golden set has 400 items, only 20 of them long-thread tickets.
    • Limit: one canary at a time, so results are not confounded.

    Why the traditional approach fell short

    An offline gate on an average hides a small segment: 20 items cannot show a drop that matters. Deploy and watch relies on complaints, which arrive days late. Prompts shipped like code need a redeploy to undo, so rollback is slow.

    An all-traffic A/B test on the overall average has the same blind spot: the segment is diluted by the other 90%.

    Options considered

    Option Verdict Reason
    A. Offline gate only, then ship to everyone (status quo) Rejected Passed v14. Cannot see a segment it barely contains
    B. Pilot tenants plus an agent lead reading 30 drafts by hand (non-AI, no new tooling) Kept as rung 1 for risky changes Cheap and human, but slow, and 30 drafts cannot detect a drop of 8 points
    C. Prompt registry, shadow run, 5% canary with a per-segment gate, alias rollback Accepted Limits exposure, measures the real outcome, undoes in seconds

    Solution architecture

    Figure 1. Where the release decision sits

    flowchart LR accTitle: Release router with a gate accDescr: The Orchestrator asks the Release router which prompt version to use. The router reads versions from the Prompt registry and splits traffic by segment. The Orchestrator calls the model through the Model gateway and writes version, segment and outcome to the Trace store. The Eval service computes a gate per segment and tells the router to promote or roll back. CA["Client app"] --> OR["Orchestrator"] OR --> RR["Release router (alias, split by segment)"] RR --> PR["Prompt registry (v13, v14)"] OR --> MG["Model gateway"] MG --> LP["LLM provider"] OR -->|"version, segment, outcome"| TS["Trace store"] TS --> EV["Eval service (gate per segment)"] EV -->|"promote or roll back"| RR

    How to read this: the router is the only place that knows which version serves whom, so the gate can change it without a deploy.

    Figure 2. One draft during the canary, with the gate

    sequenceDiagram accTitle: Canary request path and gate accDescr: The Orchestrator resolves the prompt alias through the Release router, which returns v13 or v14. The model produces a draft. The agent's action is written to the Trace store with the version and segment. The Eval service compares canary and control per segment, and either promotes v14 or points the alias back to v13. participant OR as Orchestrator participant RR as Release router participant MG as Model gateway participant TS as Trace store participant EV as Eval service OR->>RR: Resolve alias for tenant segment RR-->>OR: v13 (control) or v14 (canary) OR->>MG: Prompt version and ticket MG-->>OR: Draft OR->>TS: Version, segment, agent action EV->>TS: Read canary and control per segment alt lower bound meets the gate EV->>RR: Promote v14 else lower bound below the gate EV->>RR: Point alias back to v13 end

    How to read this: the alt block is the decision that the offline gate could not make for the long-thread segment.

    How AI solved it, step by step

    Step through the release, then switch to "Without the fix" to compare.

    Releasing prompt v14 (interactive when JavaScript is on)

    As designed

    1. Register v14. The Prompt registry stores v14 as an immutable version: prompt text, model, parameters and retrieval settings. The alias still points at v13.
    2. Offline gate. 370 of 400 golden items pass (0.925, Wilson lower bound 0.9004 at z 1.645, gate 0.90). The 20 long-thread items are too few to gate on, so the gate cannot clear the segment.
    3. Shadow run. The Release router copies 5% of live requests to v14 for a day. Users never see the output. It checks format, latency and token use, not acceptance.
    4. Canary. The router sends 5% of traffic to v14, stratified by segment: about 200 long-thread drafts a day. v13 stays as the control.
    5. Gate per segment. After 200 long-thread outcomes, v14 shows 164 accepted (0.82, lower bound 0.7711). The gate needs 0.85, so it fails.
    6. Roll back. The Eval service points the alias back to v13. One configuration change, no deploy. About 16 extra rewrites occurred.
    7. Trace review. Traces carry the version, so the team reads failed v14 drafts and fixes the prompt as v15. It adds long-thread items to the golden set before trying again.

    Without the fix

    1. Offline gate. v14 passes on the overall average. Nobody looks at the 20 long-thread items.
    2. Full release. v14 goes to all traffic on Tuesday through the normal code deploy.
    3. Silence. The all-tenant rate moves 0.8 points, inside daily noise. Dashboards stay green.
    4. Complaints. On Friday, support agents report weak drafts. Rolling back means a redeploy, and 960 extra rewrites have already happened.

    Under the hood

    Google's SRE Workbook, chapter 16, "Canarying Releases", defines canarying as "a partial and time-limited deployment of a change in a service and its evaluation". The part that gets the change is the canary and the rest is the control. Applied to a prompt, the version is the change and the release router is the splitter.

    The size of the canary is set by the effect you must see. The NIST formula n = (z_alpha x sqrt(p0 q0) + z_beta x sqrt(p1 q1))^2 / delta^2 with p0 = 0.90 and p1 = 0.82 (one-sided alpha 0.05, power 0.80) gives 104.2 items, or 116.7 with the continuity correction. About 200 segment drafts a day clears that in one day. The overall average needs far more: detecting 0.90 to 0.892 takes about 8,899 items, 4.5 days of the 2,000 canary drafts.

    Canary gate for the long-thread segment (interactive when JavaScript is on)
    Observed pass rate82.0%
    Interval (z = 1.645)77.1% to 86.0%
    Gate: lower bound at least 85.0%fail

    Set passes to 180: the lower bound rises to 0.8596 and the gate passes. The interval maths is in Under the hood: Confidence intervals and sample sizes for gates. The release mechanics are in Under the hood: Shadow, canary and A/B releases.

    What went wrong / failure modes

    Failure Mitigation
    Canary too small for a segment Size each segment's gate with the sample-size formula, and wait for its outcome count, not for a clock
    Outcome lags the request Gate on accepted drafts after the agent acts; keep the canary at least a day to cover the daily cycle
    Segment label missing or wrong Assign the segment at request time from tenant metadata and log it on the trace
    Version drift: retrieval settings change outside the prompt The registry version pins retrieval settings and model too
    Two canaries overlap One canary at a time, as the SRE chapter advises
    Shadow run adds model cost Cap shadow at 5% for one day; it adds about 5% to that day's calls

    Results

    All numbers are illustrative targets, not measurements.

    Measure Without the fix With the fix
    Segment drafts exposed to v14 12,000 200
    Extra rewrites 960 about 16
    Time to detect 3 days, by complaint 1 day, by gate
    Time to undo Redeploy Alias change

    Tradeoffs and when NOT to use this approach

    • Low traffic. A segment with 10 drafts a day never fills a gate. Use pilot tenants and manual review.
    • Delayed outcomes. If the outcome arrives weeks later, the canary cannot gate. Use a judge or labels as a proxy and say so.
    • Cost. A router, a registry and per-segment dashboards are worth it only when prompts change often.
    • Risky changes (model swap, new tools) deserve shadow and a longer canary.

    Design rules extracted

    1. Make a prompt a pinned, immutable version; a release moves an alias, never edits a version.
    2. Gate per segment on the real outcome, sized with the sample-size formula, not on the overall average.
    3. Stratify the canary so small segments are in it.
    4. Keep rollback to one configuration change.
    5. Stamp the version on every trace so a bad answer points to its release.

    Assumptions

    All numbers are illustrative.

    • Volume 40,000 drafts a day; the long-thread segment is 10% = 4,000 a day; baseline accepted-draft rate 0.90 in every segment. Accepted means an agent sends the draft with light edits or none.
    • v14 lowers the segment rate to 0.82 and leaves other segments at 0.90. Overall: 0.90 - 0.10 x 0.08 = 0.892, a 0.8-point drop.
    • Without the fix: 4,000 x 3 days = 12,000 drafts; 12,000 x 0.08 = 960 extra rewrites. Rewrites mean drafts that would have been accepted under v13.
    • Offline set: 400 items, 370 pass = 0.925; Wilson (z 1.645) lower bound 0.9004; gate 0.90. Long-thread items: 20 (5% of 400). A slice of 20 would need about 105 items to detect 0.90 to 0.82, so the slice is grown to 120 (above the 116.7 with the correction) after the incident.
    • Canary 5%: 0.05 x 4,000 = 200 segment drafts a day; 164 accepted = 0.82; Wilson lower bound 0.7711; gate = baseline minus 5 points = 0.85. A healthy 180 of 200 gives lower bound 0.8596 and passes. Extra rewrites: 36 observed minus 20 expected at baseline = 16.
    • Sample size (NIST/SEMATECH e-Handbook, one-sided alpha 0.05 z 1.645, power 0.80 z 0.842): 0.90 to 0.82 gives 104.2 (116.7 corrected); 0.90 to 0.892 gives 8,899 (9,024 corrected). Canary overall: 0.05 x 40,000 = 2,000 a day; 8,899 / 2,000 = 4.45 days (4.51 with the correction).
    • Shadow: 5% of requests for one day adds 5% to that day's calls.

    Last verified: 2026-10-22

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments