

# Choose how queries read the knowledge base

When an agent queries an Agent Context, AWS Context reads the knowledge base to return content and to confirm that the end user can still read each document. You choose how it reads the knowledge base when you create the connection:
+  *The caller’s credentials (default)* – AWS Context reads the knowledge base with the credentials of the principal that calls the Agent Context, through forward access sessions (FAS). The caller’s IAM permissions decide which knowledge bases it can read, as they do when it calls Amazon Bedrock directly. Keep granting these permissions the way you do today, for example through IAM Identity Center permission sets or the IAM roles that users federate into. For more information, see [Forward access sessions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_forward_access_sessions.html) in the * IAM User Guide*.
+  *A data access role* – AWS Context assumes a data access role that you configure on the connection. The role’s permissions decide what every caller of the connection can read, so callers need access only to the Agent Context. Choose this option when you want the Agent Context to be the only resource that callers need permissions for.

With either option, when the request carries the end user’s identity, AWS Context propagates that identity to the knowledge base. The knowledge base then returns only the documents that the end user can read. For more information, see [End-user identity propagation](identity-propagation.md).

A caller can’t switch between the two options for a request. If you map another connection that reaches the same knowledge base into the same Agent Context, the connection whose mapping you created first decides which option applies. For more information, see [When several connections reach the same data](how-access-controls-apply-when-aws-context-queries-data.md#overlapping-connections).

Trace analysis uses neither option: it runs without a caller, so it reads data through the trace analysis role that you configure for it. For more information, see [Trace analysis role](trace-analysis-role.md).