Your agent keeps calling the same tool with paraphrased arguments and never converges. How do you fix this?
Think first
Think about: stopping conditions, dedup, prompt design, budget.
Strong answer
Three compounding fixes: (1) Set hard limits — max_iter (e.g., 10), cost budget (e.g., $1), global timeout. These are non-negotiable. (2) Deduplicate tool calls — track recent calls (tool name + args hash) and skip/refuse if the same call is made within the last 3 steps, feeding back 'Already called with these args, try a different approach.' (3) Fix the prompt — vague prompts like 'be thorough' encourage looping. Replace with a concrete stopping condition: 'Answer when you have 3 distinct sources covering the query.' Add a reflection step before the final answer: 'Do I have enough to answer?' Also: trace every step so you can debug, and add a force_answer fallback when the budget is exhausted.
Weak-answer indicators
- Only suggests 'increase max_iter' (makes it worse)
- Doesn't mention cost budget
- Skips deduplication
- Doesn't address the prompt as root cause
Likely follow-up questions
- How do you trace an agent's execution for debugging?
- What's a reasonable cost budget per agent run?