Toolspublished

AWS Publishes Two AgentCore Paths to Query Cross-Account Knowledge Bases

The useful constraint is not simply access across AWS accounts: generated answers require an assumed role, while many workloads may not need an agent at all.

By 3 min read
AWS Publishes Two AgentCore Paths to Query Cross-Account Knowledge Bases

Listen to this story

The audio brief

About 1:38
0:001:38
Read transcript
AWS has published two generally available ways to query an Amazon Bedrock Knowledge Base from an agent running in another AWS account, without moving governed Redshift Serverless data. The catch is important: cross-account resource policies allow retrieval, but not RetrieveAndGenerate—the operation that returns a model-written answer. So the querying tool must use AWS STS to assume a narrowly scoped IAM role in the account holding the knowledge base, then make the call. From there, teams choose between two AgentCore designs. A code-based Strands agent runs on AgentCore Runtime, with Python owning the loop, retries, middleware, instrumentation, and tool behavior. The declarative option lets AgentCore manage that loop: AgentCore Gateway routes to an AWS Lambda tool, whose execution role becomes the cross-account identity. But AWS’s bigger recommendation is to ask whether an agent is needed at all. Use native Retrieve when you only need source content. If every request needs one generated answer, call RetrieveAndGenerate directly from an application or Lambda. Agent orchestration makes sense when a model must choose tools, reason across steps, or maintain conversational state. The remaining constraint is reliability. Generated SQL is still nondeterministic, even with identical inputs. AWS recommends specifying row counts, date ranges, and sort order, then checking answers against the tool response and underlying data. Least-privilege roles, refreshable STS credentials, Guardrails, citations, and human review remain necessary. The key decision is not cross-account access—it is how much orchestration the workload truly needs.

Story brief

3 key points

Teams can now keep a Redshift Serverless-backed Bedrock Knowledge Base in a governed data account while an AgentCore workload queries it and receives model-generated answers with citations. AWS’s two GA implementations differ operationally: a Strands agent gives developers control over loops and tools, while a declarative harness delegates orchestration to AgentCore Gateway and Lambda. The access workaround is STS...

  1. 01

    The gap: resource policies cover Retrieve and GetDocumentContent, but not RetrieveAndGenerate, so the tool assumes an IAM role via STS.

  2. 02

    Code-based Strands on AgentCore Runtime favors custom loops; declarative AgentCore harness uses Gateway and Lambda for managed execution.

  3. 03

    AWS recommends native Retrieve or direct RetrieveAndGenerate when tool selection, multi-step reasoning, and conversational state are unnecessary.

AWS has published two generally available AgentCore patterns for agents that need answers from a Bedrock Knowledge Base held in a separate AWS account. Both are designed to query a Redshift Serverless-backed knowledge base without copying its governed source data into the account running the agent.

The missing permission is generated answers

The design addresses a specific gap in Bedrock Knowledge Bases’ cross-account controls. Resource policies support the Retrieve and GetDocumentContent operations, but not RetrieveAndGenerate, which returns a model-generated answer. AWS’s pattern therefore has the querying tool assume a dedicated, narrowly scoped IAM role in the Knowledge Base account through AWS Security Token Service before it calls RetrieveAndGenerate.

In AWS’s example flow, a user submits a natural-language question through an API or Streamlit interface. Amazon Nova Pro chooses whether to invoke the knowledge-base tool; the tool assumes the role and calls RetrieveAndGenerate using Claude Haiku 4.5. The knowledge base turns the question into a structured query against Redshift Serverless, then sends the generated answer and citations back through the selected orchestration path.

The choice is custom control or a managed loop

The first option is a code-based Strands agent on AgentCore runtime. The team’s Python code owns the agent loop, and its knowledge-base tool runs in a local Model Context Protocol subprocess packaged with that runtime. AWS positions it for teams that need custom orchestration, middleware, retry behavior, instrumentation, direct tool control, or streaming control.

The second is a declarative AgentCore harness, where AgentCore runs the loop from a harness definition. Its path sends calls through AgentCore Gateway to an AWS Lambda tool, whose execution role becomes the cross-account principal. AWS frames this as the configuration-first choice when the workload fits the managed loop.

First decide whether an agent belongs in the path

AWS’s most consequential recommendation is to avoid agent orchestration when the task does not need it. Applications that only need retrieved content can use native cross-account Retrieve. If every request needs one deterministic generated answer, AWS recommends assuming the data-account role and calling RetrieveAndGenerate directly from the application or a Lambda function, after confirming the work does not require tool selection, multi-step reasoning, or conversational state.

An agent is the fit when a model must decide when or how to query the knowledge base as part of a broader tool-using conversation. The cross-account requirement itself does not favor either AgentCore implementation; the operating decision is whether a team wants to maintain the loop and tool logic or accept the managed harness model.

Generated SQL still needs boundaries and review

The pattern does not make structured-data answers deterministic. AWS notes that RetrieveAndGenerate remains generative even when both variants receive the same question, Knowledge Base ID, model, retrieval count, and fresh session. It advises validating business facts against the direct tool response and underlying data, while specifying a row count, date range, and sort order for row-level questions because unbounded generated SQL can exceed result-handling limits.

AWS also recommends limiting the assumed role to the necessary Knowledge Base and model resources, using refreshable STS credentials for long-lived runtimes and warm Lambda environments, and applying Bedrock Guardrails. The company says guardrails complement rather than replace least-privilege access, source-data governance, citation-based checks, and human review for consequential decisions. A public GitHub sample contains deployment procedures for both variants.

Sources

  1. aws.amazon.comConnect Amazon Bedrock AgentCore to cross-account knowledge bases | Amazon Web Services