Last chapter's tool call happened once: ask, call, get an exact answer back. What happens when the first thing a model believes is wrong — not about arithmetic, but about a fact needed to even know which tool to call next?
Thought 1 I think Eiffel Tower is in Germany, so I need Germany's capital.
Action 1 look_up_location("Eiffel Tower")
Observation 1 France
Thought 2 Eiffel Tower is actually in France, not Germany. I need France's capital instead.
Action 2 look_up_capital("France")
Observation 2 Paris
Final answer: Paris
Switch landmarks. Every trace starts with a wrong guess about the country — Thought 1 is never corrected until Action 1 actually runs and Observation 1 comes back. Thought 2 only exists because Observation 1 contradicted Thought 1.
ReAct — short for Reasoning and Acting — interleaves reasoning and acting in an explicit loop instead of answering in one shot:
- — the model's reasoning at step , conditioned on every observation before it.
- — the tool call or action the model takes at step .
- — the result that comes back from taking .
- — the index of the current step in the loop.
- Final Answer — the answer given once the loop stops.
- Each thought conditions on every prior observation
That's the entire mechanism: sees everything the loop has observed so far, not just the request it started from.
- A wrong initial belief isn't fatal
The loop doesn't commit to an answer until an action has actually been taken and its result folded back in, so an early wrong thought still has a chance to be corrected before the final answer.
- Plain prompting has no way to self-correct
Compare this to Part XIII's plain prompting: no action step exists there at all, so a wrong initial belief has no way to get corrected before the answer is given.
Eiffel Tower: naive guess “Berlin” → corrected to “Paris” after observing Eiffel Tower is actually in France
Colosseum: naive guess “Athens” → corrected to “Rome” after observing Colosseum is actually in Italy
Statue of Liberty: naive guess “Paris” → corrected to “Washington, D.C.” after observing Statue of Liberty is actually in USA
Three landmarks, three plausible-sounding wrong guesses, three genuine corrections. None of the naive guesses were random — each one is the kind of association a model would plausibly make from training data (the Statue of Liberty was a gift from France) — which is exactly why the action-observation step matters: a plausible wrong belief is exactly the kind a model won't second-guess on its own.
The full loop for "Eiffel Tower's capital":
- Thought 1 (wrong)
"I think Eiffel Tower is in Germany, so I need Germany's capital." A plausible-sounding guess, not a random one — and wrong.
- Action 1 → Observation 1
look_up_location("Eiffel Tower")returns "France" — directly contradicting Thought 1. - Thought 2 → Action 2 → Final Answer
"Eiffel Tower is actually in France, not Germany. I need France's capital instead."
look_up_capital("France")returns "Paris" — the final answer, reached only because the loop didn't stop after the first (wrong) thought.
Find the landmark, among the three, whose loop ends with the final answer Rome.
This chapter's loop always ran exactly two hops and always corrected exactly one wrong belief — real ReAct agents run until a stopping condition is met (the model itself decides it has enough information, or a max-step budget is hit), and a single loop can correct several wrong beliefs in sequence, or none at all if the first thought was already right. The next chapter asks a different question: before ever taking a single action, can a model break one large, ambiguous goal into an ordered list of small, unambiguous steps?