Connect Amazon Bedrock AgentCore to cross-account knowledge bases
** Amazon Bedrock AgentCore can now query a Knowledge Base backed by Amazon Redshift Serverless in a different AWS account without copying data, using a cross‑account IAM role and the RetrieveAndGenerate API (executed with Claude Haiku 4.5). The solution offers two orchestration variants—a code‑based Strands agent running in an MCP subprocess and a declarative AgentCore harness that invokes an AWS Lambda tool via AgentCore Gateway. Engineers gain a least‑privilege, multi‑account pattern for RAG‑style agents while keeping data and compute workloads isolated. **KeyTakeaways:** - Cross‑account Knowledge Base access uses the RetrieveAndGenerate action (Claude Haiku 4.5) via a narrowly scoped IAM role. - Variant 1 runs the query tool in a local Model Context Protocol (MCP) subprocess packaged with AgentCore runtime.
⚡ Key Takeaways
- Cross‑account Knowledge Base access uses the RetrieveAndGenerate action (Claude Haiku 4.5) via a narrowly scoped IAM role.
- Variant 1 runs the query tool in a local Model Context Protocol (MCP) subprocess packaged with AgentCore runtime.
- Variant 2 routes the query through an AWS Lambda invoked by AgentCore Gateway (declarative harness).
- The Knowledge Base resource policy must allow Retrieve and GetDocumentContent but not RetrieveAndGenerate, so the tool must assume the bedrock_kb_access_role via AWS STS.
- The pattern preserves account boundaries, avoids data duplication, and provides citation‑rich answers from Redshift Serverless.
** This cross‑account RAG pattern lets production teams enforce strict data governance while still delivering real‑time, LLM‑generated answers, reducing latency and compliance risk compared to data replication. **TechnicalLevel:** Advanced **TargetAudience:** ML Engineers, AI Platform Architects **PracticalSteps:** - Deploy the GitHub sample for Variant 1 or Variant 2, which provisions…
✅ Practical Steps
- Deploy the GitHub sample for Variant 1 or Variant 2, which provisions the Strands agent or declarative harness respectively.
- Configure an IAM role named bedrock_kb_access_role in the Knowledge‑Base account with Retrieve and GetDocumentContent permissions, and allow the AgentCore account to assume it via AWS STS.
- Update the AgentCore tool configuration to call RetrieveAndGenerate with Claude Haiku 4.5, ensuring the assumed role is used for the request.
Want the full story? Read the original article.
Read on AWS ML Blog ↗