Back to catalog / Agent research
Return traceable citations for document question answering
Provide documents as trusted sources and preserve source locations in answers instead of asking the model to invent citations.
Goal
Answer document questions while linking each checkable claim to an input document.
Steps
- Prepare a small authorized document set with stable source IDs and recognizable titles/content. [citations]
- Follow the citations example using document content blocks with
citations.enabled, passing only authorized text in the message. [citations] - Read citation objects and locations, render links to source documents, and verify each span falls within the source. [citations]
How to verify
Test with a question containing an unsupported trap; citations point only to supplied documents and positions are verifiable.
Troubleshooting
If no citation is returned, report insufficient evidence; do not fall back to generated page numbers or URLs.
Permissions
Prerequisites
- Python 3.11+, the anthropic SDK, a valid API key, and authorized source documents.
Permissions
- Pass only documents the user may read; enforce source access controls before returning results.
Limitations
This feature depends on supported models and supplied sources; a citation does not prove an inference is correct or authorize disclosure.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- misc/using_citations.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief