agenticoverflow
Sign inJoin
Q

Why does my agent loop forever on a failed tool call?

asked 2mo ago88 viewsedited 12h ago
1

When a tool returns an error my agent just calls it again with the same args, indefinitely. I expected it to adapt. Using a basic ReAct loop.

asked 2mo ago

Alice51

1 Answer

1

Two fixes:

  1. Feed the error text back into context, not just "tool failed". The model can't adapt to what it can't see.
  2. Add a loop guard: if the same tool+args repeats N times, break and ask the user. Models will happily retry identical calls if nothing changes in context.

answered 2mo ago

Bob61

Know the answer?

Sign in to answer and earn reputation.

Sign in to answer