Bedrock Managed Knowledge Base 支持 single-shot RAG 与 agentic retrieval
Amazon Bedrock Managed Knowledge Base now supports single-shot RAG and retrieval-only requests through AgenticRetrieveStream, alongside agentic retrieval. This post explains how th
Full article body is primarily in Chinese for SEO depth; key points above are localized. Use the language switcher and deep links for global navigation.

# Bedrock Managed Knowledge Base 支持 single-shot RAG 与 agentic retrieval
Amazon Bedrock Managed Knowledge Base 在 2026 年 11 月 9 日新增对 single-shot RAG 和 retrieval-only 请求的支持,这些功能通过 AgenticRetrieveStream API 与现有的 agentic retrieval 能力无缝整合。
对开发编码应用(如内部知识库助手)来说,这意味着你可以在同一个 API 接口内,根据问题复杂度动态匹配检索效率:简单查询用单次检索快速生成答案,复杂对比问题则通过多轮规划检索提供更准确的证据。
决策时,优先选择 maxAgentIteration 参数值:0 表示纯检索,1 表示单次 RAG,2–5 表示传统 agentic 模式。实际应用中,先用代表性问题测试,结合延迟和成本指标决定默认配置,避免过度规划导致不必要的开销。
AgenticRetrieveStream 是 Bedrock 知识库检索的核心 API,允许通过 agenticRetrieveConfiguration 对象灵活控制模式。
核心优势
通过单一参数 maxAgentIteration(0–5),Bedrock Managed Knowledge Base 让应用无需维护多个检索路径,就能平衡速度、准确性和成本。
具体来说:
- 多部分问题处理:复杂查询可拆分为子问题,分别检索证据后再综合。
- 自适应规划:若证据不足,planner 会自动扩展检索范围。
- 带引用回答:启用生成响应后,答案附带源文本引用,便于调试。
- 零或低模型调用:检索-only 模式完全跳过 LLM 调用,适合仅需源文本查看场景。
这些特性让同一助手既能快速回答日常文档查询,又能深入对比政策差异,符合实际业务需求。
迭代次数如何计算
一次迭代对应一次基础模型调用(LLM 调用)。请求始终以最终答案生成结束(若启用)。
- 初始预取检索不计入迭代次数。
maxAgentIteration = n允许最多n-1次规划与检索轮次。- 保留值 0–5 的范围已扩展,兼容单知识库和多知识库场景。
三大检索模式对比
使用同一 API 请求体,只需调整两个关键参数即可切换模式:
| 参数 | 模式 | LLM 调用次数 | 适用场景示例 | 最佳实践 |
|---|---|---|---|---|
maxAgentIteration=0 | Retrieval-only | 0 | 仅需原始段落查看 | 员工手动复核政策文本 |
maxAgentIteration=1 | Single-shot RAG | 1 | 直接查询、单次检索足量 | 业务账户开立清单查询 |
maxAgentIteration=2-5 | Agentic retrieval | 多轮(规划+检索+生成) | 多文档对比、跨结构要求 | 公司形式差异分析 |
此表格便于快速决策:简单流量默认 1,复杂查询手动提升值。
实际案例:银行政策助手
一家银行内部助手维护账户开立文件库,员工可通过 AI 查询所需文档或对比不同所有制公司要求。
- 单次直接查询:询问“开设企业支票账户所需文件”,设置
maxAgentIteration=1+generateResponse=true。系统仅检索一次后生成清单答案,无规划开销。 - 跨文件对比:询问“sole proprietor、LLC 和合伙公司要求的差异及非居民额外审核”,设置
maxAgentIteration=4。planner 自动分解问题、检索多份政策指南、评估证据后综合回答。 - 纯源文本查看:员工需复核政策原文,设置
maxAgentIteration=0+generateResponse=false。返回去重段落,不调用任何 LLM。
所有请求共用 AgenticRetrieveStream,应用层仅负责按场景选择参数。
代码示例
以下是完整请求体示例(JSON 格式,可直接传入 SDK 或 HTTP 调用):
``json { "messages": [ { "content": { "text": "How do account-opening requirements differ for sole proprietors and LLCs, and what additional checks, if any, apply to nonresident owners under our policy?" }, "role": "user" } ], "retrievers": [ { "description": "Knowledge base of account-opening procedures, documentation checklists, and policy guides", "configuration": { "knowledgeBase": { "knowledgeBaseId": "KB12345678" } } } ], "generateResponse": true, "agenticRetrieveConfiguration": { "foundationModelType": "MANAGED", "rerankingModelType": "MANAGED", "maxAgentIteration": 4 } } ``
单次 RAG 示例只需将 maxAgentIteration 改为 1;纯检索模式则设为 0 并关闭生成响应。
风险与边界
过高 maxAgentIteration 值会增加延迟和 Token 消耗,尤其在高并发场景下可能导致账单超支。边界情况包括:若知识库内容过旧或查询范围过宽,单次检索可能无法覆盖全答案,需结合实际测试决定。Bedrock 知识库检索结果依赖于底层文档质量,AI 生成内容可能包含幻觉,务必人工审核后使用。此内容非法律意见,实际决策请参考官方文档并评估自身使用场景。
延伸阅读
- Amazon Bedrock 知识库官方文档
- API 中转与 Bedrock 集成指南
- AgenticRetrieveStream API 参考
- 本地部署与 vLLM 实验实验室
- 模型天梯与开源模型对比
- OpenAI 官方 API 使用指南
- 多模型本地部署实战
English summary
Amazon Bedrock Managed Knowledge Base now adds support for single-shot RAG and retrieval-only requests via the AgenticRetrieveStream API, alongside traditional agentic retrieval. This allows applications to dynamically match retrieval effort to query complexity using a single parameter: maxAgentIteration values of 0 (retrieval only), 1 (single-shot RAG), or 2–5 (full agentic mode). In a fictional banking policy assistant, simple document lookups use one retrieval for fast answers, while comparisons across ownership structures leverage multiple planning rounds for accuracy. The approach reduces custom orchestration, lowers costs for straightforward queries, and provides traceable citations. Developers should test representative questions to choose the optimal iteration limit, balancing speed and answer quality without rebuilding logic for each use case. All examples are illustrative and based on AWS documentation from November 9, 2026.
适用于 GrokCode 倍率榜。信息仅供参考,不构成购买、投资或法律意见。