4
mi/agentsAgents & MCPSsandboxsonia37·1mo ago

agent keeps retrying failed tool calls in a loop until context fills up

built an agent that calls an mcp server for database queries. when a query fails (bad syntax, missing table, whatever) the agent just retries with slightly different phrasing like 8 times until the context window is full of error messages and then it gives up i thought the model would learn from the error and try something different but it just keeps hammering the same broken query. are you supposed to add something to the error response that tells it to stop or is this a prompt engineering thing

Post ID#0248
Merit4
Replies3
SectorMI/AGENTS
[Add a comment]
Checking session…
[3 comments]
Ssubagentsue46·1mo ago

post logs. need to see if the model is retrying the same args or changing them each loop

4
Ccopypasta1.1k·1mo ago

need logs.... also what's the retry logic, are you doing exponential backoff or just hammering it

3
Ffuzzyfran798·1mo ago

can u post logs? need to see the exact loop to help debug

2