ReAct Prompting: Think, Act, Check, Repeat
What ReAct (reasoning and acting) is, how the Thought, Action, Observation loop works, when it beats chain of thought, and prompts to run it by hand or in code.

Ask a chatbot about something that changed last month and it either admits it doesn't know or quietly makes something up. Ask it to compare two products using specs it has never seen and it guesses. The weak point usually isn't the reasoning. It's that the model is reasoning with nothing but its memory.
ReAct prompting fixes that by letting the model alternate between thinking and doing: write a thought, take an action such as a search, read what comes back, then think again. It's the pattern behind most AI agents and tool-using assistants. This guide explains how the loop works, when it beats plain chain of thought, and gives you prompts to run it by hand in ChatGPT, Claude or Gemini, or to wire it into code.
What ReAct prompting is
ReAct, short for "reasoning and acting", was introduced in October 2022 by Shunyu Yao and colleagues at Princeton University and Google Research, and published at ICLR 2023. Before it, models were prompted either to reason (think step by step, then answer) or to act (issue commands to a tool or environment), rarely both. ReAct interleaves the two.
Each turn of the loop has three parts:
- Thought: the model reasons in plain language about what it knows, what's missing and what to do next.
- Action: it picks exactly one action from a fixed list, such as searching, looking up a term or finishing with an answer.
- Observation: the result of that action, written back into the conversation by a tool, a program or you.
Thoughts change nothing in the outside world; they update the model's plan. Actions do touch the world, and observations bring fresh information back. In the paper's words, reasoning helps the model "induce, track, and update action plans", while actions let it gather information from external sources.
The original experiments were deliberately simple. A frozen PaLM-540B model got a handful of worked examples and a basic Wikipedia API with three actions: search for a page, look up a phrase on that page, and finish with an answer. No fine-tuning, no special architecture. ReAct is a prompting pattern, which is why you can use it with any capable model today.
How the Thought, Action, Observation loop works
Here is a short trace in the style of the paper, for a question that needs two facts the model may not reliably remember. Observations are shortened.
Three things make this work. Each thought names what's missing, so the next action has a purpose. Each action is one small step in a fixed format, so a program (or a person) can carry it out without guessing. And the final answer rests on what was observed, not on what the model happened to remember.
The loop also gives the model a chance to recover. If the first search had returned the Eiffel Tower in Las Vegas, the next thought is where it can notice the mismatch and search again with a better query. A single chain of reasoning has no such checkpoint: once a wrong fact is in, every later step builds on it.
ReAct vs chain of thought vs acting alone
The paper compared ReAct with two simpler set-ups, and the contrast explains when to use each.
- Chain of thought: reasoning only. Strong on logic and maths, but every fact comes from the model's memory. The authors found it more prone to hallucinated facts and to errors that spread through later steps.
- Act only: actions and observations, no thoughts. The model searches, but it doesn't plan, combine results or notice when it's going round in circles.
- ReAct: both. Thoughts decide what to look up; observations correct the thoughts.
ReAct beat acting alone on all four benchmarks. On FEVER, a fact-checking task, it also beat chain of thought (60.9% vs 56.3% accuracy). On HotpotQA, a multi-step question-answering task, it trailed chain of thought slightly (27.4 vs 29.4 exact match), mainly because unhelpful search results threw it off. The best scores came from combining the two: use ReAct, and fall back to chain-of-thought prompting with self-consistency when ReAct can't reach an answer, or the other way round.
The decision-making results were more striking. In ALFWorld, a text-based game where an agent completes household tasks, ReAct with two examples succeeded 71% of the time, against 37% for an imitation-learning method trained on around 100,000 examples. On WebShop, a simulated online shop, it reached 40% against 29.1%.
When ReAct is worth using
Most prompts don't need a loop. ReAct earns its keep when a task has these features:
- The answer depends on information the model doesn't have: recent events, prices, your own documents, a live database.
- Lookups depend on each other: the second search only makes sense once you've seen the result of the first.
- There are tools to act with: web search, a calculator, code execution, a spreadsheet, an internal API.
- You need an audit trail: you want to see why each step was taken, not just the final answer.
It's the wrong tool for pure writing tasks, for questions the model handles well from memory and for single lookups. If one retrieval step reliably finds the right documents, plain retrieval-augmented generation (RAG) is simpler, faster and cheaper.
A ReAct prompt template you can copy
This template turns any chat model into a ReAct agent. Adjust the action list to the tools you actually have.
Three lines do most of the work. The action list can use any names you like, but the format must be fixed so each action is easy to run. "Never write an observation yourself" is the most important rule: without it, models happily invent their own search results, which is just chain of thought pretending to use tools. And the step limit stops the model looping forever on a question it can't answer.
For harder or more specialised tasks, add one or two complete worked traces before the task, like the Eiffel Tower example above. The paper used between one and six examples depending on the benchmark, which is ordinary few-shot prompting: the examples teach the format and the style of thought better than any instruction.
Running ReAct by hand in a chat
You don't need code to try it. Paste the template into a chat, and each time the model writes an action, run it yourself: do the search, open the document, check the spreadsheet. Then paste the result back:
It's slower than a normal chat, but it works with information the model can't reach, such as an intranet page or a PDF you can't share in full, and it shows you exactly where the model gets stuck. Suppose a customer asks whether a discontinued printer works with your new cartridges. The model asks to search the compatibility page, then to look up the printer's model number on it, then to check the returns policy. You decide what it sees at every step.
Assistants with built-in web search or file access already run a loop like this internally, but the steps are often hidden. You can bring the ReAct discipline back with a prompt:
The "before and after" lines are the thoughts; the searches are the actions. You get a readable trail, and the model is less likely to answer from the first result it finds.
ReAct in code and AI agents
The original implementation worked on plain text. The program let the model write until it reached "Observation:", read the action with a simple pattern match, ran it, appended the result and called the model again. Today most model APIs offer native tool calling (also called function calling): you describe each tool with a name and an argument schema, the model returns a structured tool call, your code runs it and sends the result back. The loop is the same; the parsing is far more robust. This loop is the core of most AI agents.
- Define a short list of tools with clear names, one-line descriptions and strict argument formats.
- Send the task with the tool definitions; the model replies with either a tool call or a final answer.
- Run the tool and return the result as the observation, then call the model again.
- Stop on a final answer, a step limit or a cost limit, whichever comes first.
If your model or platform has no tool calling, ask for each step as a small JSON object so your code can parse it reliably:
The JSON output prompt builder helps you write formats like this without loose ends. Whichever route you take, a few rules save a lot of pain: log every thought, action and observation; cut long observations down before they go back in, because a whole web page can fill the context window fast; check tool arguments before running them; and treat every observation as untrusted data. A web page or email can contain instructions aimed at the model, which is how prompt injection gets into agents.
Limits worth knowing
ReAct is a sound pattern, not a guarantee. Be clear about what it can't do.
- Bad observations derail it: the paper found that unhelpful search results were a major cause of failure, and the model often struggled to recover. The loop is only as good as its tools.
- It can get stuck in loops: repeating the same thought and action is a common failure. Step limits and a "try a different query" rule help, but don't remove it.
- Thoughts are not proof: the written reasoning is a useful trail, not a guaranteed record of why the model chose an action. Check the observations, not just the story.
- It costs time and tokens: every step is another model call, and observations pile up in the context. A five-step loop can take many times longer than a direct answer.
- Actions have consequences: searching is harmless; sending emails, editing files or spending money is not. Give agents the smallest set of permissions and ask for human confirmation on anything irreversible.
- The numbers are from 2022: one model, four benchmarks, before native tool calling and reasoning models. Modern models follow the loop far better, so test it on your own tasks rather than relying on the paper's figures.
Used where it fits, ReAct prompting turns "answer from memory" into "check, then answer". Start with the hand-run version on a question that needs two or three lookups and watch where the model goes wrong. If your problem is weighing options rather than finding facts, tree of thoughts prompting is the better fit.



