Amazon Bedrock Managed Knowledge Base adds single-shot RAG and retrieval‑only modes

· Engineer's Notes · Cem Koyluoglu

New maxAgentIteration settings let developers choose between single‑shot retrieval, retrieval‑only, or multi‑step agentic retrieval for flexible latency and cost.

What happened

Amazon Bedrock Managed Knowledge Base introduced three configurable retrieval modes through the maxAgentIteration parameter. A value of 0 returns only the matching passages, performing a single guaranteed retrieval with no foundation model (LLM) call. A value of 1 enables single‑shot Retrieval Augmented Generation (RAG): the service performs one retrieval and then generates an answer in a single LLM call, without any planning or query rewriting. Values 2 to 5 activate the existing agentic retrieval workflow, where a foundation model decomposes complex questions, performs multiple searches, evaluates evidence, and may refine queries before a final answer is generated. The iteration count reflects the number of LLM calls; each planning round consumes one iteration, and the final answer generation always uses the last iteration. The initial speculative retrieval does not count toward the limit. The new range of maxAgentIteration is 0–5, and all three modes support multiple knowledge bases.

Why it matters in production

The expanded mode selection gives developers a single API for both simple look‑ups and complex comparative queries, reducing the need for custom orchestration code. For straightforward questions, setting maxAgentIteration=1 limits LLM usage to one call, lowering latency and model cost compared with the multi‑round agentic flow. When only source text is required, maxAgentIteration=0 eliminates LLM calls entirely, providing the fastest response and the lowest compute expense. Conversely, higher iteration values (2‑5) improve answer accuracy for multi‑part or evidence‑sparse questions by allowing the model to rewrite sub‑queries and retrieve additional context, at the expense of higher latency and increased LLM consumption. Predictable iteration accounting also aids capacity planning: each additional planning round adds a deterministic LLM call, making cost and performance modeling straightforward. The ability to toggle generation (generateResponse=true/false) further separates retrieval latency from answer synthesis, enabling use‑cases such as user‑driven document review without incurring LLM charges.

Engineering takeaways

  • Use maxAgentIteration=0 for retrieval‑only scenarios to avoid any LLM invocation and achieve minimal latency.
  • Choose maxAgentIteration=1 for well‑scoped, single‑shot questions when a generated answer is needed with the lowest possible model usage.
  • Reserve maxAgentIteration=2‑5 for complex, multi‑part queries; tune the exact value based on observed accuracy versus latency trade‑offs.
  • Keep the iteration limit consistent across requests to simplify monitoring of LLM call counts and cost forecasting.
  • Leverage the same AgenticRetrieveStream endpoint for all modes, eliminating the need for separate retrieval and generation APIs and reducing integration overhead.

Related work on this site

  • RAG & Grounded LLM Systems — LLM features that answer from the right source instead of from memory: document-grounded assistants, transcript-grounded chat and quality gates around generated output.
  • Agentic & LLM Automation — Multi-step LLM pipelines that run unattended: model cascades with fallbacks, validation gates, scheduled automation and alerting when something breaks.
  • YouTube AI Summarizer — Open-source Chrome extension on the Chrome Web Store: AI summaries, key points, deep analysis, a two-host AI podcast (Gemini TTS) and transcript-grounded chat for any YouTube video, using Groq or Ollama Cloud with the user’s own key.
  • Ireland Expat Assistant — A custom GPT that answers from uploaded official documents: step-by-step guidance on Irish visas/IRP, employment permits, tax (PAYE/PRSI/USC), HSE/Medical Card and citizenship.

This note was drafted with AI assistance from the primary source credited on this page, and automatically checked against that source before publishing.

Source: https://aws.amazon.com/blogs/machine-learning/single-shot-and-agentic-retrieval-with-amazon-bedrock-managed-knowledge-base/

← All tech news