Versioning Models, Prompts, Data, and Tools › Worked example: a full canary rollout with rollback
Language AI HandbookAll chapters The previous log was produced by the canary traffic policy. Use the decision from the separate outcomes fixture to change that policy to stable-only and route another 20 requests. Then recover a candidate request's prompt from the old log.
PythonIn [27]Expand
active_deployment = canary
print("During canary:", active_deployment.allocations)
if decision == "ROLL BACK":
active_deployment = activate("support-agent", ((1.0, stable_id),), registry)
after_routes = [route(rng, active_deployment) for _ in range(20)]
assert decision != "ROLL BACK" or set(after_routes) == {stable_id}
print("After decision:", active_deployment.allocations)
print("New candidate assignments:", after_routes.count(canary_id))
print("Candidate artifact retained:", canary_id in registry)ConsoleOut [27]Expand
During canary: ((0.9, 'sha256:36f5a9a25a9a355007606bdd62b2ee9ce23584262e4f3af9aeb4b8bbe1201508'), (0.1, 'sha256:9898b60eedeb61f0ce5e06fda3b44bfafe2c7b642c90ca05aada99f14d4ffd98')) After decision: ((1.0, 'sha256:36f5a9a25a9a355007606bdd62b2ee9ce23584262e4f3af9aeb4b8bbe1201508'),) New candidate assignments: 0 Candidate artifact retained: True
PythonIn [28]Expand
def resolve_prompt(
record: RequestRecord, store: dict[str, bytes]
) -> tuple[str, str]:
encoded = store[record.manifest_id]
manifest = json.loads(encoded)
prompt = manifest["components"]["prompt.main"]
return prompt["version"], prompt["identity"]
target = next(record for record in log if record.manifest_id == canary_id)
print("Historical request:", target.request_id)
print("Resolved prompt version and digest:", resolve_prompt(target, registry))ConsoleOut [28]Expand
Historical request: req-0004
Resolved prompt version and digest: ('v4', 'sha256:44b471bd4d3f4a31fb10ee9acfa89782cbeba83a6febc05181e1170397e4cf2a')The historical lookup uses the old request's manifest id. It reads the recorded prompt version and digest without making a model call or attempting to regenerate the answer. Production rollback also depends on availability of the prior dependencies, compatibility with any changed shared state, and routing propagation. Traffic reassignment cannot undo effects from requests that already ran.
An enabled tool may have effects outside the language system. A service that wrote a new record during the canary has already changed state by the time the release rolls back. Any reversal of that effect needs an application-level correction with its own permissions and checks. A compatibility test should also cover whether an older release can read data written by the newer release during the rollout. If compatibility fails in that direction, a simple traffic rollback is insufficient even when the old executable and model can be restored.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!