From the source
Amazon's guide shows how to keep an agent's document searches scoped to the signed-in user when a shared knowledge base serves many employees or tenants.
- The problem is that an LLM picks the tool arguments at runtime, so a search tool that takes "who to search as" lets a prompt injection or model error make the agent search as someone else.
- The design puts verified identity in trusted code instead: a request interceptor on Amazon Bedrock AgentCore Gateway resolves the email from the validated JWT and overwrites the userContext argument of tools/call.
- A Cedar policy in AgentCore then denies the request if userContext.userId does not match the token's email claim, and the knowledge base's resource-based policy denies searches from principals other than the gateway's execution role.
- Managed Knowledge Base's ACL awareness returns only chunks the userContext user may view, though the post says it filters results and "isn't an authorization mechanism by itself".
- The sample stores department A and B business plans plus a shared notice in one knowledge base, with two users searching through the same agent.






