最新资讯
dev.to 用 Switch 构建 AI 投资委员会:多空研究员 Agent 协作 bloomberg.com 微软正结束向甲骨文租用 AI 云算力的协议 the-decoder.com Perplexity 推出常驻 AI Agent“Teammates” dev.to osFoundry的Loop和Graph是什么,何时该用哪个? dev.to 限制上下文而非限制评审:面向开源补丁的字节预算证据包 dev.to 约束自主智能体:用 GKE Agent Sandbox 实现亚秒级零信任执行 dev.to 实测:给 Claude Code 十个翻译工具,三次运行中有一次完全不用 unite.ai Ramp 数据:企业 AI token 用量增速超过支出增速 pub.towardsai.net AI 生成的 ICLR 评审对被拒论文更宽松:如何压力测试你的 rebuttal blogs.nvidia.com NVIDIA 开源工具如何助力研究者构建下一代 6G 网络 wired.com AI 公司正积极收购企业工作文件与邮件用于模型训练 wechat 网友用AI搓出来的“App”,可以直接在小红书玩起来了?
多元动态
登录 注册
智能体 dev.to · @Interro

修复 Bedrock ToolResult 顺序错误

原文 我的收藏

文章描述了一类 Bedrock 工具调用故障(INC-004):工具执行成功,但下一条消息因 toolResult ID 与前置 toolUse 顺序不匹配而被 Bedrock 拒绝。该问题在工具并行执行时容易触发,因为异步完成顺序不等于协议顺序,checkpoint 恢复或中间件也可能打乱结果块。修复方法是依据 assistant 的 toolUseId 序列推导结果顺序,为缺失结果填充显式错误块,并在发送给服务商前校验组装好的消息;建议至少测试逆序完成、单个结果缺失、checkpoint 恢复乱序三种场景,不要依赖字典插入顺序或 future 完成顺序。

AI推荐理由 这是一篇针对 AWS Bedrock 工具调用协议的具体工程实践文章,指出了并行工具执行时 toolResult 顺序与 toolUseId 序列不匹配导致请求被拒的问题(INC-004),并给出可操作的修复思路:按 assistant 的 toolUseId 顺序重排结果、为缺失结果填充显式错误块、发送前校验消息,并建议覆盖逆序完成、结果缺失、checkpoint 恢复乱序三类测试。对使用 Bedrock + LangGraph 等 Agent 框架的开发者有直接参考价值。局限在于内容来自个人技术博客,未提供官方文档或可复现的完整代码/日志证据,属于经验性总结而非官方规范。

72

正文

A tool executed successfully, but Bedrock rejected the next message because toolResult IDs did not match the preceding toolUse order. INC-004 is easy to create when tools run in parallel. Async completion order is not protocol order, and checkpoint restore or middleware can shuffle result blocks. The fix is to derive result order from the assistant's toolUseId sequence, fill missing results with explicit error blocks, and validate the assembled message before sending it to the provider. Test at least three cases: Results complete in reverse order. One result is missing. A checkpoint restores shuffled results. Do not rely on dictionary insertion order or the order in which futures complete. The provider contract owns the final ordering rule. Run a source review with: prevention-scanner scan . --format json Enter fullscreen mode Exit fullscreen mode Read the full INC-004 incident. AI #AWS #Bedrock #LangGraph

来源报道 · 1 篇 · 以下链接均前往原始媒体

Interro 修复 Bedrock ToolResult 顺序错误 09-27 · 原文发布
← 返回精选动态 原文

更多内容