ReAct (Reasoning + Acting)
ReAct is an agent loop that interleaves reasoning with tool actions — Thought, Action, Observation, repeat — so the model plans, calls a tool, and revises.
ReAct (Reasoning + Acting) is an agent pattern that interleaves reasoning traces with tool actions and their observations — Thought, Action, Observation, then repeat — so the model plans a step, calls a tool, reads the result, and revises before acting again.
Each cycle, the model writes a short reasoning trace (the "Thought"), chooses an action — typically a tool call via function calling — and then receives an Observation: the tool's actual output. That observation feeds the next Thought, so the loop grounds reasoning in real results instead of guessing the whole plan in advance. It is essentially chain-of-thought extended with the ability to act in the world and learn from what happens.
This is the canonical loop behind most tool-using AI agents. Its strength is robustness under uncertainty — the model recovers from surprising tool output, failed calls, or missing data because it observes before committing. The caveat is that each cycle costs a full model call, loops can wander or repeat themselves without step limits and clear stopping conditions, and a wrong observation early can mislead the entire trajectory.
Frequently asked questions
- Is this related to React.js?
- No — despite the name, ReAct here stands for Reasoning + Acting and has nothing to do with the React JavaScript UI library. It's a prompting pattern for agents: the model alternates between thinking and taking actions in the world (calling tools, searching, running code).
- Why interleave reasoning with actions instead of planning everything upfront?
- Because real tasks are uncertain — a search returns something unexpected, a tool errors, a file isn't where you assumed. ReAct lets the model observe the result of each action and revise its next step, rather than committing to a brittle plan made before it had any information. That feedback loop is what makes tool-using agents robust.
Related
- AI AgentAn AI agent is an LLM-driven system that pursues a goal in a loop — calling tools, observing results, iterating — instead of returning one answer.
- Function Calling (Tool Calling)Function calling lets an LLM request structured invocations of your code: describe tools with schemas, the model emits typed calls, your app executes them.
- Chain-of-Thought (CoT)Chain-of-thought prompting has a model work through intermediate reasoning steps before answering — improving accuracy on multi-step problems.