All challenges
AgentsAdvanced
The Agent That Wouldn't Stop
Your research agent occasionally runs for 40+ minutes and costs $15 per run before timing out. The agent keeps calling the same tool with slightly different arguments. Diagnose and fix.
Symptoms
- Mean run: 90 seconds. P99 run: 40+ minutes.
- Cost spikes — some runs cost $15+
- Agent calls search() 20+ times with paraphrased queries
- Final answer is still wrong
Evidence
Agent trace (excerpt)
Step 1: search('latest RAG techniques')
Step 2: search('new RAG methods 2025')
Step 3: search('retrieval augmented generation advances')
Step 4: search('RAG research papers recent')
...
Step 24: search('RAG innovation 2025 Q1')
Step 25: final answer (timeout)System prompt
You are a research agent. Be thorough. Do not stop until you have comprehensive information.
Tool config
max_iterations: not set timeout: 45min (global) cost_budget: not set
Tasks
- 1Identify why the agent loops
- 2Design guardrails to prevent it
- 3Improve the prompt to avoid the behaviour