Planning, Reflection & Reasoning Patterns: overview
- Source
- From the RAG & Agents Engineering course
- By
- Sourav Banerjee
- Last updated
- 9 Nov 2026
An agent that answers a multi-part question has to decide its steps, and an agent whose answer must be right has to check its own work. This module covers both: planning the steps before running them, replanning when a result is wrong, critiquing and verifying a draft, and searching over several reasoning paths when one is not reliable enough. The T8.1 notebooks build on four ideas: plan-and-execute, replanning, chain-of-verification and tree search with tree of thoughts and LATS.
The running example is a Larkspur Cloud customer who wants to cancel an annual plan. The answer needs up to six handbook lookups: the refund rule, how long a refund takes, what happens to servers, how long data is kept, what an export includes, and how fast support answers. The lab plans and runs those lookups against the handbook chunks T5.1 to T5.3 use, lesson 3 of T8.1 critiques an incident post against the SLA, and lesson 4 of T8.1 verifies a drafted cancellation answer against the same chunks.
In short
- A fixed plan makes 2 LLM calls (planner and synthesizer) however many lookups it holds. ReAct makes one per search plus one to answer, and each call re-reads the conversation so far. On the lab's four-lookup question that is 2 calls and about 504 tokens against 5 calls and about 918.
- A fixed plan writes a wrong search result straight into the answer. Evaluating every step and replanning costs N + 2 + 2f calls for N lookups and f wrong results, and the cap must count retries: six lookups with one retry need 7 executed steps, and the notebook's cap of 6 leaves one lookup unanswered.
- A critic with only its own opinion improves style and invents facts it was asked for. Reflexion turns the critique into searches the revision must cite, and chain-of-verification answers one question per claim in a fresh call that never sees the draft, at 1 + 1 + N + 1 calls. It removes unsupported claims and adds no missing ones.
- Self-consistency, tree of thoughts and LATS spend extra calls on several reasoning paths. They pay off only when something can score a partial answer: the evaluator decides what survives.
- The optional patterns put a rule in code behind every model judgement: Self-Discover's verification step, an execution critic, a simulator's 5th-percentile limit, a metacognitive router and an editor that approves what a memory keeps.
Mental model
- A customer cancelling a Larkspur annual plan asks four things at once.
- The planner lists four lookups in one LLM call, before any search runs.
- The first search, for the refund rule, returns the refund-timing chunk.
- The evaluator rejects it: the result answers a different question.
- The replanner rewrites that lookup from the reason it failed and keeps the other three.
- The rewritten search returns refund-window, and the remaining lookups pass their checks.
- The synthesizer writes from accepted results only. The lab counts 8 LLM calls and 5 searches for this run.
- Each claim in the draft is checked in a fresh call that cannot see the draft (lesson 4 of T8.1), then the answer goes out.
Figure 1: Plan, check, verify. Each box is a place to spend an LLM call, and each buys a different guarantee.
The plan makes the work visible before it runs, the check stops a wrong result from reaching the answer, and verification catches claims the draft invented. ReAct folds plan, execute and check into one call per step. Reflection (lesson 3 of T8.1) puts a critic after Draft, and tree search (lesson 6 of T8.1) replaces the single Execute box with several candidate steps and an evaluator that keeps the best.
Interactive lab
Plan or react: the call budget: open the file in a browser. Clear the wrong-result toggle and slide the lookups from 1 to 6: the fixed plan stays at 2 LLM calls while ReAct's tokens climb past the replanner's at six. Then press lookup 1 again and compare the three answers. Finally set six lookups, keep one wrong, and drop the cap from 7 to 6 to see a lookup go unanswered.
How it connects
- Before: T7.1 and T7.2 build the agent loop and ReAct that this module measures against. In T7.3's workflow patterns (prompt chaining, routing, parallelisation, orchestrator and worker, evaluator and optimiser) you draw every step. From this module on, the model writes part of the control flow, and lesson 2 of T8.1 reuses T7.3's Send fan-out.
- Next: T8.2 applies planning to coding and deep agents, and T8.3 adds human approval before an agent acts. T6.2's query decomposition is a plan for retrieval, and T9.2's Self-RAG checks a generated answer for groundedness in the retrieved evidence, the RAG form of the verify step.
Key Takeaways
- Plan when the steps are knowable up front and react when the next step depends on the last result. Count LLM calls and tokens for both on your own questions before choosing.
- A plan is only as safe as its check. Evaluate every step's result, replan from the reason it failed, cap the loop from planned steps plus allowed retries, and send only accepted results to the answer.
- Give the critic evidence: a check in code, a search, a verification question answered without the draft, or the result of running the output. A critic with only its opinion fixes style.
- Spend extra reasoning paths only where an evaluator can tell a good partial answer from a bad one, and keep every numeric rule in code.