Skip to content
derpx06.dev
WritingExplainersNotesAbout
works on my machineit's always DNSship itLGTMTODO: sleepoff by oneread the docsgit push --force-with-lease404: sleep not foundhave you tried turning it off and on againrubber duck says: explain itpremature optimisationworks on my machineit's always DNSship itLGTMTODO: sleepoff by oneread the docsgit push --force-with-lease404: sleep not foundhave you tried turning it off and on againrubber duck says: explain itpremature optimisation

Learning in public.

A student's notebook on system design, distributed systems and databases. Shared as I learn.

ReadWritingExplainersNotesAbout
ElsewhereGitHubLinkedInHugging FaceLeetCode
Say hellomanaskhairnar1511@gmail.com
derpx06
NORMALmain© 2026 Derpx06Pune, Indiatop ↑
Learn/LangChain Mastery/Part 8 · 7. Tools & Agents
Lesson 57 of 68

Plan-and-Solve Agents

Measure twice, cut once. Separating strategy from execution.

Derpx0610 Jan · 1 min read
LangChain Mastery
Designing Tool SchemasFunction Calling in LangChainTool Selection & ValidationReAct AgentsPlan-and-Solve AgentsFallbacks & Error HandlingLangGraph: Stateful AgentsHuman-in-the-Loop
Contents
1. The Chaos of ReAct2. The Planner Pattern3. Replanning4. Summary
0% read · 1 min leftBack to top ↑
Course outline & contents0%
LangChain Mastery
Designing Tool SchemasFunction Calling in LangChainTool Selection & ValidationReAct AgentsPlan-and-Solve AgentsFallbacks & Error HandlingLangGraph: Stateful AgentsHuman-in-the-Loop
Contents
1. The Chaos of ReAct2. The Planner Pattern3. Replanning4. Summary

1. The Chaos of ReAct

ReAct agents are "myopic." They only see the next step. If you ask ReAct to "Write a novel," it will try to write Chapter 1, then Chapter 2... and by Chapter 3 it forgets the plot. It wanders.

Plan-and-Solve separates the "Architect" from the "Builder."

2. The Planner Pattern

Step 1: The Planner A prompt that cannot use tools. Its only job is to output a checklist. User: "Research the history of coffee and write a blog post." Planner:

  1. Search for coffee origins (Ethiopia).
  2. Search for spread to Europe.
  3. Search for modern wave.
  4. Write section 1.
  5. Write section 2.

Step 2: The Executor A ReAct agent that takes Item #1, executes it, returns the result. Then takes Item #2.

3. Replanning

Real life breaks plans. "Search for Ethiopian records" might return 0 results. A robust Plan-and-Solve agent has a Replanner Step. If Step 1 fails, it goes back to the Architect: "I couldn't find records. Update the plan." New Plan: "Search for 'Legend of Kaldi' instead."

4. Summary

Small tasks -> ReAct. Big projects -> Plan-and-Solve. You wouldn't build a house without blueprints. Don't let your AI build software without a plan.

Key Intuition: "First we think. Then we do."

Track your progressSign in and your progress follows you across devices.
Sign in to track progress Next lesson
← Previous lessonReAct AgentsNext lesson →Fallbacks & Error Handling