ReAct
Why it matters
ReAct is the conceptual blueprint for nearly every LLM agent. When a coding agent reads a file, decides what to change, runs the tests and adjusts its plan, that's the ReAct loop. Frameworks like LangChain popularized it early, and today it's built into how models with native tool calling work.
The pattern also addressed two big weaknesses of plain prompting. Chain of thought alone can hallucinate facts, because the model has nothing to check against. Acting alone, without reasoning, tends to be aimless, because the model doesn't plan or reflect on what it learned. Combining them fixed much of both.
Deep Dive
ReAct comes from a 2022 paper by Shunyu Yao and colleagues at Princeton and Google. The idea is simple: instead of having a model either think (chain of thought) or act (call tools), let it do both in a loop. The model writes a thought ("I need to find out when this company was founded"), takes an action (search for it), receives an observation (the search result), and then thinks again with that new information. The loop repeats until the model decides it has the answer.
Thinking guides the actions, and the results of actions ground the thinking in real information.
The Original Format
The early version was pure prompting. The model was shown examples of text like:
Thought: I need to search for X.
Action: Search[X]
Observation: (result inserted by the program)
Thought: The result says ..., so next I should ...
The surrounding program parsed each Action line, ran the tool and pasted the result back in as an Observation. That's why it worked even with models that had no special tool support.
ReAct Today
Modern models handle this natively. Instead of free-text Action: lines, they emit structured function calls, and the API returns tool results in dedicated messages. Reasoning models often do their "thought" step in a hidden or separate reasoning channel. The format changed, but the loop is the same: reason, act, observe, repeat.
Strengths and Weaknesses
ReAct is flexible: the model decides step by step, so it adapts to surprises. That same flexibility makes it costly and sometimes unreliable. Every step is another model call, errors compound over long loops, and an agent can get stuck repeating the same action. Alternatives include plan-and-execute (make a full plan first, then run it), and workflows where code controls the steps and the model fills in specific parts.
Making ReAct Agents Work
- Give tools clear names, descriptions and compact outputs.
- Cap the number of iterations and the total cost.
- Return errors as useful observations ("file not found, did you mean ...?") so the model can recover.
- Log every thought, action and observation. When an agent goes wrong, the trace shows where.