# How Do You Roll Out a New Agent Version Safely?

> Test offline, then in shadow, then on a small slice of live traffic, with a quick way back, for your AI interview.

**In short:** Ship a new agent version the way careful teams ship any risky change: test it offline, replay real work with writes blocked, then send a small slice of live traffic through it against limits set in advance. Keep the old version one switch away, so a bad version can be pulled back quickly.

AI and LLM interview question Q198, Agents and tool use. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-roll-out-a-new-agent-version-safely

## Say it in 30 seconds

I never switch every user to a new agent version at once. First I run it against a fixed set of past cases, several times each, because outputs vary. Then I replay real recent work with the write tools in dry-run, so nothing is really sent. Then I send five percent of live traffic to it for a couple of days, with pass or fail limits for wrong refunds, speed and escalations, all set before the test starts. If one limit fails, I move the live alias back to the old version. A version is the prompt, the model and the tool settings together, so they ship together.

## Say it in 2 minutes

The first thing I settle is what counts as a version. For an agent, that is the prompt, the model snapshot, the tool definitions and the config, shipped as one bundle. If I change any one of them, it gets a new version number and goes through the same gates. Otherwise, when something breaks, I can't tell which change caused it.

The gates run in order, and each one is cheaper to fail than the next. First comes an offline run on a golden set, which is a fixed list of past tickets with known good outcomes. I run each case several times, because one pass can be luck. Second comes a shadow replay of last week's real tickets, with every write tool in dry-run, so the new version proposes refunds that nobody pays. I compare its choices with the old version and with the human decisions. Third comes a canary: five percent of live tickets for 48 hours, judged against limits I wrote down before it started.

The last step is the one people forget. Rollback should be a switch that points the live alias back to the old version, which is quick and needs no new build. For a normal promotion, sessions already in flight finish on the version they started with. For a harmful version, stop its write tools first, then move open sessions to the old version. Finally, a golden set goes stale, so I re-run it on a schedule as well as at release. I would tell an interviewer that every gate has a cost, and the aim is to catch each failure at the cheapest step that can see it.

## What is a safe rollout of a new agent version, in plain words?

An agent is an AI app that reads a task, uses tools (such as a refunds system or an inbox) and acts on what it finds. A new version is any change to how it works: a new prompt, a new model, new tool settings. A safe rollout finds the problems while they are still small and cheap.

Think of a hospital changing its triage rules. It doesn't switch every ward on the first day. It checks the rules against old case notes, watches them on live patients without acting on them, then tries them on one ward with a clear stop rule. A refunds agent earns its way to full traffic the same way, because one wrong refund costs money and customer trust.

- **Golden set:** A fixed list of past cases with known good outcomes, run the same way on every version.
- **Shadow run:** The new version runs on real requests, or on replays of past ones, but its writes are blocked, so nothing real happens.
- **Canary:** A small slice of live traffic, for example five percent, sent to the new version first.
- **Alias:** A name, such as live, that points at one version. Moving it back is the rollback.

## What exactly counts as a new version?

Many bad releases come from a change nobody filed as a change: someone edited the prompt, a newer model snapshot was swapped in, or a tool's input changed its unit. So a version is the whole bundle. It gets one number and ships as one piece.

- **Prompt:** The instructions the agent follows, including its rules for refunds and escalation.
- **Model snapshot:** The exact model it runs on. Models get retired, so this part needs a plan too.
- **Tool definitions:** The names and inputs of the tools it can call, such as refund_order with an order id and an amount.
- **Config and memory:** Limits, timeouts and any saved notes the agent reads back later.

Model retirement has a clock. Anthropic says that once a model is deprecated, you should move all usage to its replacement before the retirement date, because "Requests to retired models fail." So the model goes on the release calendar like any other change.

## How do the release gates run, in order?

1. **Offline on the golden set:** Run the fixed past cases, several times each. A case counts as passed only if it passes every run.
2. **Shadow replay:** Replay last week's real tickets with the write tools in dry-run (the tool works out what it would do but does not act). Compare the new choices with the old version and with the human decisions.
3. **Canary:** Send five percent of live tickets to the new version for 48 hours. Watch wrong refunds, slow replies and escalations against the limits.
4. **Full rollout, or rollback:** If every limit holds, move the live alias to the new version in waves. If one fails, move the alias back.

> "Because model outputs vary between runs, we run multiple trials to produce more consistent results." (Anthropic)
>
> "Models sometimes produce different output from the same input, which makes traditional software testing methods insufficient for AI architectures." (OpenAI)

Trials matter because one pass proves little. Anthropic's measure, pass^k, is the chance that all k trials succeed. Its own example: an agent that passes 75% of the time on each try passes all three tries only about 42% of the time. A chat tool that needs one good answer can live with a single pass. A refunds agent must behave every time, so the stricter test is the one I gate on.

> **Tip:** Write the limits down before the canary starts. A limit chosen after seeing the numbers will pass whatever happened.

*Diagram, How a new version reaches customers: A new version passes three checks before every customer sees it: an offline set, a shadow replay that blocks writes, and a small live canary. If a limit fails, the alias moves back to the old version.*
1. The whole bundle goes through the checks as one version.
2. Offline results first, then real tickets with writes blocked.
3. Only a version that passes reaches live customers.
4. Live numbers are judged against limits set before the test.
5. If every limit holds, the alias moves to the new version.
6. If one limit fails, the alias moves back to the old version.

Amazon's production pipeline uses the same caution for live traffic. Each production wave starts with a one-box stage: one server out of the many that run the app. If the change causes a negative impact in that one box, the pipeline rolls back by itself and doesn't promote the change to the rest of the prod stages.

> "If the change causes a negative impact in the one box, the pipeline automatically rolls back the change and doesn't promote it to the rest of the prod stages." (Amazon)

The canary is judged on live numbers, from real customers and real payments. A dry-run replay can't show what a payment really did.

## What makes an agent rollout harder than a normal app?

A normal web service can often roll back by putting the old code back. An agent adds three problems that a code rollback doesn't fix.

- **Real actions during tests:** A test run that really sends a refund or emails a customer is a live incident. Every write tool needs a dry-run switch that the test code sets, so the prompt can't turn it off.
- **Sessions in flight:** For a normal promotion, a chat that began on version 2.3 finishes on version 2.3. For a harmful version, stop its write tools first, then move the chat to the old version. Switching mid-conversation can mix two sets of rules in one answer.
- **Compatibility:** During a canary, old and new versions run side by side, so tool inputs and saved memory must work for both. Amazon's definition of backwards compatible: "A version of software that can be rolled back without errors or disruption to the functionality available in the previous version is called backwards compatible."

- **Slow way: Redeploy the old code.** A build and deploy takes time, and customers keep meeting the bad version until it finishes.
- **Fast way: Move the alias back.** Live traffic goes to the old version at once, and the new one stays available for debugging.

Anthropic notes that once you have evals (tests that score the agent's work), you get baselines and regression tests, because latency, token usage, cost per task and error rates can be tracked on a static bank of tasks. OpenAI recommends continuous evaluation, which runs evals on every change, watches for new cases of nondeterminism (the same input giving different outputs) and grows the set over time. OpenAI is also phasing out its Evals platform, so the habit matters more than the tool.

## What does a canary catch in practice?

Here is a made-up refunds agent at a mid-size online shop. Version 2.4 rewrites the prompt to sound friendlier about late returns, and nobody meant it to loosen the 30-day policy.

The offline golden set passed. Only one case in a hundred in that set was a late return, but about one live ticket in twenty-five is. The test set never pushed the agent hard on the rule it had just changed. OpenAI calls this a biased design: eval data that misses how real traffic looks.

The shadow replay missed it too. Recorded tickets can't answer back, so the replay saw only the first reply, never the customer pushing for an exception over several turns. Only the live canary showed the problem. The gate script below reads the stable and canary numbers and prints one decision.

```python
# A canary gate for a refunds agent (made-up numbers, simplified).
# Code, not a person, decides the next rollout step.
stable = {"wrong": 0.001, "p95": 8.1, "escalated": 0.110}
canary = {"wrong": 0.009, "p95": 9.4, "escalated": 0.114}
gates = [
    ("wrong refunds (share)", "wrong", 0.005, "max"),
    ("p95 seconds per ticket", "p95", 12.0, "max"),
    ("escalations vs v2.3", "escalated", 0.02, "change"),
]
print("gate                      limit    seen     result")
failed = []
for label, key, limit, kind in gates:
    seen = round(canary[key] - stable[key], 3) if kind == "change" else canary[key]
    ok = abs(seen) <= limit if kind == "change" else seen <= limit
    if not ok:
        failed.append(label)
    print(f"{label:<25} {limit:<8} {seen:<8} {'PASS' if ok else 'FAIL'}")
print("decision: ROLLBACK to v2.3 (move the alias)" if failed else "decision: PROMOTE to the next wave")
```

Output:

```text
gate                      limit    seen     result
wrong refunds (share)     0.005    0.009    FAIL
p95 seconds per ticket    12.0     9.4      PASS
escalations vs v2.3       0.02     0.004    PASS
decision: ROLLBACK to v2.3 (move the alias)
```

The canary showed 0.9% wrong refunds against a 0.5% limit, so the alias moved back to v2.3. A rate only counts once the slice has enough tickets behind it to trust it, and the team audits a sample of refunds during the 48 hours, because a wrong refund shows up only when someone checks it. The five percent slice is what kept the damage small: refunds it had already paid went onto a manual review list, and the rest of the customers never saw v2.4. The fix went into the golden set first: late-return cases at their real share. Then every gate ran again before v2.4 went back out. The whole check took about three days, and the canary was most of that time.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A version is the prompt, model snapshot, tool definitions and config, shipped together.
- [ ] Offline tests first, run several times, on cases that match real traffic.
- [ ] A shadow run with writes blocked, then a small canary with limits set in advance.
- [ ] Rollback is a switch that moves an alias back, and write tools stop before open sessions move.
- [ ] One named failure a gate caught, and what it saved.
- [ ] The honest limit: offline tests can miss what only live traffic shows.

**Common traps**

- Trap: "Run the eval suite once and ship when it's green." Better: One green run can be luck, and an easy test set proves little. Add trials, and a canary with live numbers.
- Trap: "Rollback means redeploy the old code." Better: That takes time while customers see the bad version. Keep an alias that moves traffic at once.
- Trap: "Dry-run tests cover the side effects." Better: Dry-run checks what the agent asks for. Only the live canary shows what the payment or email really did.

## Can you spot the risky rollout?

**Spot the risky rollout:** A refunds agent gets a new prompt. Which plan is safest?

A. Replace version 2.3 for all tickets. The offline tests passed on Monday.
B. Run the golden set once, see a high score, then ship to everyone on Friday.
C. Shadow replay with writes in dry-run, then a 5% canary with limits set in advance, and the old alias ready to move back.
D. Edit the prompt live on the production server, and fix problems from the support queue.

**Answer:** C. Only the third plan checks the change on real work without side effects, then on live traffic against limits set beforehand, and keeps a way back. The others skip trials, skip limits, or edit production directly.

**Quick check:** A new version passes every offline test, but the canary shows wrong refunds at 0.9% against a 0.5% limit. What now?

A. Ship it, since the offline tests passed
B. Raise the limit to 1% so it passes
C. Move the alias back, then add the missing cases to the golden set
D. Wait a week to see if it improves

**Answer:** C. A failed limit means rollback. The live result then shows which cases the golden set was missing. Changing the limit after the result would hide the problem.

## Can you answer these from memory?

**Flash cards**

- **What is a golden set?** A fixed set of past cases with known good outcomes, run the same way on every version.
- **Why run each case several times?** Outputs vary between runs, so one pass can be luck.
- **What is a shadow run?** Real requests with write tools in dry-run, so nothing real happens.
- **What is a canary?** A small slice of live traffic, for example 5%, sent to the new version first.
- **What is part of a version?** Prompt, model snapshot, tool definitions and config, shipped together.
- **How do you roll back?** Move the live alias to the old version. Don't redeploy the code.

## Likely follow-up questions

- Q257 How do you regression-test prompts? https://designervenkat.online/interview/ai/how-to-regression-test-prompts
- Q256 Capability evals vs regression evals? https://designervenkat.online/interview/ai/capability-evals-vs-regression-evals
- Q258 How do you A/B test an LLM feature? https://designervenkat.online/interview/ai/how-do-you-ab-test-an-llm-feature
- Q190 How do you trace and debug an agent run? https://designervenkat.online/interview/ai/how-do-you-trace-and-debug-an-agent-run
- Q247 Offline vs online evaluation? https://designervenkat.online/interview/ai/offline-vs-online-evaluation
- Q275 Eval scores dropped but the model is unchanged. How do you debug? https://designervenkat.online/interview/ai/eval-scores-dropped-model-unchanged
