【效率反馈】agent 检索/工具使用效率:120s 超时的递归列目录命令 + 输入输出 token 冗余(附拆解与建议) #1864
Replies: 2 comments
|
The data matches our local micro-benchmark and the fix direction is right. Local benchmark (Windows, Node 24, PowerShell 7): We shipped the reusable part: a tools-first Retrieval contract for AGENTS.md (Glob/Grep/Read over shell, node_modules excluded, offset/limit + head_limit, parallel batch reads, stable prompt prefix) ? tutorial with copy-paste snippet:
Supporting your guardrail asks: a default tool-output cap (bytes/lines with truncation marker) and a hint when a shell command looks like recursive directory listing would both prevent the 78KB-garbage-into-context class. Happy to help spec either. |
|
[非官方] 你拆出的第 2 个问题(大段工具输出进入上下文并在后续步骤反复携带)现在有一条不改 Harness 源码的现成路径: |
Uh oh!
There was an error while loading. Please reload this page.
一句话
在"为什么先选工作区"这类需要检索代码库的问题上,agent 的工具调用与 token 消耗存在明显可优化点:一次误用 shell 的递归列目录命令单独耗时 120s(超时)并产出约 78KB 无效输出;整轮 9 步累计输入 307K token、输出 7.1K token,其中相当一部分是可避免的冗余。
观测数据(一次真实会话)
问题拆解
Get-ChildItem -Recurse -Depth 2 -File -Include *.md(PowerShell)遍历进了 node_modules 的损坏符号链接,超时 120 秒并吐约 78KB 错误输出(最终被截断)。这一个调用几乎占满全部工具时间。建议
期望
环境
Windows 11 Pro 10.0.26200 x64 · Node v24.14.1 · dsh 0.1.0-rc.5
补充:以上为观测性质反馈,供改进 agent 检索链路参考;数字来自一次真实会话的会话统计。
All reactions