Prompt Engineering Course
ReAct Prompting Framework (Reason + Act)
ReAct prompting is a framework that combines reasoning with actions.
Instead of treating the model as a passive text generator, ReAct treats it as an intelligent agent that can think, decide, and take steps.
This framework is foundational for modern AI agents, tool-using systems, and autonomous workflows.
The Problem ReAct Solves
Traditional prompts ask the model to respond in a single step.
This works for simple tasks but breaks down when:
- Multiple decisions are required
- External tools must be used
- Intermediate results affect next steps
ReAct fixes this by separating thinking from acting.
What ReAct Actually Means
ReAct stands for:
- Reason – Think about what to do next
- Act – Take an action based on that reasoning
These steps repeat until the task is complete.
How Humans Solve Problems (Mental Model)
Humans do not jump directly to answers.
We think, act, observe results, then think again.
ReAct mirrors this natural workflow.
Basic ReAct Structure
A ReAct-style response usually follows this pattern:
Thought: What should I do next?
Action: Take a specific step
Observation: What happened?
Thought: Decide next step
Each section has a purpose.
The model reasons before acting, instead of guessing.
Simple ReAct Prompt Example
Let’s say you want the model to answer a question using external knowledge.
You are an assistant that reasons step by step.
Use the following format:
Thought:
Action:
Observation:
Final Answer:
Question: What is the capital of the country with the largest population?
Here, you are explicitly instructing the model how to think and act.
What Happens Inside the Model
The model does not magically know the answer.
Instead, it:
- Reasons about what information is missing
- Decides to retrieve or infer data
- Uses observations to refine reasoning
This dramatically improves reliability.
ReAct With Tools (Real-World Usage)
In production systems, actions often mean:
- Calling APIs
- Querying databases
- Running code
ReAct becomes the control loop for agents.
Example: Tool-Based ReAct Prompt
Imagine a system where the model can search documentation.
Thought: I need recent information.
Action: Search documentation for latest version.
Observation: Found version 3.2 released last month.
Thought: Use this info to answer.
Final Answer: The latest version is 3.2.
This pattern is used by most AI agent frameworks today.
Why ReAct Is Better Than Plain Reasoning
Plain reasoning stops at thinking.
ReAct connects thinking with execution.
This makes it suitable for:
- Automation
- Decision systems
- Multi-step workflows
Common Mistakes When Using ReAct
Beginners often:
- Skip clear action definitions
- Allow vague observations
- Mix reasoning and output
Clear separation is essential.
Best Practices
When writing ReAct prompts:
- Explicitly label Thought, Action, Observation
- Keep each step short and focused
- Limit allowed actions
This prevents uncontrolled behavior.
How You Should Practice ReAct
Start with simple tasks:
- Information retrieval
- Decision trees
- Multi-step explanations
Then move to tool-integrated workflows.
Practice
What does the “Reason” step represent in ReAct?
What does the “Act” step typically involve?
What is the role of the Observation step?
Quick Quiz
ReAct is most useful for building:
ReAct works as a:
In real systems, ReAct actions often involve:
Recap: ReAct combines reasoning with actions, enabling multi-step, tool-aware AI systems.
Next up: Multi-step reasoning and orchestrating complex prompt flows.