Agent loop
An agent loop is the repeating cycle of an AI agent — observe state, decide on an action (usually a tool call), execute, observe the result, and repeat — until a goal is reached or a stop condition fires.
In more detail
What it means
Every AI agent in 2026 runs some variant of an agent loop. The simplest is pure ReAct (thought → action → observation, repeat). Production loops add planner-executor splits, budget caps, no-progress detectors, retry handlers, and circuit breakers. The hardest engineering problem is reliability across long loops: by step 15 most loops drift off-goal without active context distillation, summarisation, and goal re-injection. Best practice in 2026 is to keep loops as short as possible — fewer steps with stronger per-step quality beats long loops with weak steps.
Part 1 of 2
When to use it, and when not
Use it for
- Any tool-using agent.
- Multi-step workflows where each step depends on the previous result.
Part 2 of 2
Common mistakes
- Letting the loop run unbounded — set step + token + wall-clock caps.
- Skipping a planner — pure ReAct drifts on horizons past ~7 steps.
FAQ
Questions readers ask.
What is agent loop?
An agent loop is the repeating cycle of an AI agent — observe state, decide on an action (usually a tool call), execute, observe the result, and repeat — until a goal is reached or a stop condition fires.
When should you use agent loop?
Any tool-using agent. Multi-step workflows where each step depends on the previous result.
What are the common mistakes with agent loop?
Letting the loop run unbounded — set step + token + wall-clock caps. Skipping a planner — pure ReAct drifts on horizons past ~7 steps.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/agent-loop.md. Found a mistake? Tell us.