- Newest
- Most votes
- Most comments
Hey,
Hope you're keeping well.
In Bedrock agent orchestration with a Knowledge Base, the $SOURCE_ID$ values are generated during the orchestration step after the KB retrieval phase. When the agent retrieves relevant chunks from the KB, each chunk already has an internal identifier (such as x-amz-bedrock-kb-chunk-id), but during orchestration these are mapped to short alphanumeric codes for readability in the final response. This mapping happens in the agent’s runtime before the LLM prompt is composed, so the short IDs correspond back to the retrieved KB chunks for traceability.
Thanks and regards,
Taz
answered 10 months ago
Hey,
Hope you're keeping well.
In Bedrock agent orchestration, the $SOURCE_ID$ placeholder gets replaced after the Knowledge Base retrieval step but before the final prompt is sent to the LLM. During KB retrieval, each document chunk returned includes an internal reference ID. The orchestration layer then generates short, human-readable alphanumeric codes that map back to those chunk IDs for traceability. This mapping exists only within the agent runtime context, so when the model outputs a source code, the agent can link it back to the exact KB chunk retrieved. If you inspect the agent execution logs in CloudWatch, you can see both the original chunk IDs and their corresponding short codes.
Thanks and regards,
Taz
answered 10 months ago
How are the SOURCE_ID values generated?
The SOURCE_ID values you see in your Bedrock agent responses (like pSGY, t9zu, LEQE) are randomly generated unique identifiers created by the system to associate different sources after Knowledge Base retrieval. For example, you might see values like <source>0Cbu</source> in the agent responses.
When are these SOURCE_ID values generated?
The SOURCE_ID values are generated after a knowledge base retrieval call is completed. Specifically, the process works as follows:
- Your agent initiates a query to the Knowledge Base
- The Knowledge Base retrieves relevant documents/chunks
- After retrieval is complete, the system assigns a unique SOURCE_ID to each retrieved chunk
- These SOURCE_ID values are then made available to the orchestration process before sending the prompt to the foundation model
The values are created dynamically for each query session and are specific to that particular retrieval operation.
Relationship Between SOURCE_ID values and Knowledge Base Chunk IDs
There is no direct correlation between the x-amz-bedrock-kb-chunk-id and SOURCE_ID values - they are different from each other and are unrelated. The SOURCE_ID values are required in our system specifically to uniquely map to a Knowledge Base chunk for the generation of citations. They are used solely for citation generation in the attribute chunks.
- x-amz-bedrock-kb-chunk-id: A permanent, internal identifier for each chunk in your Knowledge Base (example: "c19abb23-d598-42ac-aa8e-28daea176107")
- SOURCE_ID: A temporary, short reference code (example: "0Cbu") generated specifically for citation purposes during a single agent interaction
The SOURCE_ID is an internal construct that does not affect the LLM response or behavior. Each source will have a unique SOURCE_ID value such as <source>XYZA</source>, <source>XYZB</source>, and so on. These values exist just for citation purposes and have no relation to the value of x-amz-bedrock-kb-chunk-id.
Relevant content
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 7 months ago
