concept

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.

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.

When to use agent loop

Common mistakes

FAQ

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 I use agent loop?

Any tool-using agent. Multi-step workflows where each step depends on the previous result.

What are the most 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.