arXiv:2606.05037cs.SEcs.AI2026-06

让AI调用API出错时自动知道怎么改,提升修复成功率。

Self-Reflective APIs: Structure Beats Verbosity for AI Agent Recovery

论文配图:Self-Reflective APIs: Structure Beats Verbosity for AI Agent Recovery
图 1 · 摘自论文原文
  • API出错时返回结构化修复建议,无需额外推理。
  • 在Anthropic模型上任务完成率提升36.7%至40.0个百分点。
  • 适合构建高鲁棒性的AI代理系统,尤其关注API调用可靠性。

当AI代理调用API并遭遇验证错误时,它不仅需要知道哪里出错,更需明确下一步操作。自省式API在验证失败时返回可机器解析的recovery_feedback.suggestions[],使代理能自主修复请求并重试,无需外部推理。在一次泄漏审计后的试点测试中(每组N=30,3个LLM,10个对抗性任务),结构化建议使任务完成率相比纯英文诊断提升36.7%–40.0个百分点(Fisher精确检验p ≤ 0.0022),且每成功令牌效率提高1.8–2.2倍。该优势在gpt-4o-mini上不显著(p=0.435);在账单API上的跨领域复现验证了此模式。该对比仅在审计两个未公开的答桉泄露类别后成立。代码与数据已开源:https://github.com/arquicanedo/self-reflective-apis。

原文摘要 · Abstract (English)

When an AI agent calls an API and hits a validation error, it needs more than what went wrong -- it needs what to do next. A self-reflective API returns, on validation failure, a machine-readable recovery\_feedback.suggestions[] payload sufficient for the agent to repair the request and retry without external reasoning. On a leak-audited pilot ($N{=}30$ per cell, 3 LLMs, 10 adversarial tasks), structured suggestions lift task-completion rate by $+36.7$--$40.0$pp over plain-English diagnoses on Anthropic models (Fisher's exact $p \le 0.0022$), at $1.8$--$2.2\times$ better per-success token efficiency. The lift is not significant on gpt-4o-mini ($p{=}0.435$); a second-domain replication on a billing API confirms the pattern. The comparison only holds after auditing two undocumented classes of answer leakage in LLM benchmarks. We shipaudit\_prompt\_leakage.py as reusable CI infrastructure. Code and data: https://github.com/arquicanedo/self-reflective-apis.

AI代理API设计自省机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。