Reasoning and Acting (ReAct)
- Reasoning
- Research term
Reasoning and Acting, or ReAct, runs an AI agent in a loop in which it reasons in writing about the next step, takes one tool action, reads the result, and repeats until the job is done.
The model keeps no memory from one request to the next, so each pass sends it the whole record so far, with its earlier reasoning, the actions it took, and what came back. Because a surprise lands in that record, the plan can change on the spot, and the record grows longer with every pass.
Where you’ll meet it
Your coding agent is fixing a failing test, one of the automatic checks on your project's code. It runs the test, reads the error, edits a file, and runs the test again. Six rounds later it is still editing the same line, and the error message hasn't changed.
What to do
Interrupt the agent and open its tool log, the record of each command and its result. The same error after several edits points to a wrong guess about the cause. Ask the agent to explain its guess before it edits again, and point it to any clue in the log it passed over.
Easy to mix up
A planner-executor architecture commits to a full list of steps before the first one. ReAct commits one action at a time, choosing each from the results so far.
Check yourself
Which job gains more from a loop that reads each result before choosing the next step?
Go deeperReAct started in research and is now one agent design among several
Shunyu Yao and colleagues introduced ReAct in a 2022 paper, published at ICLR 2023. In their examples, the thoughts split a task into goals, planned several steps ahead, and tracked progress. On question answering and fact checking, mixing thoughts with searches helped the model recover from bad searches and invent fewer facts than reasoning alone. Products built on the loop often keep the thoughts private and show only the actions and results.
Every step sends another request to the model, so the loop takes more time and money than a fixed sequence and needs a stopping rule, such as a cap on steps. Some systems cut the number of requests by having the model write a short program that carries out many tool actions at once.
Sources