Amazon Web Services: Switching Knowledge Retrieval Depth Between Pure Retrieval, Single-Shot Generation, and Multi-Turn Planning with One Parameter
The Amazon Web Services Machine Learning blog explains how the AgenticRetrieveStream interface of Amazon Bedrock Managed Knowledge Base switches between three retrieval modes via the maxAgentIteration parameter: 0 for pure retrieval with zero LLM calls, 1 for single-shot retrieval plus one generation, and 2 to 5 for multi-turn planning. The article presents the core model for counting iterations—one iteration equals one foundation model call, with the loop always ending in a response generation call—and explains how this model makes behavior predictable.
When building knowledge base question-answering applications, developers face a common contradiction: simple lookups require speed and low cost, while complex comparisons require multi-turn searches and evidence integration. If separate systems are built for each type of request, maintenance costs double; if multi-turn planning is used uniformly, simple queries incur unnecessary latency and model invocation fees. An article published by the Amazon Web Services Machine Learning blog on November 9, 2026, explains how Amazon Bedrock Managed Knowledge Base resolves this issue through the maxAgentIteration parameter of the AgenticRetrieveStream interface: the same API, one integer, three behaviors.
Understanding this parameter requires clarifying how iterations are counted. The model provided in the article is: one iteration equals one foundation model call, and the loop always ends with a call to generate an answer. Therefore, a value of n means up to n minus 1 rounds of planning, with the last round reserved for generating the response. Each planning round consists of one query rewrite plus one retrieval. There is also an exception that does not consume iteration quota: speculative retrieval—the initial retrieval launched before the first planning step does not count against maxAgentIteration; it only serves to make requests faster. This counting model is the most operationally valuable part of the article because it allows developers to predict exactly how many model invocations a request will trigger at most.