---
title: "Retire models on purpose · Agent Wranglers"
url: https://agentwranglers.se/playbook/machine-learning/serving-and-release/model-retirement
id: MLO-47
level: Recommended
applies: ai-features
updated: 2026-10-27
build: a2a6bdfed830
tokens: 867
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Retire models on purpose

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Serving and release](https://agentwranglers.se/playbook/machine-learning/serving-and-release.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: MLO-47
- Level: Recommended
- Chapter: [Serving and release](https://agentwranglers.se/playbook/machine-learning/serving-and-release.md)
- Rule: When a model leaves production, remove its alias and endpoint and stop its feature jobs. Keep its registry entry, run record and card for as long as any decision record names it.
- Check: No serving endpoint or alias points at a version marked retired. Every retired version has a date and a reason. A query finds no decision record that names a version whose weights are gone.
- Applies when: The project uses AI models.
- How: Old models left running keep costing money and keep a door open. Deleted models break every appeal about a decision they made. Mark the version as retired in the [registry](https://agentwranglers.se/playbook/machine-learning/training-runs-and-the-registry/model-registry.md) with a date and a reason. Find the last decision that names it, as in [keep a record of every decision about a person](https://agentwranglers.se/playbook/machine-learning/people-affected-by-the-model/decision-records.md). Delete its weights and snapshot only after that record's retention ends.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Python example

```python
def retire(version: ModelVersion, reason: str) -> None:
    if serving.endpoints_using(version):
        raise StillServing(version.id)
    registry.set_tag(version, "retired", f"{date.today().isoformat()}: {reason}")
    feature_jobs.stop_for(version)
```

### TypeScript example

```ts
export async function retire(version: ModelVersion, reason: string) {
  if ((await serving.endpointsUsing(version)).length) throw new StillServing(version.id);
  await registry.setTag(version, 'retired', `${new Date().toISOString().slice(0, 10)}: ${reason}`);
  await featureJobs.stopFor(version);
}
```

## Sources

- [MLflow Model Registry](https://mlflow.org/docs/latest/ml/model-registry/)

## Related rules

- MLO-21 [Keep every model in a registry with versions and aliases](https://agentwranglers.se/playbook/machine-learning/training-runs-and-the-registry/model-registry.md) in Machine learning
- MLO-38 [Keep a record of every decision about a person](https://agentwranglers.se/playbook/machine-learning/people-affected-by-the-model/decision-records.md) in Machine learning

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/machine-learning/serving-and-release/model-retirement">Agent Wranglers machine learning playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Test a new model on live outcomes with a randomised split](https://agentwranglers.se/playbook/machine-learning/serving-and-release/model-ab-test.md)
- [Serving and release](https://agentwranglers.se/playbook/machine-learning/serving-and-release.md)
