63% of my agent's context came from one tool
说明与用途
在代理项目中,63%的上下文来自单一工具(bash),每次调用成本最低,而不频繁但昂贵的网络搜索则产生了大部分成本。
问题
Agents often use tools that generate large amounts of context, but the most frequently used tools are not necessarily the most expensive.
结果
The most-used tool (bash) accounted for 63% of context at the lowest cost per call, while a web search tool, used only 20 times, produced 18 times more context per call and was far more expensive.
工作流
- 1. Extract tool call data from the agent’s session database using SQL.
- 2. Aggregate calls and total characters per tool.
- 3. Calculate characters per call and sort by cost per call.
- 4. Identify high-frequency but low-cost tools and low-frequency but high-cost tools.
- 5. Analyze context re-reading by examining cache read tokens.
- 6. Apply optimizations: filter at the tool, count before reading, batch cheap tools and limit expensive ones.
证据
the tools I reach for most are not the ones that cost the most.
bash 1,603 chars per call grep 3,117 read 4,099 scrape a page 10,519 fetch a page 18,548 web search 27,267
Context was re-read roughly 14 times more often than it was first written.
- 记录日期: 2026-10-12T08:41:25.116Z