The Core Agent Loop

Strip away the frameworks, the tooling, and the jargon, and every LLM agent reduces to one simple loop: think about what to do, do it, look at what happened, repeat. This reason-act-observe cycle — crystallized by the ReAct pattern — is the beating heart of every agent, and understanding it deeply is understanding agents themselves. Once you see the loop clearly, agent frameworks stop being mysterious: they're all just implementations of this same fundamental cycle.

The previous post defined an agent as an LLM deciding actions in a loop. This post is about that loop — the fundamental reason-act-observe cycle at the core of every agent, best known as the ReAct pattern. It covers what the loop is, how ReAct works, why interleaving reasoning and acting is powerful, and how the loop terminates. This is the single most important pattern in agent design, because every agent is built on it.

The fundamental loop

Every agent operates on the same fundamental loop: the LLM repeatedly decides what to do, does it, and observes the result, until the goal is reached. Broken down:

   The core agent loop:
     1. REASON  — the LLM thinks about the situation and decides the next action
     2. ACT     — it takes that action (usually calls a tool)
     3. OBSERVE — it sees the result of the action
     4. repeat  — back to reason, now knowing the result
     ... until the goal is achieved (or a stop condition)

This reason-act-observe loop, repeated until done, is the fundamental mechanism of every agent — the engine that turns a deciding LLM into a system that accomplishes multi-step goals. Every agent, in every framework, is built on this loop. The canonical formulation of it is ReAct.

ReAct: reasoning and acting interleaved

ReAct (Reasoning + Acting) is the influential pattern that formalized the core loop: the LLM interleaves explicit reasoning (thinking) with acting (taking actions), in a loop. It’s the archetypal agent pattern:

ReAct formalizes the core loop as interleaved reasoning and acting: the model thinks, acts (via tools), observes, and thinks again — with reasoning guiding action and results grounding reasoning. This reasoning-acting synergy is the archetypal agent pattern and the standard formulation of the agent loop. Understanding ReAct is understanding how agents fundamentally work.

Why the loop is powerful

The reason-act-observe loop is what gives agents their power over single LLM calls — worth making explicit:

The core loop is powerful because it enables multi-step tasks, grounds the agent in observed reality (real results, not assumptions), makes it adaptive (deciding each step based on the actual situation), and integrates all the other components. It’s the mechanism behind agents’ ability to accomplish complex, open-ended goals. But a loop needs to know when to stop.

Termination: knowing when to stop

A practical but crucial aspect of the loop is termination — how and when it stops, which is both important and a common source of problems:

The core agent loop — reason, act, observe, repeat — formalized as ReAct (interleaved reasoning and acting), is the fundamental mechanism of every agent: it enables multi-step tasks, grounds the agent in observed reality, and makes it adaptive, integrating all the other components, and it must terminate well (the agent deciding it’s done, with safeguards against runaway loops). Understanding this loop is understanding agents. Next: tool use — how agents actually act on the world.

Key takeaways

Further reading

Sources & References