Context attribution

Identify which retrieved sources influenced an agent's response.

Supported on
Platform
API
SDK

Context attribution identifies which retrieved sources influenced each statement in an agent's response. It traces outputs back to vector database content, web search results, tool outputs, and conversation context.

How context attribution works

Context attribution identifies which sources shaped an agent's response and to what degree. It works by testing how the response changes when different sources are removed. Sources that cause the biggest changes receive higher influence scores.

The process works at statement-level granularity, so each sentence in the response is analyzed independently against the available sources.

Source types

Context attribution can trace influence from multiple source types:

Source typeDescription
Vector databaseContent retrieved from your knowledge bases
Web searchResults from web search tool calls
Tool outputsResponses from other tools the agent called

Influence scores

Each source receives an influence score indicating how strongly it affected a given statement. Higher scores mean the model relied more heavily on that source when generating the statement.

Influence is measured by observing how the model's output changes when a source is removed. Sources that cause significant changes when removed receive higher influence scores.

When to use context attribution

Context attribution is useful when you need to:

  • Verify grounding — Confirm that agent responses are based on retrieved sources rather than prior model knowledge
  • Debug retrieval — Identify when irrelevant or incorrect sources are influencing outputs
  • Audit responses — Document which sources contributed to specific statements for compliance requirements
  • Improve retrieval quality — Analyze patterns in influential sources to refine your knowledge base or retrieval configuration

Limitations

Context attribution identifies correlation between sources and outputs, but does not guarantee causal relationships in all cases. Statements with low influence scores across all sources may indicate the model relied on its prior knowledge rather than retrieved context.