Skip to content
GenAI Learn/Giving LLMs Tools
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

The ReAct Pattern: Reason, Then Act

6 min read

You'll learn to

  • -Understand the reason-act-observe loop
  • -Trace a multi-step ReAct trajectory
  • -Explain why an agent needs an explicit stopping condition

A single tool call answers a single-step question. But "is Drug X more effective than Drug Y for condition Z, according to the latest three meta-analyses" needs multiple searches, reading several papers, and synthesizing across them. No single LLM call can do that in one shot. ReAct, short for Reasoning and Acting, is the pattern that turns a single tool-using model into something that can work through a genuinely multi-step problem.

The Loop: Thought, Action, Observation

Each iteration of a ReAct agent follows the same three-part cycle. Thought: the model reasons in plain language about what it currently knows and what it still needs. Action: the model calls a tool based on that reasoning. Observation: the tool's real result comes back and becomes part of the context for the next thought. This repeats until the model decides it has enough to answer.

You already saw one full trajectory in Tier 7, scheduling a meeting through two tool-call cycles. Here it is again, worth re-watching now that the pattern has a name: step through it and notice that every action is grounded in the observation right before it, not in the model simply guessing.

Tracing an Agent's Reason-Act-Observe Loop

Two full tool-call cycles before the agent has enough grounded information to answer.

User

"Schedule a meeting with Sarah next Tuesday at 2pm."

step 0 / 7

Why the Model Cannot Just Answer Directly

Without this loop, a model asked a multi-step question either refuses, or worse, confidently fabricates an answer that sounds like it did the research without actually doing any of it. ReAct forces the model to ground each step in a real tool result before moving to the next thought, which is exactly what makes the difference between "sounds plausible" and "is actually true," the same hallucination concern from Phase 1's bridge chapter, now addressed structurally rather than left to hope.

The Loop Must Know When to Stop

Without an explicit stopping condition, a ReAct agent can loop forever: thinking, failing, retrying, thinking again, burning tokens and money the entire time. The level 22 case brief is specific about this: cap the loop at a fixed number of iterations, commonly around eight for a research-style task, and give the model a concrete criterion for when it has enough, such as "stop once you have at least three sources supporting your conclusion."

What Each Piece of the Loop Buys You
Makes the model's reasoning inspectable, not just its final answer
Thought
Grounds the next step in a real tool call, not a guess
Action
Feeds real, verifiable information back into the next thought
Observation
A hard ceiling that prevents an infinite, runaway loop
max_iterations

Streaming the thoughts themselves, not just the final answer, matters more for agents than for plain chat. Watching an agent's reasoning unfold in real time is what lets a researcher catch a bad direction early, rather than waiting until the very end to discover the agent went down the wrong path three steps ago.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

Ready to Build This?

Build the Tool Smith and ReAct Loop levels in the GenAI Lab.

ScaleDojo Logo
Initializing ScaleDojo