自反式API:结构优于冗长,助力AI代理恢复
Self-Reflective APIs: Structure Beats Verbosity for AI Agent Recovery
AI总结:
提出自反式API,在验证失败时返回机器可读的结构化建议,使AI代理无需外部推理即可修复请求并重试,在Anthropic模型上将任务完成率提升36.7-40.0个百分点,且每成功令牌效率提升1.8-2.2倍。
摘要:
当AI代理调用API并遇到验证错误时,它需要的不仅仅是哪里出错了——它需要下一步该做什么。自反式API在验证失败时返回一个机器可读的 recovery_feedback.suggestions[] 负载,足以让代理修复请求并在无需外部推理的情况下重试。在一个经过泄露审计的试点实验(每单元N=30,3个LLM,10个对抗性任务)中,结构化建议在Anthropic模型上将任务完成率提升了+36.7至40.0个百分点(Fisher精确检验 p ≤ 0.0022),每成功令牌效率提高了1.8至2.2倍。在gpt-4o-mini上提升不显著(p=0.435);在计费API上的第二个领域复制确认了这一模式。该比较仅在审计了LLM基准测试中两个未记录的答案泄露类别后才成立。我们提供了 audit_prompt_leakage.py 作为可重用的CI基础设施。代码和数据:https://github.com/arquicanedo/self-reflective-apis。
英文摘要:
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分析而来,可能存在错误,请以论文正文为准。