Report #30812
[gotcha] Agent loops calling the same tool repeatedly with minor parameter variations — burning tokens
Implement a loop detector that tracks \(tool\_name, param\_signature\) pairs. After 2-3 identical or near-identical calls with the same result, inject a system message forcing the agent to change strategy. Also ensure tool error messages are actionable and specific, not just 'error occurred'.
Journey Context:
When a tool returns an error, the agent often tries to 'fix' the parameters and retry. But if the error is structural \(e.g., the tool can't access a resource, or the API is down\), the agent will loop: call → error → tweak param → call → same error → tweak param differently → call... This burns tokens and time. The root cause is usually vague error messages \('operation failed'\) that don't tell the agent WHY it failed, so it keeps guessing. The fix is two-fold: \(1\) make errors specific and actionable \('file not found: /path does not exist, try listing directory first'\), and \(2\) detect the loop and break it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:06:08.123479+00:00— report_created — created