Design Patterns: ReAct, Reflection, and Planning
Master the three foundational agent design patterns: ReAct for tool-augmented reasoning, Reflection for self-improvement, and Planning for complex task decomposition.
Premium Course Content
This lesson is part of a premium course. Upgrade to Pro to unlock all premium courses and content.
- Access all premium courses
- 1000+ AI skill templates included
- New content added weekly
You know the four components of an agent. Now let’s learn the three design patterns that define how agents use those components to solve problems.
🔄 Quick Recall: In the previous lesson, you learned the agent loop: perceive → plan → act → observe → repeat. Design patterns are specific implementations of this loop — each one emphasizes different aspects for different types of tasks.
Pattern 1: ReAct (Reason + Act)
ReAct is the foundational pattern for general-purpose agents. The agent explicitly alternates between reasoning (thinking about what to do) and acting (using tools).
How It Works
Thought: I need to find the population of Tokyo in 2025.
Action: web_search("Tokyo population 2025")
Observation: Tokyo's population is approximately 13.96 million (2025).
Thought: Now I have the data. The user also asked about
population growth rate. I should calculate the change
from the 2020 figure.
Action: web_search("Tokyo population 2020")
Observation: Tokyo's population was approximately 13.96 million (2020).
Thought: The population is essentially flat. I can now give
a complete answer about both the current figure and
the growth trend.
Action: respond("Tokyo's population in 2025 is approximately
13.96 million, essentially unchanged from 2020...")
Why Reasoning Matters
Without the explicit “Thought” step, agents make worse tool choices. Research shows that ReAct improves tool-use reliability because the reasoning step forces the LLM to articulate why it’s taking an action before taking it — reducing hallucinated tool calls and incorrect parameters.
When to Use ReAct
| Good Fit | Poor Fit |
|---|---|
| Research tasks (search, compare, synthesize) | Simple factual questions (no tools needed) |
| Multi-step data gathering | Tasks with no external tool requirement |
| Tasks requiring dynamic adaptation | Highly creative tasks (writing, brainstorming) |
✅ Quick Check: A ReAct agent is researching “best project management tools for remote teams.” After searching, it finds 10 results. Should the Thought step say “Let me read all 10 results” or should it reason about which results are most relevant first? (Answer: Reason first. A good Thought step would be: “I have 10 results. Results 1, 3, and 7 are comparison articles from reputable tech sites. Results 2 and 5 are vendor pages that will be biased. I’ll read the comparison articles first.” Selective reasoning produces better results than exhaustive processing.)
Pattern 2: Reflection
Reflection adds a self-critique layer. The agent generates an output, then switches into “critic mode” to evaluate its own work.
How It Works
Step 1: Generate
"Here's the quarterly report summary..."
Step 2: Reflect
"Checking my work:
✗ I cited revenue as $12M but the data says $12.3M
✗ I missed the customer churn metric entirely
✓ Format follows the requested template
✓ Tone is appropriate for executive audience"
Step 3: Revise
"Here's the corrected summary with accurate revenue
($12.3M) and the missing churn metric (2.1%)..."
Step 4: Reflect Again (if needed)
"All issues addressed. Revenue matches source data.
Churn metric included. Ready for delivery."
The Reflection Prompt
The quality of reflection depends on the critique prompt:
<reflect>
Review your previous output against these criteria:
1. Factual accuracy: Do all numbers match the source data?
2. Completeness: Are all requested metrics covered?
3. Format: Does it match the specified template?
4. Tone: Is it appropriate for the audience?
For each criterion, mark ✓ or ✗ and explain.
If any ✗, provide specific corrections.
</reflect>
When to Use Reflection
- High-stakes writing — Reports, proposals, customer communications
- Code generation — Catch bugs before they ship
- Analysis — Verify conclusions against data
- NOT for simple tasks — Adding reflection to “What time is it?” is wasteful
Pattern 3: Planning
Planning agents create a structured roadmap before executing. Instead of jumping straight into action, they decompose the task first.
How It Works
User: "Create a competitive analysis of our top 3 competitors"
Planning Phase:
1. Identify the top 3 competitors (check company context)
2. For each competitor:
a. Research recent product launches
b. Gather pricing information
c. Find customer reviews and sentiment
3. Create comparison matrix
4. Identify our competitive advantages and gaps
5. Write executive summary with recommendations
Dependencies:
- Step 2 depends on Step 1 (need competitor list first)
- Step 3 depends on Step 2 (need data to compare)
- Steps 4-5 depend on Step 3
Execution: Begin with Step 1...
Static vs. Dynamic Planning
Static planning creates the full plan upfront and follows it rigidly. Works for well-understood tasks.
Dynamic planning (also called adaptive planning) revises the plan based on what the agent discovers during execution. Essential for open-ended tasks where you can’t predict what you’ll find.
Most production agents use dynamic planning — the real world is too unpredictable for rigid plans.
✅ Quick Check: An agent plans to analyze a CSV file in 5 steps. At step 2 (read the file), it discovers the file is actually a JSON file with nested data. What should a dynamic planning agent do? (Answer: Replan from step 2 onward. The remaining steps assumed CSV structure — column names, row-based analysis. With nested JSON, the agent needs different parsing, potentially different analysis approaches, and possibly different tools. Steps 1 (understand the request) and the final step (present results) likely stay the same, but the middle steps need complete revision.)
Combining Patterns
The real power comes from combining patterns:
ReAct + Reflection
The agent uses ReAct for tool-augmented research, then Reflection to verify the quality of its findings before delivering:
[ReAct Phase] Search → Read → Synthesize
[Reflection Phase] Check accuracy → Check completeness → Revise
[Deliver] Send verified result
Planning + ReAct
The agent first creates a plan, then executes each step using ReAct:
[Planning Phase] Decompose task into 5 steps
[ReAct Phase] Execute Step 1 with Thought → Action → Observation
[ReAct Phase] Execute Step 2...
[Replan if needed] Adjust remaining steps based on discoveries
All Three Together
For complex, high-stakes tasks:
[Planning] Create roadmap
[ReAct] Execute each step with tool-augmented reasoning
[Reflection] Review output quality at checkpoints
[Replan] Adjust based on reflection feedback
Practice Exercise
- Take a complex task from your work (writing a report, analyzing data, planning a project)
- Map it to one of the three patterns: Which pattern fits best? Why?
- Write the agent’s first three Thought → Action → Observation steps (ReAct), or the critique checklist (Reflection), or the step-by-step plan (Planning)
Key Takeaways
- ReAct interleaves reasoning with action — the explicit Thought step improves tool selection and makes agents debuggable
- Reflection adds self-critique to catch errors — use it for high-stakes tasks where quality justifies the extra processing cost
- Planning decomposes complex tasks before execution — dynamic planning adapts the roadmap as the agent learns more
- Combine patterns for maximum power: Planning sets the roadmap, ReAct executes each step, Reflection verifies quality
- Choose based on the task: ReAct for research and dynamic tasks, Reflection for quality-critical output, Planning for complex multi-step projects
Up Next
In the next lesson, you’ll learn how tool use actually works — from function calling and MCP to structured outputs and the protocols that connect agents to the real world.
Knowledge Check
Complete the quiz above first
Lesson completed!