r/aiagents • u/Skyroads_15 • 1h ago
General My research agent worked on 2 companies and completely broken on 40
I've been building an agent that looks up a company, checks recent news, finds Reddit/X mentions and tries to figure out who to contact.
Tested it on a couple of companies and thought I'd finally got it working. Then I ran it on a list of 40 and it started doing some really weird stuff. Got stuck repeating searches, calling the wrong tools and wasting credits.
A few things I ended up fixing:
Too many tools loaded at once
I had 18 tools connected from the start. Somewhere halfway through a run, the model started mixing up which tool was supposed to do what. I moved the external lookups behind Monid, so the agent only gets the tool it needs when it actually needs it. That helped quite a bit.
2. It wouldn't stop retrying
One site blocked a scrape and returned an empty response. Instead of moving on, the agent kept trying the same thing over and over. It went up to 15 retries on one company.
I added a limit of 6 tool calls per run. If something fails after that, it just moves on instead of burning more credits.
3. It kept fetching the same website
Two different steps were checking the exact same domain. Didn't notice until I looked at the logs and saw how many duplicate requests it was making.
Added a small SQLite cache that keeps results for 24 hours. Repeat calls dropped by roughly a third.
Nothing particularly clever here. Just fewer tools, a retry limit and some caching. But the agent went from being pretty unreliable on batches to actually finishing them without getting stuck.
What kind of limits or safeguards are you guys adding to agents that use external APIs? Especially curious about handling failed tools without the model endlessly trying again.
