Versioning Models, Prompts, Data, and Tools

Michael BrenndoerferDecember 2, 202628 min read

Version AI systems with typed manifests, compatibility checks, canary rollouts, and lineage records that connect requests to their recorded configurations.

Language AI HandbookAll chapters
Part 64 of 67Compound AI System Design
Chapter 489Versioning Models, Prompts, Data, and Tools
Reading the full chapter · 14 sections · 28 min14 sections · 28 min

All 14 sections · 28 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Versioning Models, Prompts, Data, and Tools

Two support requests receive different refund guidance during a rollout. Both traces say the application was in production. That label cannot tell you which prompt and index served each request. Log the resolved release identifier and you can look up both configurations, check where they differed, and move new traffic to a known configuration while keeping the earlier record.

This chapter builds an in-memory release for an invented support assistant. It uses a typed manifest to identify the model, prompt, index, and tool, checks whether the components fit together, and canaries a candidate manifest beside a stable one. The historical lookup at the end recovers the prompt identity after a rollback. Tracing and Observability for AI Systems covers the runtime events that complement this configuration record.

Versioning is not the same as packaging

Start with two records. The manifest binds the component identities that can be deployed together. The deployment record says how requests are assigned to one or more manifests. During a canary, both records matter. A request log can reference its resolved manifest even after the deployment record changes.

Component

A component is any artifact whose identity affects system behavior. Models, prompts, retrieval indexes, tool schemas, routers, guardrails, and the orchestration code are all components. A component is identified by a key (e.g., model, prompt.main) and a version. The key names the role the artifact plays in the system; the version names which instantiation of that role is in use. Keeping both is what lets you ask either "what is the model right now?" (a lookup by key) or "where is this specific prompt instantiation used?" (a lookup by version).

Artifact identity

An artifact identity selects an artifact within a stated identity scheme. For artifacts you can read, a digest can detect changed bytes. For an externally hosted model, a provider-issued version identifier records which version you requested or which version the service reports. Its resolution and guarantees depend on the provider. NIST Secure Hash Standard

Manifest

A manifest is a versioned document mapping component keys to artifact identities, plus the compatibility constraints that must hold among them. A manifest is the unit of coordinated release. It is the thing you sign off on, the thing you canary, and the thing you can point at during a postmortem. The manifest is immutable: changing a component produces a new manifest, never an edited old one. Immutability is what makes an old manifest id a meaningful pointer to an old configuration.

Deployment

A deployment assigns traffic to active manifests. Two deployments can point to the same manifest. One deployment can point to both the stable and the candidate manifests during a canary.

The separation between manifest and deployment matters. Many teams conflate the two by treating "the currently deployed version" as a global mutable alias. That works until you need a canary (two manifests live at once) or a rollback (revert a deployment without reverting the manifest store). Keep them as separate stores. The manifest store is append-only: it grows with every release and never forgets. The deployment store is small and mutable: it changes on every promotion and every rollback. When these are conflated, rollback means "rebuild the previous state from git history and hope," which is exactly the panic mode that versioning is supposed to eliminate.

What varies in a release, and why each variation is dangerous

A release can change behavior through any of the following inputs.

  • Model and tokenizer. Record the model revision, the tokenizer or its revision when controlled, and the serving settings relevant to an evaluation.
  • Prompt. Version the template and the rendering code or configuration. Log the effective template version when a request can select among several.
  • Data and retrieval. Record the source snapshot, preprocessing, embedding identity, and index build. An index may need rebuilding when its data or embedding pipeline changes.
  • Tool interface and implementation. Track the schema shown to the model and the revision of the code or service that implements the calls. An unchanged schema can still accompany different semantics.
  • Routing and decoding. Record router policy, generation defaults, and request-level overrides when these affect what ran.

These references work together. If a newly released model expects arguments in a different form, a tool schema test can reveal whether the old payload is still accepted. Then run task cases that require correct tool selection and arguments. A tool that accepts a string called order_id could still look up the wrong namespace. That is a semantic check. Pinning the tool interface, implementation, and its relevant data dependencies lets you reproduce the specific combination under investigation.

Data can drift without any edits to the application repository. In a help center, for example, an index built on January 1 and one built on February 1 can share the same endpoint name. Archiving a release record that names only the endpoint cannot identify the document snapshot used by the January release. A reproducible record can identify corpus snapshot, chunker and options, embedder revision, index build, and query-time filters or ranking configuration. The exact subset you need depends on which stages must be reconstructed.

A manifest format for compound systems

The manifest holds component references and a parent release identifier. Its compatibility policy is also versioned. This example pins the policy by name and runs its registered implementation before a release enters the store. The dataclasses describe the record shape. The explicit compatibility check validates the combination at registration.

The provenance fields in the example include the parent identity, timestamp, revision, and a synthetic orchestration commit. Those fields count as part of the record's identity. The manifest uses typed fields; this fixture is built directly in Python and skips external parsing.

PythonIn [3]
CollapseExpand
import hashlib
import json
from dataclasses import asdict, dataclass, replace
from datetime import datetime, timezone
from fractions import Fraction
from typing import Literal


@dataclass(frozen=True)
class ComponentRef:
    key: str
    version: str
    identity: str
    source: Literal["content-hash", "provider-tag", "git-sha"]


@dataclass(frozen=True)
class Manifest:
    name: str
    revision: int
    created_at: str
    components: dict[str, ComponentRef]
    commit: str
    parent: str | None = None
    compatibility_policy: str = "embedding-index-v1"

The source field explains how to interpret an identity. Rehash content-derived references when you load their original bytes. Keep the provider tag alongside any provider-reported revision for components whose bytes you cannot obtain.

The hash covers every serialized field. Sorting object keys and choosing one whitespace convention makes equal input records produce equal bytes under this encoder. This is a deliberately narrow local encoding. An interoperable hash contract needs shared rules for all supported values, including Unicode and numbers. RFC 8785

PythonIn [4]
CollapseExpand
def canonical_bytes(manifest: Manifest) -> bytes:
    payload = asdict(manifest)
    return json.dumps(payload, sort_keys=True, separators=(",", ":")).encode(
        "utf-8"
    )


def manifest_id(manifest: Manifest) -> str:
    return "sha256:" + hashlib.sha256(canonical_bytes(manifest)).hexdigest()

The fictional support assistant has one hosted model, a prompt, a lookup tool, an index, and an embedder. The locally defined prompt and tool schema have real SHA-256 digests over synthetic bytes. Model and index identifiers are invented fixture values.

PythonIn [5]
CollapseExpand
def content_identity(text: str) -> str:
    return "sha256:" + hashlib.sha256(text.encode()).hexdigest()


# Synthetic component contents (as bytes we control)
PROMPT_V3 = "You are a support agent. Cite [doc_id] for every claim.\n"
TOOL_SCHEMA_V2 = json.dumps(
    {
        "name": "lookup_order",
        "parameters": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
        },
    },
    sort_keys=True,
)

base_manifest = Manifest(
    name="support-agent",
    revision=1,
    created_at=datetime(2025, 6, 1, tzinfo=timezone.utc).isoformat(),
    commit="a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0",
    components={
        "model": ComponentRef(
            key="model",
            version="gpt-x-2025-06",
            identity="gpt-x-2025-06-01",
            source="provider-tag",
        ),
        "prompt.main": ComponentRef(
            key="prompt.main",
            version="v3",
            identity=content_identity(PROMPT_V3),
            source="content-hash",
        ),
        "tools.lookup_order": ComponentRef(
            key="tools.lookup_order",
            version="v2",
            identity=content_identity(TOOL_SCHEMA_V2),
            source="content-hash",
        ),
        "index.kb": ComponentRef(
            key="index.kb",
            version="kb-2025-06",
            identity="pinecone://kb-v7",
            source="provider-tag",
        ),
        "embed.kb": ComponentRef(
            key="embed.kb",
            version="e5-base-v2",
            identity="hf:e5-base-v2@sha:ab12",
            source="provider-tag",
        ),
    },
)
ConsoleOut [6]
CollapseExpand
Manifest revision: 1
Manifest identity: sha256:36f5a9a25a9a355007606bdd62b2ee9ce23584262e4f3af9aeb4b8bbe1201508
Prompt identity:   sha256:0540bce600e9f6bbfd52ab5121a7c6d4a65039ce8f7d016b82ff53c9a3178166
Tool identity:     sha256:796532bc34cd28b6b8fd72804d31791cb0606b4e75443896deda562168a401ec

Here is how a team could construct a content-derived reference for the source snapshot and record the tool implementation separately from its argument schema. The identifiers below are for demonstration. They are not used by a model or a tool in this notebook.

PythonIn [7]
CollapseExpand
document_snapshot = {
    "help-refunds": "Refund requests require the original receipt.",
    "help-delivery": "Delivery estimates appear on the dispatch record.",
}
snapshot_bytes = json.dumps(
    document_snapshot, sort_keys=True, separators=(",", ":")
)
snapshot_ref = ComponentRef(
    key="corpus.kb",
    version="kb-2025-06",
    identity=content_identity(snapshot_bytes),
    source="content-hash",
)
tool_implementation_ref = ComponentRef(
    key="tools.lookup_order.implementation",
    version="service-v4",
    identity=base_manifest.commit,
    source="git-sha",
)
print(snapshot_ref.key, snapshot_ref.identity)
print(tool_implementation_ref.key, tool_implementation_ref.version)
ConsoleOut [7]
CollapseExpand
corpus.kb sha256:9fc2446724a09e6975942fec9bfddb36f5d2d887f6107b362b4d01c24685572c
tools.lookup_order.implementation service-v4

The source snapshot and index identity are different records. A corpus can support several index builds, and the same corpus can produce a different retrieval index when chunking or the embedder changes. The implementation reference and schema digest are also different records. A compatible schema can stay the same while the underlying code changes.

A manifest assembly service can use a store of immutable named artifacts and add these references only after it validates that the component key and resolver are understood. A mutable catalog is still useful for candidate discovery. When the release is composed, resolve each mutable reference to the stable identity you intend to preserve. The release record should keep that result as a value, so reading it later does not resolve a moving reference by accident.

The digest gives the request log a compact reference to the entire manifest record. Fetching that record recovers the refs it contains. Recovering component content still requires retention of those artifacts and continued access to external dependencies.

Reverse the component map's insertion order and serialize both records under three conventions. Both sorted encodings agree across insertion orders. They still produce different bytes from one another because one uses spaces. The release needs one agreed convention so the encoding is reproducible on both the writing and the reading sides.

PythonIn [8]
CollapseExpand
manifest_a = base_manifest
manifest_b = replace(
    base_manifest,
    components=dict(reversed(list(base_manifest.components.items()))),
)


def identity_variant(manifest, *, sort_keys, compact):
    separators = (",", ":") if compact else None
    payload = json.dumps(
        asdict(manifest), sort_keys=sort_keys, separators=separators
    )
    return content_identity(payload)


variants = [
    ("insertion order", False, False),
    ("sorted keys, spaced", True, False),
    ("sorted keys, compact", True, True),
]
variant_ids = {
    label: [
        identity_variant(m, sort_keys=sort, compact=compact)
        for m in (manifest_a, manifest_b)
    ]
    for label, sort, compact in variants
}
distinct_counts = {label: len(set(ids)) for label, ids in variant_ids.items()}
assert variant_ids["sorted keys, compact"][0] == manifest_id(base_manifest)
assert (
    variant_ids["sorted keys, compact"][0]
    != variant_ids["sorted keys, spaced"][0]
)
VisualizationOut [9]
CollapseExpand
Bar heights are two for insertion order, one for sorted keys with spaces, and one for sorted compact keys.
Both sorted encodings yield one digest across the two insertion orders. The unsorted encoding yields two. The spaced and compact encodings still disagree with each other.

Compatibility: constraints across components

A type check can confirm that the embedder and index fields are both present. Compatibility checks inspect the relationship between them. A 1024-coordinate query cannot be compared by ordinary dot product to a 768-coordinate index vector. Two equally sized vectors can be compared numerically, but a query produced in an unrelated embedding space can still retrieve irrelevant results.

The fixture checks the query dimension and the exact embedder identity expected by the index. The metadata is simulated. A production registry needs recorded, trustworthy metadata tied to the referenced artifacts.

PythonIn [10]
CollapseExpand
# Fake "metadata" attached to provider-tagged components, as a provider registry would supply.
REGISTRY = {
    "gpt-x-2025-06-01": {"tokenizer": "tok-v5", "max_context": 128_000},
    "hf:e5-base-v2@sha:ab12": {"dim": 768, "tokenizer": "tok-v5"},
    "hf:e5-large-v2@sha:cd34": {"dim": 1024, "tokenizer": "tok-v5"},
    "pinecone://kb-v7": {"dim": 768, "embedder": "hf:e5-base-v2@sha:ab12"},
}


def check_embedding_matches_index(m: Manifest) -> str | None:
    emb = REGISTRY[m.components["embed.kb"].identity]["dim"]
    idx = REGISTRY[m.components["index.kb"].identity]["dim"]
    if emb != idx:
        return f"embed.kb dim={emb} but index.kb dim={idx}"
    return None


def check_index_embedder_consistent(m: Manifest) -> str | None:
    idx_embedder = REGISTRY[m.components["index.kb"].identity]["embedder"]
    if idx_embedder != m.components["embed.kb"].identity:
        return f"index built with {idx_embedder}, querying with {m.components['embed.kb'].identity}"
    return None


CONSTRAINTS = [check_embedding_matches_index, check_index_embedder_consistent]


def releasable(m: Manifest) -> tuple[bool, list[str]]:
    if m.compatibility_policy != "embedding-index-v1":
        return False, [f"unknown compatibility policy {m.compatibility_policy}"]
    try:
        violations = [v for fn in CONSTRAINTS if (v := fn(m)) is not None]
    except KeyError as exc:
        return False, [f"unregistered component or metadata: {exc}"]
    return (not violations, violations)

The compatibility registry resolves the two synthetic metadata records before registration. Its keys identify the declared artifacts. This example checks two relationships. Additional constraints can be added under a new policy version.

PythonIn [11]
CollapseExpand
ok, errors = releasable(base_manifest)
print("Stable release:", ok, "| Violations:", errors)

bad_manifest = replace(
    base_manifest,
    revision=2,
    parent=manifest_id(base_manifest),
    components={
        **base_manifest.components,
        "embed.kb": ComponentRef(
            key="embed.kb",
            version="e5-large-v2",
            identity="hf:e5-large-v2@sha:cd34",
            source="provider-tag",
        ),
    },
)
ConsoleOut [11]
CollapseExpand
Stable release: True | Violations: []
PythonIn [12]
CollapseExpand
def register(store: dict[str, bytes], manifest: Manifest) -> str:
    ok, issues = releasable(manifest)
    if not ok:
        raise ValueError("; ".join(issues))
    encoding = canonical_bytes(manifest)
    mid = manifest_id(manifest)
    if store.setdefault(mid, encoding) != encoding:
        raise ValueError("manifest digest collision")
    return mid


registry: dict[str, bytes] = {}
stable_id = register(registry, base_manifest)
try:
    register(registry, bad_manifest)
except ValueError as err:
    print("Blocked release:", err)
ConsoleOut [12]
CollapseExpand
Blocked release: embed.kb dim=1024 but index.kb dim=768; index built with hf:e5-base-v2@sha:ab12, querying with hf:e5-large-v2@sha:cd34

The 1024-coordinate candidate fails both checks. The identity check also catches an equally sized but incompatible embedding model. A readable violation names the component and values involved so an operator can see which bundle needs correction.

What constraints cannot catch

These predicates cover known structural requirements. Evaluation-Driven Development measures behavior that the declared schema cannot capture, such as whether the prompt helps the model select the intended tool on representative cases.

Test the compatibility boundary with an equally sized but independently produced embedding. The sample adds a third synthetic embedder to the local metadata registry. Fixing the vector size gives only one of the two compatibility conditions.

PythonIn [13]
CollapseExpand
same_size_embedder = "other-embedding-space-v1"
REGISTRY[same_size_embedder] = {"dim": 768}
wrong_space = replace(
    base_manifest,
    components={
        **base_manifest.components,
        "embed.kb": ComponentRef(
            key="embed.kb",
            version="different-768",
            identity=same_size_embedder,
            source="provider-tag",
        ),
    },
)
assert check_embedding_matches_index(wrong_space) is None
print(releasable(wrong_space))
ConsoleOut [13]
CollapseExpand
(False, ['index built with hf:e5-base-v2@sha:ab12, querying with other-embedding-space-v1'])

This test exercises the difference between a shape constraint and an identity constraint. In a deployment whose two encoders are deliberately paired, for example a trained query encoder and a separate document encoder, replace the exact equality here with a record of the declared compatible pair. A code-level equality check is appropriate for the same-encoder fixture, while the compatibility rule should reflect how the index was trained and assembled.

Release: turning a manifest into a deployment

A canary is a partial, time-limited deployment whose results inform rollout. The stable service acts as the control. The traffic policy here uses positive weights that sum to one. Order changes which seeded draws route to an arm while preserving that arm's probability. Canarying Releases

PythonIn [14]
CollapseExpand
import math
import random


@dataclass(frozen=True)
class DeploymentRecord:
    name: str
    allocations: tuple[tuple[float, str], ...]

    def __post_init__(self):
        weights = [weight for weight, _ in self.allocations]
        identities = [mid for _, mid in self.allocations]
        if (
            any(not math.isfinite(w) or w <= 0 for w in weights)
            or not math.isclose(sum(weights), 1.0)
            or len(set(identities)) != len(identities)
        ):
            raise ValueError(
                "Use positive weights summing to one and unique ids."
            )


def activate(
    name: str, allocations, store: dict[str, bytes]
) -> DeploymentRecord:
    if any(mid not in store for _, mid in allocations):
        raise ValueError("A deployment may select only registered manifests.")
    return DeploymentRecord(name, allocations)


def route(rng: random.Random, dep: DeploymentRecord) -> str:
    draw = rng.random()
    cutoff = 0.0
    for weight, mid in dep.allocations:
        cutoff += weight
        if draw < cutoff:
            return mid
    return dep.allocations[-1][1]  # Final arm absorbs rounding at the boundary.

Create a candidate with the same retrieval components and a new prompt. The new manifest also records the parent and revision. The activation function checks that both identities are registered before constructing the deployment.

PythonIn [15]
CollapseExpand
PROMPT_V4 = (
    "You are a support agent. Put the source id after each policy claim.\n"
)
candidate = replace(
    base_manifest,
    revision=2,
    parent=stable_id,
    components={
        **base_manifest.components,
        "prompt.main": ComponentRef(
            key="prompt.main",
            version="v4",
            identity=content_identity(PROMPT_V4),
            source="content-hash",
        ),
    },
)
canary_id = register(registry, candidate)
canary = activate(
    "support-agent", ((0.9, stable_id), (0.1, canary_id)), registry
)

rng = random.Random(0)
counts = {stable_id: 0, canary_id: 0}
for _ in range(10_000):
    counts[route(rng, canary)] += 1
ConsoleOut [16]
CollapseExpand
stable 0.904
canary 0.096

The allocation is a probability for each request in this simulation. The realized fraction over a finite stream varies with the seed. Reusing the seed, allocation, and draw order reproduces the simulated counts.

The two seeded curves show how observed request share approaches the 10% target in these simulated runs. The horizontal axis uses a logarithmic scale so the early variation remains visible.

PythonIn [17]
CollapseExpand
import numpy as np


# Replay the same seeded routing stream and record the running canary fraction.
def canary_running_fraction(seed, n_total):
    r = random.Random(seed)
    dep = canary
    hits = 0
    fracs = []
    for i in range(1, n_total + 1):
        if route(r, dep) == canary_id:
            hits += 1
        fracs.append(hits / i)
    return np.arange(1, n_total + 1), np.array(fracs)


xs, frac_seed0 = canary_running_fraction(0, 10_000)
_, frac_seed1 = canary_running_fraction(1, 10_000)
target_share = 0.10
VisualizationOut [18]
CollapseExpand
Two seeded running shares fluctuate early and approach the dashed 10 percent target. Request count uses a logarithmic axis.
The running canary share from two simulated streams approaches the 10 percent target. The early draws produce more visible variation.

The unit of assignment matters when several requests belong to one session. If the desired unit is a session, assign the session once and reuse its arm. A seed based on a different identifier for every request does not keep the session on one arm. Record the assigned manifest on each request so a later traffic change cannot replace the historical record.

Use the deployment record as a separate configuration object. Replacing this record does not store or rewrite manifest bytes. Newly assigned requests use the new record once it propagates to routing processes. Existing sessions can be allowed to finish on their earlier version, reassigned, or drained, depending on their state. Keep the version assigned to each request even if a higher-level session retains its arm.

An example assistant that does several calls per request should resolve the manifest at the start and retain that binding while processing the request. If an operator changes a live alias between retrieval and generation, resolving it again could pair a new prompt with the previous retrieval configuration. The resulting request would be hard to explain from one recorded version. Latching the initial manifest separates release decisions from the work it already admitted.

Canary, metrics, and the decision to promote or roll back

Set a quality threshold, a minimum sample for each arm, and the decision time before examining results. For example, review one outcome per eligible unit and apply the same grader to both arms. Compare outcomes from contemporaneous, representative traffic and check that assignment is not confounded by traffic type or infrastructure. Canarying Releases

This notebook simulates independent, binary evaluator outcomes under two assumed pass probabilities. The 4,000 and 800 outcomes are a separate fixture for the decision rule. They are sampled directly per arm rather than drawn from the routing example. The observed rates are estimates of the assumed probabilities.

Let kak_a count passing outcomes in arm aa and nan_a count all judged outcomes in that arm. The measured canary loss dd subtracts the canary pass rate from the stable pass rate. Positive dd means a lower measured rate for the canary.

d=kstablenstable−kcanaryncanaryd = \frac{k_{\mathrm{stable}}}{n_{\mathrm{stable}}} - \frac{k_{\mathrm{canary}}}{n_{\mathrm{canary}}}

The fixture requires 500 outcomes in both arms and rolls back if the measured loss exceeds one percentage point. It compares the rates as exact fractions so a loss equal to the threshold stays on the review branch. This is a demonstration of a predeclared operational rule. It neither tests statistical significance nor establishes noninferiority. A real experiment should choose a sample plan and inference method for the design, expected variability, and cost of false decisions. Repeated monitoring needs a decision plan that accounts for repeated looks.

PythonIn [19]
CollapseExpand
def observe(
    rng: random.Random, pass_probability: float, n: int
) -> tuple[int, int]:
    return sum(rng.random() < pass_probability for _ in range(n)), n


def canary_decision(stable, trial, *, minimum=500, max_drop=0.01):
    stable_passes, stable_total = stable
    trial_passes, trial_total = trial
    if min(stable_total, trial_total) < minimum:
        return "COLLECT MORE"
    drop = Fraction(stable_passes, stable_total) - Fraction(
        trial_passes, trial_total
    )
    return "ROLL BACK" if drop > Fraction(str(max_drop)) else "READY FOR REVIEW"


rng = random.Random(1)
stable_observation = observe(rng, 0.92, 4_000)
canary_observation = observe(rng, 0.90, 800)
decision = canary_decision(stable_observation, canary_observation)
ConsoleOut [20]
CollapseExpand
stable: 3678/4000 = 91.950%
canary: 715/800 = 89.375%
Decision: ROLL BACK

The observed canary loss crosses the threshold in this run. The deployment can restore stable traffic while the candidate remains in the store for diagnosis. A result labeled READY FOR REVIEW would still require review of any guardrails outside this example. Canary traffic and shadow traffic also differ in whether the candidate's output is returned to the caller. Online Experiments and Production Evaluation

Check the branch that waits for evidence explicitly. Raising a fixed sample minimum protects the decision from being taken too early under this rule. It does not make the measurement represent the population or bound its error rate by itself.

PythonIn [21]
CollapseExpand
short_trial = (18, 20)
equal_rates = (470, 500)
print(canary_decision(stable_observation, short_trial))
print(canary_decision(equal_rates, equal_rates))
at_limit = canary_decision((460, 500), (455, 500))
assert at_limit == "READY FOR REVIEW"
print("At exactly one percentage point:", at_limit)
ConsoleOut [21]
CollapseExpand
COLLECT MORE
READY FOR REVIEW
At exactly one percentage point: READY FOR REVIEW

A useful rollout procedure specifies what each outcome triggers, including both paths that do not automatically change traffic. In this policy COLLECT MORE leaves the canary assignment in place, and READY FOR REVIEW permits the next check. ROLL BACK changes active assignment to stable after a loss beyond tolerance. Apply traffic guardrails for latency, resource cost, and critical failures separately. Their measurement units can be different from a pass rate. Latency may be summarized over a comparable time window, while a missing required permission check may merit an immediate stop regardless of the average.

Artifact lineage: reconstructing what produced an output

A request execution uses entities such as the manifest and retrieved documents. It produces an output. Recording those relationships lets you work backward from an output to the inputs recorded for it, or forward from a known component to the recorded requests that referenced it. W3C PROV-DM distinguishes the activities that use entities from the production of new entities. W3C PROV-DM

The request record uses the manifest id to identify the release and repeats its human-readable versions for grouping. Document ids record the retrieved items for this request. In a mutable corpus they would also need versioned resolution to recover the retrieved text. The output hash supports byte equality checks against retained text. A hash alone cannot restore that text.

PythonIn [22]
CollapseExpand
@dataclass(frozen=True)
class RequestRecord:
    request_id: str
    manifest_id: str
    component_versions: dict[str, str]  # key -> version, for quick grouping
    retrieved_doc_ids: list[str]  # data lineage for this request
    output_artifact_id: str  # sha256 of the UTF-8 output bytes

The manifest id resolves the retained versioned release. The request constructor reads the selected manifest bytes by id. It does not compute a fresh identity from a mutable draft. The repeated component versions make the local example easy to query. For impact analysis based on human labels, enforce unique version labels per component or query by immutable identity.

PythonIn [23]
CollapseExpand
def make_record(
    request_id: str,
    mid: str,
    docs: list[str],
    output_text: str,
    store: dict[str, bytes],
) -> RequestRecord:
    manifest = json.loads(store[mid])
    return RequestRecord(
        request_id=request_id,
        manifest_id=mid,
        component_versions={
            key: ref["version"] for key, ref in manifest["components"].items()
        },
        retrieved_doc_ids=docs[:],
        output_artifact_id=content_identity(output_text),
    )


sample = make_record(
    "req-0001",
    stable_id,
    docs=["kb-9f8e", "kb-3a2b"],
    output_text="According to [kb-9f8e], your order shipped Tuesday.",
    store=registry,
)
ConsoleOut [24]
CollapseExpand
request: req-0001
manifest: sha256:36f5a9a25a9a3550 ...
versions: {'embed.kb': 'e5-base-v2', 'index.kb': 'kb-2025-06', 'model': 'gpt-x-2025-06', 'prompt.main': 'v3', 'tools.lookup_order': 'v2'}
retrieved: ['kb-9f8e', 'kb-3a2b']
output id: sha256:ed937ba75c96bf45 ...

Forward impact is a group-by over these records. Given a component version, find every record whose component_versions contains it:

PythonIn [25]
CollapseExpand
# Synthetic log of request records.
rng = random.Random(7)
log: list[RequestRecord] = []
for i in range(200):
    mid = route(rng, canary)
    doc = f"kb-{rng.randrange(16):04x}"
    log.append(make_record(f"req-{i:04d}", mid, [doc], f"answer {i}", registry))


def affected_by_version(
    log: list[RequestRecord], key: str, version: str
) -> list[str]:
    return [
        r.request_id for r in log if r.component_versions.get(key) == version
    ]
ConsoleOut [26]
CollapseExpand
prompt.main=v3: 176 requests affected
prompt.main=v4: 24 requests affected

The query returns requests recorded under the named component version within the retained log. It identifies the affected cohort, while whether a particular answer was wrong still needs review. Gaps from sampling or expired retention limit the result. Joining on exact artifact identities avoids treating two assignments of the same display label as one artifact.

For an historical audit, ask what can be determined from the record before promising a replay. Two requests with the same manifest id can return different documents. Two requests can also see the same document ids with different contents if the ids are mutable. That is why a versioned source snapshot or document revisions belong in the analysis whenever reconstruction requires the specific text. The toy log stores only document ids because its goal is to trace the manifest used by each request.

A version-filtered request list narrows the audit scope. If a report was assembled by joining requests to a moving prompt alias, the current alias target could make earlier results look as if they used the new version. Join on the recorded immutable id or an equivalent stable revision. When aggregating metrics, record the time interval or population and distinguish unlogged cases from cases that have been evaluated and found unaffected.

The hard limits: what you cannot reproduce

There are three useful reproducibility targets. Record-level reconstruction recovers the known configuration for a request. Behavioral reproduction checks whether a rerun meets defined criteria. Byte-exact reproduction asks whether output bytes match. A manifest directly helps with the first target. The other two depend on the captured inputs, runtime, and retained artifacts.

A provider tag and a timestamp record an external reference. A provider-reported resolved revision is additional evidence when exposed. Only make guarantees allowed by the provider's versioning contract. An index build id and the retrieved document revisions help distinguish changed retrieval from changed generation. Retain the query, applied filters, and selection parameters where needed and permitted.

A seed fixes a source of variance under matching conditions. It cannot establish that all kernels, hardware, frameworks, or request scheduling behave identically. PyTorch documents that identical seeds may still yield different results between CPU and GPU. Evaluate behavioral reproduction across repeated runs when stochasticity matters. Use the same criteria and the same documented evaluation protocol. PyTorch Reproducibility

For behavior-level comparisons, it can be enough to rerun a versioned task suite against the recovered configuration under a documented sampling policy. Examples include the fraction of correctly routed requests or the fraction of answers containing the required evidence. These summaries compare behavior at the level you specified. They cannot establish that a particular production answer or its side effects would repeat. For byte comparisons, retain the exact normalization and serialization if your goal is a normalized output rather than the raw returned bytes.

A configuration can be reproducibly identified yet unavailable. A provider can retire a version, an old tool can stop serving requests, or data-retention obligations can eliminate the original inputs. Treat artifact retention and dependency availability as release prerequisites when recovery matters. Keep a separate recovery test that periodically verifies referenced artifacts can be resolved and that the previous stable release still starts against its expected state.

Coordinated releases across independently versioned components

Components can have independent development schedules while the system releases a coordinated bundle. Compose a new manifest for the selected revisions, check the component relationships, and evaluate the assembled system before traffic moves. A corpus refresh counts as a release when it changes the index or other behavior seen by the deployed system. A prompt edited out of band creates a gap between what the manifest declares and what requests execute.

A name such as production can move to a different manifest. Keep that alias for operators, and log its resolved identifier for requests. In a multi-step request, latch the resolution if every step must see the same bundle. That way changing the alias does not change the interpretation of recorded events.

Worked example: a full canary rollout with rollback

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]
CollapseExpand
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]
CollapseExpand
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]
CollapseExpand
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]
CollapseExpand
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.

Limitations and impact

A manifest certifies which inputs it names only to the extent that the references resolve and the runtime uses them. Compatibility predicates cover the relationships you encode. Evaluation provides separate evidence of how the assembled release behaves.

Lineage consumes retention and indexing capacity. Request identifiers and retrieved document identifiers may be sensitive. Keep only fields justified by the audit or evaluation purpose, limit access, and account for gaps when querying historical impact. Tracing and Observability for AI Systems

Summary

  • Hash the manifest with a defined encoding. Pin component revisions and retain the exact serialized record used to compute the identifier.
  • Check compatibility at registration. Evaluate the behavior of the assembled bundle separately.
  • Observe a candidate against stable during a bounded canary and decide using metrics and criteria chosen in advance.
  • Change future traffic assignment to roll back. Keep historical manifests and their resolved identities in request records.
  • State whether the records support reconstructing configuration, reproducing measured behavior, or reproducing exact output bytes.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about versioning models, prompts, data, and tools in compound AI systems.

Versioning Models, Prompts, Data, and Tools

Question 1 of 80 of 8 completed
Why does the chapter separate the manifest store from the deployment store?
Join the discussionAsk a question or share what you learned.

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!

A different angle
All writing
Language AI Handbook · Vol. 20

Reliability and Cost Engineering

Design reliable, cost-aware AI services with SLOs, retries, idempotency, Little's law, caching, and fault injection under real deadlines.

29 min read
Language AI Handbook · Vol. 20

Evaluation-Driven Development

Build an offline evaluation harness for language systems: versioned task suites, traces, slice scores, and regression gates that block hidden drops.

27 min read
Language AI Handbook · Vol. 20

Models, Retrieval, Tools, and Control Flow

Build a compound AI assistant with models, retrieval, tools, and explicit control flow. Learn to separate catalog data from inventory and degrade gracefully.

22 min read

About the author

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2026versioningmodels, author = {Michael Brenndoerfer}, title = {Versioning Models, Prompts, Data, and Tools}, year = {2026}, url = {https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-12-03} }
APAAcademic
Michael Brenndoerfer (2026). Versioning Models, Prompts, Data, and Tools. Retrieved from https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools
MLAAcademic
Michael Brenndoerfer. "Versioning Models, Prompts, Data, and Tools." 2026. Web. December 3, 2026. <https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools>.
CHICAGOAcademic
Michael Brenndoerfer. "Versioning Models, Prompts, Data, and Tools." Accessed December 3, 2026. https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools.
HARVARDAcademic
Michael Brenndoerfer (2026) 'Versioning Models, Prompts, Data, and Tools'. Available at: https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools (Accessed: December 3, 2026).
SimpleBasic
Michael Brenndoerfer (2026). Versioning Models, Prompts, Data, and Tools. https://mbrenndoerfer.com/writing/versioning-models-prompts-data-and-tools
Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy