AI Agent Planning and Reasoning Part 2: ReAct, Reflection, Self-Correction and Advanced Planning
In Part 1, we explored the fundamentals of AI agent planning and reasoning.
We discussed how AI agents define goals, break complex tasks into smaller steps, work with constraints, use tools, and choose between different planning strategies.
But real-world tasks are rarely predictable from beginning to end.
A tool may fail.
New information may appear.
A user may change their requirements.
A plan that looked correct at the beginning may no longer work later.
This is why advanced AI agents need more than a fixed plan.
They need the ability to act, observe results, reflect on what happened, revise their approach, and continue toward the goal.
In this part, we will explore ReAct, task decomposition, plan-and-execute architectures, reflection, self-correction, failed-plan recovery, changing conditions, real-world applications, limitations, safety, and common questions about AI agent planning.
Quick Answer: How Do Advanced AI Agents Plan and Adapt?
Advanced AI agents often combine planning, reasoning, tool use, memory, observation, and feedback.
Instead of creating one fixed plan and blindly following it, the agent may:
Define a goal
Create a plan
Take an action
Observe the result
Evaluate whether the action worked
Update the plan if needed
Continue until the goal is reached
This makes the agent more flexible and useful in changing environments.
What Is ReAct in AI Agents?
ReAct stands for Reasoning and Acting.
It is an agent pattern that combines internal reasoning with external actions.
Instead of only thinking about a problem or only using tools, the agent alternates between deciding what to do and performing actions.
A simplified ReAct loop looks like this:
Reason → Act → Observe → Reason Again
For example, suppose an AI travel agent needs to find an affordable hotel.
The process may look like:
Reason:
The user wants a hotel under $150 near public transport.
Action:
Use a hotel search tool.
Observation:
Most nearby hotels cost more than $150.
Reason:
The budget is too low for the preferred area.
Action:
Expand the search radius.
Observation:
Several hotels now fit the budget.
The agent continues until it finds a suitable answer.
Why ReAct Is Useful
ReAct is useful because many tasks depend on information that is not known in advance.
An agent may need to:
Search the web
Query a database
Use an API
Run code
Check a calendar
Read a document
Compare live prices
The result of one action influences the next decision.
This makes a reasoning-and-action loop more flexible than a completely fixed plan.
ReAct vs Traditional Planning
Traditional planning may create a full sequence before execution.
ReAct usually decides and acts more dynamically.
| Feature | Traditional Planning | ReAct |
|---|---|---|
| Plan Created | Mostly before execution | Step by step |
| Uses Observations | Sometimes | Frequently |
| Flexibility | Moderate | High |
| Best For | Predictable tasks | Dynamic tasks |
| Tool Use | Planned in advance | Chosen during the loop |
In practice, advanced systems may combine both approaches.
An agent may begin with a high-level plan and use ReAct inside each step.
Example of ReAct in a Shopping Agent
Suppose the user says:
Find me the best gaming laptop under $1,300.
The agent may proceed like this:
Reason:
Gaming performance depends strongly on GPU, CPU, RAM, cooling, and price.
Action:
Search available gaming laptops under $1,300.
Observation:
Five suitable models are found.
Reason:
Two have stronger GPUs but less RAM.
Action:
Compare benchmark data and specifications.
Observation:
One model has the best overall value.
Reason:
It offers the strongest gaming performance while staying within budget.
Final Answer:
Recommend the best option and explain why.
This shows how reasoning and actions can work together.
What Is Task Decomposition?
Task decomposition is the process of dividing a large task into smaller subtasks.
This concept appeared in Part 1, but advanced agents often use it dynamically.
For example:
Create a complete product launch strategy.
The agent may divide this into:
Market research
Competitor analysis
Audience definition
Positioning
Pricing
Marketing channels
Content plan
Launch schedule
Performance tracking
Each major step may then be broken into additional substeps.
What Are Subgoals?
Subgoals are smaller objectives that support a larger goal.
For example:
Main Goal:
Launch a successful ecommerce store.
Possible subgoals:
Choose a profitable niche
Source products
Build a website
Set up payments
Create product pages
Develop a marketing strategy
Launch advertising
Subgoals help an agent track progress more clearly.
They also make it easier to recover when one part fails.
Hierarchical Task Decomposition
Complex goals may contain several levels.
For example:
Main Goal: Launch an online course
Subgoal 1: Build the course
Define learning outcomes
Create lessons
Record videos
Prepare exercises
Subgoal 2: Create the website
Create landing page
Add checkout
Upload course material
Subgoal 3: Market the course
Create social posts
Write emails
Run ads
This hierarchy helps the agent manage large projects.
Why Subgoals Matter
Subgoals provide several advantages.
Better Progress Tracking
The agent can see which parts are complete.
Easier Recovery
If one subgoal fails, the rest of the project may continue.
Better Tool Selection
Different subgoals may require different tools.
Lower Complexity
Large tasks become easier to manage.
Clearer Evaluation
Each subgoal can be checked separately.
What Is Plan-and-Execute Architecture?
Plan-and-execute is an AI agent architecture where one stage creates a plan and another stage executes it.
The workflow may look like:
User Goal → Planner → Task List → Executor → Results → Final Output
The planner determines what should happen.
The executor carries out each step.
For example:
Goal: Research three competitors and prepare a report.
Planner
Identify competitors
Visit company websites
Collect pricing information
Compare features
Analyze positioning
Create report
Executor
The executor then completes each task.
Why Separate Planning and Execution?
Separating planning from execution can make agent behavior more structured.
The planner can focus on:
Goal interpretation
Task sequencing
Constraints
Dependencies
The executor can focus on:
Tool use
Data collection
Actions
Output generation
This separation can be useful for larger tasks.
Plan-and-Execute vs ReAct
These approaches are related but different.
| Feature | Plan-and-Execute | ReAct |
|---|---|---|
| Planning | More explicit | More dynamic |
| Execution | Follows a task list | Chosen step by step |
| Flexibility | Moderate | High |
| Good For | Large structured tasks | Interactive dynamic tasks |
| Replanning | May happen after failure | Often happens continuously |
A sophisticated agent may combine both.
It can create a high-level plan first and then use ReAct during execution.
What Is Reflection in AI Agents?
Reflection is the process of reviewing previous actions or outputs to identify possible mistakes and improve the next step.
An agent may ask questions such as:
Did this action help?
Did I satisfy the user's goal?
Did I miss an important requirement?
Is the result reliable?
Should I change the plan?
Reflection can happen after:
One action
Several steps
A failed tool call
A draft response
The completion of an entire task
Example of Reflection
Suppose an AI agent creates a marketing plan with a $5,000 advertising budget.
The user originally said:
My maximum budget is $2,000.
A reflection step may detect:
The current plan exceeds the user's budget.
The agent can then revise the plan.
Without reflection, the agent might return an answer that violates the original constraint.
What Is Self-Correction in AI Agents?
Self-correction means revising an action, plan, or output after detecting a problem.
For example:
Initial Answer:
Recommend Product A.
Review:
Product A is actually above the user's maximum budget.
Correction:
Remove Product A and recommend Product B instead.
Self-correction can improve reliability, but it does not guarantee correctness.
An AI system can still fail to identify its own mistakes.
Reflection vs Self-Correction
These terms are closely related.
Reflection means reviewing and evaluating what happened.
Self-correction means changing the output or action based on that evaluation.
A simple flow is:
Action → Reflection → Problem Detected → Correction
What Is Replanning?
Replanning happens when an agent changes its original plan.
This may be necessary when:
A tool fails
New information appears
A constraint changes
A task becomes impossible
A better option is discovered
Example:
Original Plan:
Book Flight A and Hotel A.
New Information:
Flight A is sold out.
Replanned Approach:
Search alternative flights and adjust hotel check-in time.
This is important for real-world agent systems.
Handling Failed Plans
Plans fail for many reasons.
An agent should ideally detect failure instead of repeating the same action indefinitely.
Possible failure-handling strategies include:
Retry
Try the same action again if the problem appears temporary.
Use an Alternative Tool
If one search source fails, try another.
Change the Plan
Select a different strategy.
Ask the User
If critical information is missing, request clarification.
Stop Safely
If the task cannot be completed reliably, explain the limitation.
Example of Failed-Plan Recovery
Suppose an AI agent is asked:
Find a direct flight under $400.
The agent searches and finds no matches.
A poor agent may simply fail.
A better agent may:
Search again with nearby airports
Check flexible travel dates
Look for slightly higher prices
Explain that no direct flight under $400 is available
This is a more useful recovery strategy.
Handling Changing Conditions
Many real-world environments change.
Examples include:
Prices
Weather
Availability
Traffic
Inventory
Market conditions
User preferences
An AI agent should not assume that earlier information remains valid forever.
For example, a shopping agent may initially find a product for $99.
Ten minutes later, the product may be sold out.
The agent may need to:
Detect the change
Search alternatives
Update the recommendation
This is dynamic planning.
Planning Under Uncertainty
Sometimes the agent does not have complete information.
It may need to make a decision based on probabilities or incomplete evidence.
For example:
Recommend the best restaurant for tonight.
The agent may not know:
Exact waiting time
Future availability
Last-minute menu changes
In this case, the agent should distinguish between confirmed information and uncertain assumptions.
Good planning systems should avoid presenting guesses as facts.
Planning With Feedback
Feedback can come from:
Tool results
User responses
Environment changes
Validation systems
Another AI model
External rules
The agent can use this feedback to update its plan.
A feedback loop may look like:
Plan → Act → Observe → Evaluate → Update → Act Again
This is one of the most important patterns in advanced AI agent design.
Real-World Application: Travel Agent
An AI travel agent may:
Retrieve travel preferences
Create a trip plan
Search flights
Search hotels
Compare total cost
Check transportation
Build an itinerary
Update the plan when availability changes
This task combines:
Memory
Planning
Reasoning
Tool use
Replanning
Constraint management
Real-World Application: Customer Support Agent
A customer-support agent may:
Identify the issue
Retrieve customer history
Search the support knowledge base
Attempt troubleshooting
Check whether the issue is resolved
Escalate if necessary
If the first solution fails, the agent should not repeat it endlessly.
It may need to select another troubleshooting path.
Real-World Application: Research Agent
A research agent may:
Define research questions
Search reliable sources
Collect evidence
Compare conflicting information
Identify missing information
Search again
Create a balanced summary
Cite sources
Reflection can help the agent notice weak evidence or unsupported claims.
Real-World Application: Coding Agent
A coding agent may:
Inspect the project
Identify relevant files
Create a plan
Modify code
Run tests
Inspect errors
Fix issues
Test again
This is a good example of iterative planning.
The agent does not simply write code once and stop.
It observes results and adapts.
Real-World Application: Business Automation
Business agents can manage workflows such as:
Invoice processing
Lead qualification
Meeting scheduling
Customer follow-up
Report generation
Inventory management
These workflows often include dependencies.
For example:
Verify invoice → Check approval → Process payment → Update records
Planning helps maintain the correct order.
Benefits of Advanced AI Agent Planning
Advanced planning can improve agents in several ways.
Better Flexibility
Agents can adapt when conditions change.
Better Error Recovery
They can revise failed plans.
More Reliable Tool Use
Actions can depend on previous results.
Better Task Completion
Complex goals can be managed through subgoals.
Improved Efficiency
Agents can avoid repeating unnecessary actions.
Better User Experience
The system can respond more intelligently to new information.
Limitations of AI Agent Planning
Planning systems still have important limitations.
Poor Initial Plans
If the first plan is weak, execution may also be weak.
Incorrect Assumptions
The agent may misunderstand the user's goal.
Hallucinated Steps
The agent may invent actions or capabilities that are not actually available.
Tool Errors
External tools may fail or return incorrect information.
Endless Loops
An agent may repeatedly retry failed actions.
High Cost
Complex planning, reflection, and tool use may require more model calls and computation.
Slow Performance
More planning steps can increase response time.
Overplanning
The agent may create unnecessary steps for simple tasks.
Difficulty Measuring Success
Some goals are subjective.
For example:
Write the best marketing campaign.
There may not be one objectively correct answer.
Safety in AI Agent Planning
Planning becomes more important when AI agents can take real-world actions.
An agent that can:
Send emails
Make purchases
Edit files
Execute code
Control software
Access private data
needs strong safety controls.
Permission Boundaries
Agents should only perform actions they are authorized to perform.
For example, an agent should not make a purchase without appropriate user permission.
Human Approval
High-impact actions may require human confirmation.
Examples include:
Large financial transactions
Deleting important data
Sending sensitive messages
Publishing public content
Changing account settings
Tool Restrictions
Agents should have access only to the tools they need.
This reduces risk.
Verification Before Action
An agent should verify critical details before executing irreversible actions.
For example:
Before sending an email, confirm:
Recipient
Message
Attachments
Intent
Avoiding Unsafe Replanning
An agent should not bypass safety rules simply because the original plan failed.
For example, if one restricted action is blocked, the agent should not search for an unsafe workaround.
Safety constraints should remain active throughout the entire planning process.
Human-in-the-Loop Planning
Human-in-the-loop means a person remains involved in important decisions.
The agent may:
Create a plan
Present it to the user
Wait for approval
Execute approved steps
This can be useful when actions have significant consequences.
Autonomous vs Human-Supervised Agents
| Feature | Autonomous Agent | Human-Supervised Agent |
|---|---|---|
| Makes Decisions | Mostly independently | With human review |
| Speed | Faster | Slower |
| Human Control | Lower | Higher |
| Best For | Low-risk repetitive tasks | High-impact tasks |
| Approval Needed | Less often | More often |
The right approach depends on the use case.
How Memory Improves Replanning
Memory helps an agent remember:
Previous failures
Completed steps
User preferences
Successful strategies
Tool outputs
For example, if a particular API failed earlier, the agent may avoid immediately repeating the same call.
This reduces unnecessary work.
How Evaluation Improves Planning
Evaluation checks whether the agent's output or actions meet the goal.
Possible evaluation criteria include:
Accuracy
Relevance
Cost
Speed
User satisfaction
Rule compliance
Task completion
For example:
Goal: Find a hotel under $120.
Evaluation:
Recommended hotel costs $145.
Result:
Goal not satisfied.
The agent should continue searching or explain the limitation.
Planning and Reasoning Workflow
A complete advanced workflow may look like this:
1. User provides a goal
↓
2. Agent retrieves relevant memory
↓
3. Agent identifies constraints
↓
4. Agent creates a plan
↓
5. Agent selects an action
↓
6. Tool executes the action
↓
7. Agent observes the result
↓
8. Agent evaluates progress
↓
9. Agent reflects
↓
10. Agent updates the plan if needed
↓
11. Agent continues
↓
12. Agent checks whether the goal is satisfied
↓
13. Final response or action
This loop may happen multiple times during one task.
Frequently Asked Questions
What is AI agent planning?
AI agent planning is the process of deciding which steps or actions should be taken to achieve a goal.
The plan may be created in advance or updated during execution.
What is reasoning in AI agents?
Reasoning refers to evaluating information, constraints, alternatives, and results in order to decide what action or answer is appropriate.
What is ReAct in AI agents?
ReAct is a pattern that combines reasoning and acting.
The agent alternates between deciding what to do, performing an action, observing the result, and reasoning again.
What is task decomposition?
Task decomposition means breaking a complex goal into smaller subtasks.
This makes large problems easier to manage.
What is a subgoal?
A subgoal is a smaller objective that contributes to a larger goal.
For example, researching competitors may be one subgoal within a larger business strategy project.
What is plan-and-execute architecture?
Plan-and-execute separates planning from execution.
A planner creates tasks, and an executor carries them out.
What is reflection in AI agents?
Reflection is the process of reviewing previous actions or outputs to identify possible mistakes or improvements.
What is self-correction in AI?
Self-correction happens when an AI system changes an answer, plan, or action after identifying a problem.
Can AI agents change their plans?
Yes.
Dynamic agents can update plans when new information appears, tools fail, or conditions change.
What happens when an AI agent's plan fails?
The agent may retry, use another tool, create a new plan, ask the user for information, or stop and explain the limitation.
Are AI agents fully autonomous?
Some agents can operate with high autonomy, while others require human approval for important actions.
The appropriate level depends on the task and risk.
Is AI planning always accurate?
No.
AI agents can create poor plans, misunderstand goals, use incorrect information, or make reasoning errors.
Verification is still important.
Can AI agents reason like humans?
Not exactly.
AI systems can produce structured reasoning-like behavior, but their underlying processes are different from human cognition.
Why is planning important for AI agents?
Planning allows AI agents to manage complex tasks, use tools more effectively, track progress, and adapt when something goes wrong.
What is dynamic planning?
Dynamic planning means updating a plan while the task is being executed.
It is useful when conditions can change.
What is replanning?
Replanning is the process of changing an existing plan after new information, failure, or changing conditions.
How does memory help planning?
Memory can provide user preferences, previous actions, past failures, and task history.
This information helps the agent make better planning decisions.
Key Takeaways
Advanced AI agents often combine planning, reasoning, actions, observations, memory, and feedback.
ReAct allows an agent to alternate between reasoning and external actions.
Task decomposition divides complex problems into smaller subtasks.
Subgoals help agents track progress and manage large projects.
Plan-and-execute separates planning from execution.
Reflection helps agents review previous actions.
Self-correction allows agents to revise mistakes.
Replanning helps agents respond to failures and changing conditions.
Feedback loops make AI agents more flexible.
Safety controls are essential when agents can take real-world actions.
Human approval can be useful for high-impact decisions.
Final Conclusion
AI agent planning is much more than creating a checklist.
Advanced agents need to decide what to do, act on the environment, observe results, evaluate progress, and revise their approach when necessary.
ReAct, task decomposition, plan-and-execute architectures, reflection, self-correction, and replanning all help agents handle complex and changing tasks.
When combined with memory and tools, these planning capabilities allow AI agents to perform longer workflows and respond more intelligently to unexpected situations.
However, greater autonomy also introduces greater responsibility.
AI agents can still make mistakes, misunderstand goals, select the wrong tools, or follow weak plans.
For this reason, reliable systems need evaluation, safety constraints, appropriate permissions, and human oversight when the consequences of an action are significant.
Planning, reasoning, memory, and tools are therefore not separate ideas. Together, they form the foundation of modern agentic AI systems.