---
title: "Pin the AI model version you depend on · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-features/prompts-as-code/pin-model-versions
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Pin the AI model version you depend on

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Prompts as code](https://agentwranglers.se/playbook/ai-features/prompts-as-code.md).

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

- ID: AIF-59
- Level: Recommended
- Chapter: [Prompts as code](https://agentwranglers.se/playbook/ai-features/prompts-as-code)
- Rule: Call an AI model by its exact, fixed version, never by a moving alias. Change the version only after its tests pass.
- Applies when: The project uses AI models.
- How: Providers update aliases such as "latest" without notice, and answers change with them. Store the model name in settings, not in code. Before you switch, run the feature's graded examples on the new version, as in [AI evals](https://agentwranglers.se/playbook/testing/non-functional-tests/llm-evals). Note the provider's retirement date and plan the move early. See also [choose the smallest model that passes](https://agentwranglers.se/playbook/ai-features/deciding-to-use-a-model/smallest-passing-model).
- Check: Search the settings and code for model names. None ends in `latest` or is an alias the provider moves, and the last version change has a passing eval run attached.

## 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.

### JSON example

```json
{ "model": "example-model-2026-05-14", "fallback": "example-model-2025-11-02" }
```

## Related rules

- [Use models and data from trusted sources](https://agentwranglers.se/playbook/adversarial-testing/ai-agents-and-models/trusted-model-sources) in Security testing
- [Choose the smallest model that passes](https://agentwranglers.se/playbook/ai-features/deciding-to-use-a-model/smallest-passing-model) in AI features
- [Keep generation settings in the prompt file](https://agentwranglers.se/playbook/ai-features/prompts-as-code/settings-with-prompt) in AI features
- [Grade AI features against fixed examples](https://agentwranglers.se/playbook/testing/non-functional-tests/llm-evals) in Testing
- [Record the embedding model with every vector](https://agentwranglers.se/playbook/ai-features/retrieval/embedding-model-version) in AI features

**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/ai-features/prompts-as-code/pin-model-versions">Agent Wranglers AI features playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Keep generation settings in the prompt file](https://agentwranglers.se/playbook/ai-features/prompts-as-code/settings-with-prompt)
- [Prompts as code](https://agentwranglers.se/playbook/ai-features/prompts-as-code)
