arXiv:2606.10209cs.AIcs.LG2026-06被引 1

通过保留最近工具交互并压缩摘要,显著提升长流程企业工具调用的效率与准确率。

Less Context, Better Agents: Efficient Context Engineering for Long-Horizon Tool-Using LLM Agents

  • 仅保留最近5轮工具调用并自动摘要,替代完整对话历史。
  • 准确率从8.0%提升至91.6%,推理时间缩短至5.79小时。
  • 适合需要高效处理复杂企业工作流的LLM应用开发者。

将大语言模型部署为自主代理以处理企业工作流时,面临一个关键挑战:企业系统返回的冗长工具响应会导致上下文溢出、状态过期错误和高昂推理成本。本文以微软 Dynamics 365 Finance and Operations 中的自动化报销项目为例,研究该问题。在包含50个任务的酒店报销基准测试中,评估了四种GPT-5配置:无用户模型基线、保留完整对话历史、仅保留最近5轮工具调用/响应对、以及结合自动摘要的剪枝。结果取自5次独立运行的平均值,用户模型保持一致。无用户模型基线完成度仅8.0%;保留完整历史可提升至71.0%,但消耗1,480,996个令牌,耗时14.56小时;仅保留最近5轮工具交互可达到79.0%完成度,令牌数降至535,274,耗时5.39小时;加入自动摘要后,完成度达91.6%,平均金额识别率达99.64%,仅需553,374个令牌,耗时5.79小时。此外还报告了置信区间、效应量分析、剪枝与摘要窗口敏感性、失败分析,以及按五类报销类型分组的结果,并验证了Claude Sonnet 4.5的跨模型一致性。

原文摘要 · Abstract (English)

Large language models deployed as autonomous agents for enterprise workflows face a key challenge: verbose tool responses from enterprise systems can cause context overflow, stale-state errors, and high inference cost. We study this problem in automated expense itemization in Microsoft Dynamics 365 Finance and Operations using Model Context Protocol tools. We evaluate four GPT-5 configurations on a 50-task hotel expense benchmark: no user model, full conversation history, context pruned to the last 5 tool call/response pairs, and pruning with automated summarization. Results are averaged across 5 independent runs, with the user model held constant for the context-engineering comparison. The no-user-model baseline achieves only 8.0% complete itemization. Full-context retention improves completion to 71.0%, but consumes 1,480,996 tokens and 14.56 hours per benchmark. Pruning to the last 5 tool calls improves completion to 79.0% while reducing token use to 535,274 and runtime to 5.39 hours. Adding summarization achieves the best result: 91.6% complete itemization and 99.64% average amount itemized, with 553,374 tokens and 5.79 hours. We further report confidence intervals, effect-size analysis, sensitivity over pruning and summary windows, failure analysis, results across five expense types grouped into three categories, and cross-model evidence with Claude Sonnet 4.5. These results show that, for this class of enterprise tool-use workflow, selective retention of recent tool interactions plus compact summarization can improve both reliability and efficiency compared with full-history retention.

LLM代理上下文优化企业工作流

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