Lesson 72.6 · 6 of 7 · 4 min read · Reviewed 24 Nov 2026
Worked example: migrating between model versions
By the end, you can
- Migrate between Claude model versions safely.
- Use Claude's docs on deprecations and migration.
Before you start
- DeprecationsDeprecation: Announcing that a model or feature will be retired on a set date. page: is your current model deprecated? When is it retired? What replacement is recommended?
- Models overview: context windowContext window: The maximum number of tokens a model can consider at once, counting the input and the output it generates., output limits and features of the new model.
- Migration notes and release notes: changes to parameters, defaults, tool useTool use: Letting a model call functions you define, by returning a structured request your code executes. behaviour or formatting.
A migration checklist
- Make an inventory of every place the old model idModel id: The exact string that names a model in an API request, such as a specific model version. appears: app code, configs, workers, eval gradersGrader: The part of an eval that decides whether an output passes, using code, a model or a person., scripts.
- Run your eval suiteEval suite: A versioned collection of eval cases, graders and thresholds run on every prompt, model or code change. on the new model with your current prompts.
- Look at failures by category. Common changes between generations include how literally instructions are followed, default answer length and how eagerly tools are called.
- Adjust prompts and settings; rerun evalsEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria..
- Compare cost and latencyLatency: The time from sending a request until you get the response, or until the first token arrives when streaming. per task.
- Shadow or canaryCanary release: Releasing a change to a small share of traffic first and watching metrics before rolling it out further. in production, with versions on every traceTrace: A record of everything that happened during one request or agent run, as a tree of timed steps. (72.1).
- Roll out fully; keep the old model as a fallback until its retirement.
- Update model gradersLLM-as-judge: Using a language model with a rubric to grade another model’s outputs. in your eval pipeline separately, and recalibrate them against human labels.
Use the exact id
Set the new model’s exact id from the models page in your versioned config. The Playground on this site lets you switch model names in simulated calls, so you can rehearse the config change without a real key.
Key points
- Check the deprecations page for retirement dates and recommended replacement models.
- Read the migration notes for the new model: behaviour, parameters and tool use can change between generations.
- Run your evals on the new model id, tune prompts, then roll out gradually with the old model as fallback.
Rehearse a model switch in config
Find every use of an old model id, run the eval suite on the old and new ids, and switch the app config safely.
You will have: A migration script that lists every place the old id appears, compares eval runs and leaves only the grader for a separate update.
Steps
- Run the starter: the script is missed and the old id is skipped.
- Include scripts and jobs when searching for the old id.
- Catch NotFoundError so a retired id fails with a clear line.
- Switch every app use to the new exact id, leaving the eval grader for its own recalibration.
- Read the final line and plan the grader update.
Done when
- Four places use the old id, including backfill.py.
- The old id fails as not found; the new id passes 3 of 3.
- No app use of the old id remains; the grader is pending.
Open in the Playground No API key needed.
Starter code (Python)
# Rehearse a model migration: find every use of the old id, run the eval suite on both ids, then switch
# the app config while the eval grader is updated separately.
import anthropic
client = anthropic.Anthropic()
OLD = "claude-old-sim-1" # a made-up id standing in for your retiring model: the simulator does not know it
NEW = "claude-sonnet-5-5" # the exact id you would copy from the models page
CONFIG = {
"support_bot": {"model": OLD, "max_tokens": 400},
"nightly_summary": {"model": OLD, "max_tokens": 600},
"ticket_router": {"model": "claude-haiku-5-5", "max_tokens": 50},
"eval_grader": {"model": OLD, "max_tokens": 200},
}
SCRIPTS = {"backfill.py": f'client.messages.create(model="{OLD}", max_tokens=300, ...)'}
EVALS = ["Summarise this ticket: grinder arrived damaged, customer wants a refund.",
"Classify this message as billing, delivery or other: where is my parcel?",
"Reply to a customer asking how long refunds take."]
def find_old(config, scripts, model_id):
places = [name for name, c in config.items() if c["model"] == model_id]
# TODO 1: scripts and jobs count too: add every script whose source mentions model_id
return places
def run_evals(model_id):
passed, out_tokens = 0, 0
for prompt in EVALS:
# TODO 2: catch anthropic.NotFoundError and return a clear "not found" line instead of crashing
if model_id == OLD:
return f"{model_id}: skipped (add the error handling first)"
m = client.messages.create(model=model_id, max_tokens=400,
messages=[{"role": "user", "content": prompt}])
text = "".join(b.text for b in m.content if b.type == "text")
passed += bool(text.strip()) and m.stop_reason == "end_turn"
out_tokens += m.usage.output_tokens
return f"{model_id}: passes {passed} of {len(EVALS)}, {out_tokens / len(EVALS):.0f} output tokens per task"
print("places with old id:", len(find_old(CONFIG, SCRIPTS, OLD)), find_old(CONFIG, SCRIPTS, OLD))
print(run_evals(OLD))
print(run_evals(NEW))
# Switch the app, not the grader: a new grader is recalibrated against human labels on its own schedule.
# TODO 3: set NEW in every config entry that uses OLD except eval_grader, and in backfill.py
left = find_old(CONFIG, SCRIPTS, OLD)
print(f"after switch: old id remaining in app: {len([p for p in left if p != 'eval_grader'])} (grader pending: {'eval_grader' in left})")
Show a solution
# Rehearse a model migration: find every use of the old id, run the eval suite on both ids, then switch
# the app config while the eval grader is updated separately.
import anthropic
client = anthropic.Anthropic()
OLD = "claude-old-sim-1" # a made-up id standing in for your retiring model: the simulator does not know it
NEW = "claude-sonnet-5-5" # the exact id you would copy from the models page
CONFIG = {
"support_bot": {"model": OLD, "max_tokens": 400},
"nightly_summary": {"model": OLD, "max_tokens": 600},
"ticket_router": {"model": "claude-haiku-5-5", "max_tokens": 50},
"eval_grader": {"model": OLD, "max_tokens": 200},
}
SCRIPTS = {"backfill.py": f'client.messages.create(model="{OLD}", max_tokens=300, ...)'}
EVALS = ["Summarise this ticket: grinder arrived damaged, customer wants a refund.",
"Classify this message as billing, delivery or other: where is my parcel?",
"Reply to a customer asking how long refunds take."]
def find_old(config, scripts, model_id):
places = [name for name, c in config.items() if c["model"] == model_id]
places += [name for name, src in scripts.items() if model_id in src]
return places
def run_evals(model_id):
passed, out_tokens = 0, 0
for prompt in EVALS:
try:
m = client.messages.create(model=model_id, max_tokens=400,
messages=[{"role": "user", "content": prompt}])
except anthropic.NotFoundError:
return f"{model_id}: not found (fails like a retired model)"
text = "".join(b.text for b in m.content if b.type == "text")
passed += bool(text.strip()) and m.stop_reason == "end_turn"
out_tokens += m.usage.output_tokens
return f"{model_id}: passes {passed} of {len(EVALS)}, {out_tokens / len(EVALS):.0f} output tokens per task"
print("places with old id:", len(find_old(CONFIG, SCRIPTS, OLD)), find_old(CONFIG, SCRIPTS, OLD))
print(run_evals(OLD))
print(run_evals(NEW))
# Switch the app, not the grader: a new grader is recalibrated against human labels on its own schedule.
for name, c in CONFIG.items():
if c["model"] == OLD and name != "eval_grader":
c["model"] = NEW
SCRIPTS["backfill.py"] = SCRIPTS["backfill.py"].replace(OLD, NEW)
left = find_old(CONFIG, SCRIPTS, OLD)
print(f"after switch: old id remaining in app: {len([p for p in left if p != 'eval_grader'])} (grader pending: {'eval_grader' in left})")
Do it Rehearse a model switch in the Playground in the Playground. No API key needed.