ModelRefs / Planning & Reasoning Loops — Tutorial
Planning & Reasoning Loops — Tutorial
CoT, ToT, ReAct, and MCTS — how agents decompose hard problems and verify their own reasoning. Covers Why planning matters for hard tasks.
Overview
CoT, ToT, ReAct, and MCTS — how agents decompose hard problems and verify their own reasoning
Level: Expert. Estimated reading time: 40 minutes.
Why planning matters for hard tasks
A single LLM call is a one-shot mapper from input to output. For hard tasks — multi-step coding, research synthesis, multi-constraint planning — this is insufficient. Planning loops allow the agent to:
1. Decompose: break the goal into sub-goals 2. Execute: tackle each sub-goal, using tools as needed 3. Verify: check whether the sub-goal was achieved 4. Backtrack or revise: if not, try a different approach
Without an explicit plan, agents attempt hard tasks in one pass and either hallucinate a plausible-sounding but wrong answer, or get stuck when the first approach fails.
The quality of a planning loop is determined by: how it generates candidate actions, how it evaluates progress, and how it handles failure.
Tree of Thought and MCTS-style search
Chain-of-Thought (CoT): generate reasoning steps linearly. Single path. Works for problems where each step has one obvious next move.
Tree of Thought (ToT, Yao et al., 2023): at each step, generate multiple candidate next thoughts, evaluate them (with an LLM or heuristic), and explore the most promising branch. This is BFS/DFS over a tree of partial solutions.
ToT dramatically outperforms CoT on creative writing, math puzzles, and planning tasks that require backtracking. The cost: many more LLM calls.
MCTS-style planning: used in AlphaCode 2 and similar systems. Four phases: Selection, Expansion, Simulation, Backpropagation. Allows guided exploration of exponential action spaces.
For practical agent systems: use a lightweight plan → verify → revise loop rather than full MCTS, which is expensive.
Plan-and-execute agents
The plan-and-execute pattern separates planning from execution:
Step 1 — Planner: given the goal, produce a numbered list of steps. Called once at the start (and replanned on failure).
Step 2 — Executor: for each step, calls the appropriate tool or sub-agent. Given only the current step and context of completed steps.
Step 3 — Verifier: after each step, verify completion. If a step fails, re-plan from that point.
Advantages: the planner can use a stronger (expensive) model; the executor uses a faster model. Failures trigger targeted re-planning rather than restarting. Plans can be inspected and modified by users.
LangGraph implements this as a state graph: each node is a step, edges encode control flow, the state carries the plan + completed steps + results.
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Planning & Reasoning Loops — Tutorial.