A saved AI product description contains a mistake. Since it was generated, the model, prompt and source rows have changed. The text alone cannot tell a developer which combination produced it, or which other descriptions need checking.
Whenever you keep an AI output, keep a linked provenance record: the evidence of how it was produced. Apply this to reports, generated code, classifications and summaries stored in a database, as well as published content.
Figure: A run ID links the saved description to its provenance receipt, so you can trace it and find related outputs
Give each run an ID and link it to the exact output revision. Store the record with the output or in durable storage it references. Populate it from application code, using the request, response and execution context. Do not ask the model to report its own provenance.
Keep the record for as long as you keep the output. An operational trace can help investigate a run, but it may be sampled or expire before the saved result does.
Mark a model version as unknown when the provider does not return one, because an alias can change. Distinguish explicit settings from provider defaults. A hash verifies inputs but cannot restore them, and a live URL or current row ID cannot recover an earlier value. Use protected references for sensitive tool payloads. For runs with multiple calls, record each call and identify which produced the saved output.
Northwind saves a generated description. Both examples use the same output.
product_id: 42revision: 3description: Lemon tea for a bright afternoon.
❌ Figure: Bad example - The description survives, but its model, prompt and source data are lost
product_id: 42revision: 3description: Lemon tea for a bright afternoon.run_id: run-1042provenance:schema_version: 1provider: example-airequested_model: catalogue-text-3.2-2026-10-01response_model: catalogue-text-3.2-2026-10-01provider_response_id: response-1042prompt: product-description@v7prompt_variables:language: en-AUapplication_release: catalogue@2.4.0sent_parameters:temperature: 0.2max_output_tokens: 128input_snapshot: catalogue-snapshot-2026-11-06-001input_sha256: 63d8c26e8796af1d92b068e487c3d510ab529f64e37a8c90245f6b107d29ae83source_rows:- Products/42@4- Categories/3@2tool_calls: []retrieval_sources: []started_at: '2026-11-06T01:00:00Z'finished_at: '2026-11-06T01:00:02Z'trigger:service: catalogue-workerjob_id: job-88
✅ Figure: Good example - Revision 3 links to run-1042, prompt v7 and the source rows used to generate it
The snapshot contains the rows supplied to the model, so this run has no tool calls or retrieval steps. The prompt version and snapshot resolve to retained content, and the hash checks the snapshot's exact bytes. A maintainer can find other outputs from prompt v7 and inspect the original inputs before deciding what to regenerate.
When a run retries or switches models, record each attempt's ID, requested and actual model, reason, timing and validation outcome. Mark unavailable model versions as unknown. Link the saved output to the attempt or combination that produced it, rather than recording only the first requested model.
Use approved fallback routes and keep enough detail to find affected outputs for review or regeneration. A failed attempt must remain visible as a failure, even when a later attempt succeeds.
Provenance helps reconstruct a run, but it does not guarantee identical text or a correct answer. Use evals to compare quality after a model or prompt change. For AI-assisted code, also keep the reasons for development decisions in the PR or ADR.