Skip to content
Preptima
hardDesignScenarioMidSeniorStaff

How do you stop an agent from looping or running away?

5 min readUpdated 2026-08-15

Answer

Short answer

Enforce step, token, wall-clock and monetary budgets in the orchestrator rather than in the prompt, detect repetition and lack of progress as separate conditions, and require an approval bound to specific arguments before any irreversible action.

Was this answer helpful?

Likely follow-ups

  • An agent spawns sub-agents that spawn sub-agents. How do budgets and cancellation work?
  • The agent is not looping, it is making slow genuine progress and will exhaust its budget. What then?
  • How do you cancel a run whose tool call is already in flight against a third party?
  • What would you alert on to catch a runaway class of run before the bill arrives?

Related questions

Related Topics