# Lineage Tracking

> Tag every agent output with the exact prompt version, model version, tool versions, and retrieved documents that produced it — so any output is fully reproducible and attributable.

- **Category**: Agentic AI
- **Subcategory**: Governance & Observability
- **Canonical URL**: https://designpattern.fyi/patterns/lineage_tracking/

---

## Description
**Intent**: Track which prompt version, model version, and data sources produced each agent output.
**Context**: Agent outputs may be referenced weeks or months after generation — an underwriting decision, a generated contract clause, a research summary cited elsewhere. Over that time, prompts evolve, models are upgraded, tools change, and retrieval indexes are rebuilt. When a customer or auditor surfaces a specific past output and asks how it was produced, you need to answer precisely.
**Solution**: Tag every agent output with: prompt template hash, model id and version, tool versions, retrieved-document ids, and decision-log id. Store in a queryable lineage store. Make lineage joinable to the output store.



## Use Cases
- Output disputes, audits, or rollbacks require knowing exactly what produced a given output.
- Prompts, models, tools, and retrieved documents change often enough that ad-hoc tracking fails.
- A queryable lineage store can be joined to the output store.






## Trade-offs


### Advantages

- Output disputes are answerable — trace back to exactly what produced any output.

- Targeted rollback becomes possible — revert just the changed component.




### Considerations & Drawbacks

- Storage grows continuously — requires retention policies.

- Lineage schema must evolve carefully; schema changes can orphan past records.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/lineage-tracking/)

