[FEATURE] Native citations for RAG / Knowledge Base tool results
Problem
Bedrock Converse API supports native citations when it sees DocumentBlock in conversation context. PR #576 added support for tools to return DocumentBlock. However, there's no documented pattern for the most common use case: Bedrock Knowledge Base retrieval → native citations.
The KB RetrieveCommand API returns plain text chunks (strings), not DocumentBlock objects. To get native citations, a tool would need to:
- Call KB Retrieve to get text chunks + source S3 URIs
- Fetch the original source documents from S3 as bytes
- Construct
DocumentBlock objects with those bytes
- Return them from the tool
This is inefficient (fetching full PDFs for each query) and loses chunk-level granularity — Bedrock would cite the whole document, not the specific retrieved passage.
Proposed Solution
One or more of:
- SDK-level RAG helper that wraps KB Retrieve and automatically constructs citation-ready content blocks from the results
- Document fragment support — allow
DocumentBlock to carry a text excerpt with source metadata, so Bedrock can generate citations from retrieved chunks without needing the full document bytes
- Integration example — at minimum, a documented pattern for how to bridge KB Retrieve → DocumentBlock → native citations, even if it requires full doc fetch
Context
Impact
This is the missing link between Bedrock's two flagship features (Knowledge Bases and native citations). Any agent using KB retrieval tools today cannot leverage native citations without fetching full source documents on every query, which is impractical at scale.
[FEATURE] Native citations for RAG / Knowledge Base tool results
Problem
Bedrock Converse API supports native citations when it sees
DocumentBlockin conversation context. PR #576 added support for tools to returnDocumentBlock. However, there's no documented pattern for the most common use case: Bedrock Knowledge Base retrieval → native citations.The KB
RetrieveCommandAPI returns plain text chunks (strings), notDocumentBlockobjects. To get native citations, a tool would need to:DocumentBlockobjects with those bytesThis is inefficient (fetching full PDFs for each query) and loses chunk-level granularity — Bedrock would cite the whole document, not the specific retrieved passage.
Proposed Solution
One or more of:
DocumentBlockto carry a text excerpt with source metadata, so Bedrock can generate citations from retrieved chunks without needing the full document bytesContext
DocumentBlockin tool results (v0.7.0+)@aws-sdk/client-bedrock-agent-runtimeRetrieveCommand[1] DocName — "excerpt", parsed client-side)Impact
This is the missing link between Bedrock's two flagship features (Knowledge Bases and native citations). Any agent using KB retrieval tools today cannot leverage native citations without fetching full source documents on every query, which is impractical at scale.