Top 5 This Week

EDITOR'S PICK

Amazon Bedrock Enhances Retrieval-Augmented Generation with Agentic Capabilities

Amazon Web Services is advancing its generative AI offerings with new agentic retrieval capabilities for Amazon Bedrock Managed Knowledge Bases, integrating with the LangChain framework. This enhancement aims to improve the accuracy and comprehensiveness of responses from Retrieval Augmented Generation (RAG) applications, particularly for complex, multi-part queries.

The Chenab Times has learned that traditional RAG applications often struggle with questions that contain multiple intents. A single query vector is used to represent all intents, and the subsequent similarity search retrieves chunks that are topically relevant but may only partially address the user’s full request. The new agentic retrieval feature on Amazon Bedrock Managed Knowledge Base addresses this by enabling the system to intelligently decompose a complex question into multiple sub-queries.

📱 Read faster on The Chenab Times App
✓ Read In Short✓ Personalized Feed✓ Local Weather✓ Saved Articles✓ Offline Mode
⭐ 4.5 · 10,000+ installs
Download Now — Free

Amazon Bedrock Managed Knowledge Base, a fully managed RAG capability, simplifies RAG architecture by abstracting away the self-managed vector store, embeddings, and re-ranking models. Users configure a data source, and Amazon Bedrock handles the complexities of chunking, embedding, storage, and retrieval. This updated system offers two primary APIs for interaction: the Retrieve API, which performs a single hybrid search and returns scored chunks, and the AgenticRetrieveStream API, which orchestrates a multi-step planning loop for retrieval.

Agentic Retrieval: A Deeper Dive

The AgenticRetrieveStream API allows Amazon Bedrock Managed Knowledge Base to plan the retrieval process. It breaks down a user’s query into smaller, manageable sub-queries, executes them, and then evaluates whether sufficient evidence has been gathered. If not, it can initiate further searches. This iterative approach ensures that more comprehensive information is retrieved to answer intricate questions.

📱 Read faster on The Chenab Times App
✓ Read In Short✓ Personalized Feed✓ Local Weather✓ Saved Articles✓ Offline Mode
⭐ 4.5 · 10,000+ installs
Download Now — Free

The langchain-aws package provides developers with access to both the standard retrieval method and the new agentic retrieval functionality. This allows for seamless integration into existing LangChain applications, offering flexibility in choosing the appropriate retrieval strategy based on query complexity.

Implementation and Configuration

To implement agentic retrieval, users require an AWS account with access to Amazon Bedrock in a supported region. The process involves setting up appropriate AWS Identity and Access Management (IAM) roles for the knowledge base to access data sources and for the application to invoke Bedrock APIs. The walkthrough details the necessary permissions, including s3:ListBucket and s3:GetObject for data access, and specific Bedrock actions like bedrock:AgenticRetrieveStream and bedrock:InvokeModelWithResponseStream.

Creating a knowledge base involves configuring it with a managedKnowledgeBaseConfiguration, utilizing a service-managed embedding model. Data is then attached as a data source, typically an Amazon S3 bucket, and an ingestion job is initiated. The system provides mechanisms to monitor the asynchronous ingestion process.

Querying Methods

For straightforward queries with a single intent, the AmazonKnowledgeBasesRetriever from langchain-aws, which wraps the Retrieve API, serves as an efficient and cost-effective option. It provides results with relevance scores and source metadata.

However, for complex questions involving comparisons across multiple dimensions or entities, the standard retriever can fall short. A detailed evaluation on the MuSiQue benchmark indicated that while single-hop questions saw modest recall improvements with agentic retrieval, the gains were more significant for multi-hop questions, demonstrating the value of query decomposition.

Agentic retrieval is accessed via the agentic_retrieve function in langchain-aws. This function leverages the AgenticRetrieveStream API, offering the option to directly generate a grounded response, thus simplifying the RAG chain. For more granular control and inspection, developers can interact directly with the bedrock-agent-runtime client using the agentic_retrieve_stream function. This direct interaction allows for the examination of trace events, providing insights into the planning and retrieval steps undertaken by the agent.

Trace Events and Planning Loop

By examining trace events from the agentic_retrieve_stream API, developers can observe the planner’s steps, including speculative retrieval, planning, sub-query execution, and evaluation. This visibility is crucial for understanding how complex queries are processed and for debugging. The planning loop can involve multiple iterations, with the system deciding whether further retrieval is necessary based on the sufficiency of evidence.

The agentic retrieval process differentiates itself from standard retrieval by its ability to decompose complex queries and its multi-step planning loop. While this offers improved recall for intricate questions, it comes with increased latency and cost per call compared to the single-shot Retrieve API.

Choosing the Right Retrieval Path

The choice between standard and agentic retrieval depends on the nature of the queries. For simple, well-defined questions, the standard Retrieve API is recommended due to its lower cost and faster execution. Agentic retrieval is best suited for multi-part, comparative, or exploratory questions, and scenarios involving multiple knowledge bases. AWS suggests implementing a routing mechanism, such as a classifier or heuristic, to direct queries to the most appropriate retrieval method.

In production environments, Amazon Bedrock Guardrails can be integrated with both retrieval paths to enforce content policies and grounding checks on generated responses. Agentic retrieval supports guardrails through its policyConfiguration.bedrockGuardrailConfiguration, with support for BLOCK mode.

The capabilities introduced with agentic retrieval represent a significant step in making RAG applications more robust and capable of handling the nuances of human language in complex information retrieval tasks. Developers are encouraged to experiment with their specific query mixes to determine the optimal balance between cost, latency, and recall for their applications.

❤️ Support Independent Journalism

Your contribution keeps our reporting free, fearless, and accessible to everyone.

Supporter

₹99/month

Choose ₹99 × 12 months
MOST POPULAR

Patron

₹199/month

Choose ₹199 × 12 months

Champion

₹499/month

Choose ₹499 × 12 months
TOP TIER

Guardian

₹999/month

Choose ₹999 × 12 months

Or make a one-time donation

Secure via Razorpay • 12 monthly payments • Cancel anytime before next cycle









(We don't allow anyone to copy content. For Copyright or Use of Content related questions, visit here.)
logo

The Chenab Times News Desk

Enjoyed this article? Read more, faster on The Chenab Times App. Download free →
News Desk CT
News Desk CThttp://thechenabtimes.com
The Chenab Times News Desk

Popular Articles