Report #56471
[synthesis] Recursive tool call explosion without cycle detection causes resource exhaustion and infinite loops
Implement a call graph tracker that maintains a Directed Acyclic Graph \(DAG\) of tool invocations using tool name plus semantic key parameters. Before executing any tool call, verify that the proposed call does not create a cycle in the graph. Set a hard depth limit \(e.g., 10\) and require explicit human approval for deeper chains.
Journey Context:
Agents with reflective capabilities \(ability to call tools that trigger the agent again\) can enter infinite regress. The synthesis reveals that standard recursion limits \(Python's sys.setrecursionlimit\) catch synchronous stack overflow, but agent tool calls are often asynchronous and distributed across network boundaries, bypassing language-level recursion guards. The failure mode: Step 1 calls Tool A, which writes to a file, which triggers a watcher that calls the agent again for Step 2, which calls Tool A again... Each step appears distinct in logs, no single call stack shows the loop. Common mistake: using UUIDs or timestamps to 'uniquify' calls without checking semantic equivalence. The fix requires maintaining a semantic call graph \(tool name \+ key parameters\) as a DAG, checking for cycles before execution, and treating depth limits as fatal errors rather than suggestions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:16:40.419944+00:00— report_created — created