Agent Duplicate Tool-Call Detection

Reliability · updated Thu Feb 26

Prevent redundant execution and 'infinite loops' by identifying identical tool requests within a single session.

Steps

  1. Generate a `call_signature` by hashing the tool name and ordered arguments.
  2. Maintain a `session_call_stack` to track all unique signatures in the current run.
  3. Intercept tool calls and compare the new signature against the history.
  4. Block execution if a signature is identical to a previous call without a state change.
  5. Inject a 'Duplicate Call Warning' back into the LLM context to force a strategy shift.
  6. Log the duplicate attempt for debugging agentic loop failures.

view raw JSON →