创建

登录 ReadmeX

或

了解我们如何处理你的信息: 隐私政策

ReadmeX

陪你读懂 AI 动态

今天,想先了解什么?

选一份动态总结,或直接聊聊你的问题。

社区和关注动态总结只属于你自己。

资讯

OpenRouter指南提出四种AI智能体循环控制措施

AI 总结

OpenRouter发布指南,帮助阻止AI智能体反复调用持续失败的工具。指南建议采用死循环检测、重复调用识别规则、单次运行的步数与成本上限,以及API密钥信用额度限制。前三项可通过OpenRouter Agent SDK 0.11.0实现,密钥额度限制则由OpenRouter执行。在OpenRouter针对六个模型的测试中,启用检测后,六个模型均在第三次完全相同的工具调用时被拦截。未启用检测时,18次运行中有4次持续重试,直到触发40步上限;启用后,18次运行中有16次在两次实际工具调用后结束。精确匹配检测可能漏掉参数略有变化的循环,指南建议通过归一化loop key加以处理。

深度见解

这四项措施针对不同的失控情形:重复调用检测、参数归一化、单次运行限制和服务商侧支出限制。OpenRouter的测试为控制反复工具调用与成本提供了实施参考。

How to Stop an AI Agent Stuck in an Infinite Loop

OpenRouter ·11/12/2026

How to Stop an AI Agent Stuck in an Infinite Loop
How to Stop an AI Agent Stuck in an Infinite Loop

An AI agent gets stuck in an infinite loop when a model keeps calling a tool that fails, usually with the same arguments, because nothing in the agent loop tells it to stop. Each retry resends the whole conversation, so every turn costs more than the last, and a loop left running overnight can cost thousands of dollars.

This guide stops the loop with four guards, which we tested on six current models. Three run inside your agent through the OpenRouter Agent SDK (@openrouter/agent 0.11.0): doom-loop detection, a rule for which calls count as repeats, and caps on steps and cost. The fourth is a credit limit on your API key. We enforce it on our side, so it holds even when your agent code has a bug.

#OpenRouter#OpenRouter Agent SDK

原文约 12 分钟读完阅读原文
群聊

还没有评论,来说说你的看法。