Architecturecontrol loopagentic loop

What Is an Agent Loop?

An agent loop is the recurring cycle of perceive → reason → act → observe that lets an AI agent pursue multi-step goals instead of single-turn responses.

2 min readUpdated agent-loop.md

An agent loop (also called a control loop or agentic loop) is the recurring cycle that lets an AI agent pursue goals across multiple steps:

  1. Perceive — Receive input (user message, tool result, environment state)
  2. Reason — Decide what to do next given the goal and current context
  3. Act — Execute a tool call, send a message, or update state
  4. Observe — Read the outcome of the action
  5. Repeat — Reassess whether the goal is met or another step is needed

This loop is what separates an agent from a chatbot. A chatbot completes one turn. An agent runs the loop until the task is done, an error requires escalation, or a safety limit is hit.

Common loop patterns

  • ReAct (Reason + Act) — The model alternates between reasoning traces and tool calls. Widely used and easy to debug.
  • Plan-and-execute — The model first generates a full plan, then executes steps sequentially. Better for long, structured tasks.
  • Reflection — After acting, the model critiques its own output and may retry. Useful for quality-sensitive work.

Loop safety

Production agents need guardrails on the loop itself: maximum iteration counts, timeout limits, cost caps, and human-in-the-loop checkpoints for high-stakes actions. Without these, a confused agent can loop indefinitely.

Loop Engineering covers how to design loops that are reliable in production, not just in demos.