Report #50473
[frontier] Agent makes redundant identical tool calls wasting tokens and latency in iterative loops
Implement content-addressable memoization for tool calls: compute hash\(tool\_name, json\_serialize\(args\)\) as cache key. Return cached results for deterministic read-only tools. Invalidate cache entries when the agent takes actions that mutate relevant state.
Journey Context:
In multi-step agent loops, agents frequently call the same tool with identical arguments: re-reading a file they already read two steps ago, re-searching for the same symbol, re-fetching the same API endpoint. Each redundant call costs tokens for both the tool-call generation and the result processing, and adds network/API latency. Content-addressable memoization: before executing a tool call, compute hash\(tool\_name, canonical\_args\) and check the cache. If hit, return the cached result with a cache-hit indicator so the agent knows it is seeing a previously observed value. Critical considerations: \(1\) only cache deterministic, read-only tools—never cache tools with side effects \(writes, POSTs, mutations\), \(2\) set appropriate TTLs for tools whose results may change over time \(file contents during active editing, API data\), \(3\) implement targeted invalidation—when the agent writes to a file, evict all cache entries for read-file calls on that path, \(4\) include cache metadata in the result so the agent can reason about staleness if needed. Tradeoff: added memory usage and cache-management complexity, but significant savings on repeated tool calls in iterative agent loops—often reducing token usage by 20-40% in coding agent workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:11:56.506315+00:00— report_created — created