Skip to content

How is Source ID made in AWS bedrock agent orchestration

0

I know that the $SOURCE_ID$ is a placeholder used in the orchestration prompt template that gets replaced with a unique identifier for each source document or reference used in the agent's response. When you see short 4-digit codes (like pSGY, t9zu, LEQE) in the final response, these are the simplified reference IDs that have replaced the $SOURCE_ID$ placeholder. I want to know how and at which point these are made, how they are mapping to the received documents, and at which point in the (during KB retrievel or during agent orchestration) are these source ids made and mapped.

3 Answers
0

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

0

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

0

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:

  1. Your agent initiates a query to the Knowledge Base
  2. The Knowledge Base retrieves relevant documents/chunks
  3. After retrieval is complete, the system assigns a unique SOURCE_ID to each retrieved chunk
  4. 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.

AWS
SUPPORT ENGINEER

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.