MikhbarMIKHBAR
Apps & Software

Building Agentic Retrieval on Amazon Bedrock with AWS CDK

A new architectural pattern for enterprise retrieval brings multi-turn planning, semantic routing, and built-in observability to Managed Amazon Bedrock Knowledge Bases.

Building Agentic Retrieval on Amazon Bedrock with AWS CDK

Understanding the Limits of Traditional RAG

Traditional Retrieval-Augmented Generation systems follow a straightforward approach: they embed a question, fetch the nearest chunks from a single index, and hand those chunks to a model to generate an answer. While this single-shot pipeline works well for straightforward inquiries, it breaks down when facing complex cross-corpus queries or tasks requiring multiple iterations. A single retrieval call often returns incomplete information, leading to fluent yet inaccurate answers because the system lacks a mechanism to re-examine the corpus or route questions dynamically.

To solve these architectural hurdles, developers are turning to enterprise agentic retrieval. By integrating a reasoning agent into the workflow, the system can determine whether retrieval is necessary, select the appropriate data source, and perform multiple lookups before composing a grounded and cited response. These capabilities are central to modern implementations on <a href="https://aws.amazon.com/blogs/machine-learning/build-agentic-retrieval-on-a-managed-amazon-bedrock-knowledge-base-with-cdk/">AWS Machine Learning Blog</a> frameworks, marking a significant evolution from older single-shot solutions.

Agent routing a question across two managed knowledge bases through the Gateway, with every step landing in Amazon CloudWatch
Image related to the report from AWS Machine Learning Blog · Source: AWS Machine Learning Blog

The Evolution from DIY to Managed Knowledge Bases

Earlier deployment patterns, such as the approach detailed in a previous <a href="https://aws.amazon.com/blogs/machine-learning/build-an-end-to-end-rag-solution-using-knowledge-bases-for-amazon-bedrock-and-the-aws-cdk/">2024 post</a>, required developers to manually provision and sequence separate resources like vector stores and storage buckets. In contrast, current architectures leverage the Managed Knowledge Base type provided by <a href="https://docs.aws.amazon.com/bedrock/">Amazon Bedrock</a>, which autonomously manages data ingestion, storage, indexing, and retrieval.

This managed model eliminates the need to provision or scale customer-managed vector infrastructure such as collections in <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless.html">Amazon OpenSearch Serverless</a>. By removing the overhead of managing OpenSearch Compute Units, engineering teams can focus entirely on application logic while relying on service-managed models for embedding and internal reranking.

Flow diagram: user question to AgentCore Runtime, out through AgentCore Gateway to two AgenticRetrieveStream tools backed by financial and weather managed knowledge bases fed from Amazon S3, returning a cited answer, wit
Image related to the report from AWS Machine Learning Blog · Source: AWS Machine Learning Blog

Powering Agentic Workflows with AgentCore and CDK

The agentic capabilities of the new architecture are powered by <a href="https://docs.aws.amazon.com/bedrock-agentcore/">Amazon Bedrock AgentCore</a>. This component features a Gateway that exposes each knowledge base as a Model Context Protocol tool, alongside a Runtime that hosts the reasoning agent. Utilizing the AgenticRetrieveStream API, the system executes multi-turn planning and returns synthesized answers complete with citations.

Deploying this multi-component infrastructure is streamlined through the <a href="https://docs.aws.amazon.com/cdk/">AWS CDK</a>. Instead of orchestrating resource stacks by hand, developers can define the entire application—including storage buckets managed via <a href="https://docs.aws.amazon.com/s3/">Amazon Simple Storage Service (Amazon S3)</a> and the associated knowledge bases—as a single Python-based application.

Managed ingestion result showing one document indexed per knowledge base with zero failures
Image related to the report from AWS Machine Learning Blog · Source: AWS Machine Learning Blog

Observability and Continuous Evaluation

Because agentic systems follow non-deterministic execution paths depending on the exact phrasing of a user's question, monitoring their internal behavior is critical. Operational visibility ensures that developers can track call volumes, latency, and token usage effectively across production environments.

To address this requirement, the reference architecture integrates deep telemetry directly into the deployment package. Utilizing <a href="https://docs.aws.amazon.com/cloudwatch/">Amazon CloudWatch</a>, the application provisions specialized dashboards spanning seven distinct layers of observability alongside both on-demand and continuous evaluation frameworks.

AWS CloudFormation console listing four stacks — bmkb-obs-cdk-kb, -gateway, -agent, and -dashboards — each with status CREATE_COMPLETE.
Image related to the report from AWS Machine Learning Blog · Source: AWS Machine Learning Blog

Sources

Continue chronologically

Related entity coverage