ReAct Prompting
A prompting pattern that combines Reasoning and Acting — the AI thinks through the problem step by step, takes an action (like a search), observes the result, and repeats until the task is complete.
ReAct (Reasoning + Acting) is a prompting pattern where the AI alternates between thinking about what to do and actually doing it. Instead of reasoning in isolation and then acting, or acting without reasoning, the AI interleaves thought and action in a loop.
The pattern
- Thought: "I need to find the current price of X. Let me search for it."
- Action: Search for "current price of X"
- Observation: "The search returned £42.50 as of today."
- Thought: "Now I need to compare this to last month's price. Let me search for that."
- Action: Search for "price of X last month"
- Observation: "Last month it was £38.00."
- Thought: "That is a 12% increase. I can now answer the user's question."
- Final answer: "X has increased 12% from £38.00 to £42.50 over the past month."
Why it matters
ReAct is the foundation of how modern AI agents work. The agent loop (plan → act → observe → decide) described in agentic systems is essentially ReAct at scale. When Claude Code reads a file, runs a test, checks the result, and decides what to do next — that is ReAct in action.
When to use it
ReAct is most valuable when the AI needs external information to complete a task. Pure reasoning tasks (logic puzzles, creative writing) do not benefit. Tasks requiring real-world data, multi-step research, or verification of claims benefit significantly.
As a prompting technique
You can trigger ReAct-like behaviour even without tool access by prompting: "Think step by step. For each step, state what you would do, what information you would need, and what you would expect to find. Then proceed to the next step based on your reasoning."
Why This Matters
ReAct is the conceptual foundation of AI agents. Understanding this pattern helps you design agent workflows, debug agent behaviour, and understand why agents sometimes get stuck or take unexpected actions. It is the bridge between prompting (telling AI what to think) and agentic AI (letting AI decide what to do).
Related Terms
Continue learning in Advanced
This topic is covered in our lesson: Building Your First AI Agent from Scratch