Tree-of-thought
Tree-of-thought is a reasoning technique that explores and evaluates multiple branching paths of intermediate reasoning to develop a solution.
AI Agents in Action, Second Edition
A thought tree is a tree-structured representation of alternative intermediate reasoning steps and their extensions.
- How it is used
- Uses branching search for planning, puzzles, and other tasks where exploring alternatives matters more than following one reasoning path.
- How deep it goes
- Explains generation, expansion, evaluation, pruning, and backtracking, while leaving full search orchestration to external code.
- Examples
- Uses a time-travel jump problem and an exercise that expands, scores, and filters branches while counting LLM calls.
- What you can do after
- Build it from scratch with generator and evaluator agents plus code that expands, scores, and prunes candidate paths.
Read how AI Agents in Action, Second Edition explains Tree-of-thought →
Introduction to Generative AI, Second Edition
Tree of thought is a prompting technique that explores multiple branching sequences of intermediate reasoning before selecting a solution.
- How it is used
- Uses branching prompts to compare candidate reasoning paths before selecting an approach for complex or constrained tasks.
- How deep it goes
- Explains the branching-and-selection mechanism and gives one worked example, but does not provide implementation details or systematic search procedures.
- Examples
- Uses customer-retention strategies, logic puzzles, scientific problem-solving, and search-heavy applications as examples.
- What you can do after
- Apply it via prompting to generate, compare, and select multiple candidate solutions.
Read how Introduction to Generative AI, Second Edition explains Tree-of-thought →
Building Reliable AI Systems
A prompting method in which a language model explores and evaluates multiple reasoning paths before selecting a solution.
- How it is used
- Supports decisions with multiple plausible solutions by exploring alternatives before producing a final response.
- How deep it goes
- Explains branch generation, evaluation, and selection, but does not specify an implementation or detailed selection criteria.
- Examples
- Uses a damaged-TV return and European shipping-cost decisions to illustrate competing paths.
- What you can do after
- Practice/perform branch generation, evaluation, and selection for customer-service or agent decisions.
Read how Building Reliable AI Systems explains Tree-of-thought →
AI Agents in Action
Tree of thought prompting is a prompting technique that explores and evaluates multiple intermediate reasoning paths while constructing a solution.
- How it is used
- Guides complex planning by exploring and evaluating multiple reasoning paths instead of relying on one generated sequence.
- How deep it goes
- Implements breadth-first prompt flow with paired generation and evaluation functions, while deferring practical depth-first execution.
- Examples
- Uses a complex time-travel problem, prompt-flow diagrams, Python tooling, and outputs containing evaluated and rejected answer nodes.
- What you can do after
- Operate/configure a breadth-first ToT flow that generates alternatives, evaluates nodes, and stops invalid branches.
Transformers in Action
Tree-of-thought prompting explores and evaluates multiple branching intermediate reasoning paths before producing an answer.
- How it is used
- Applies prompting to complex tasks requiring exploratory, strategic reasoning and deliberate selection among intermediate solutions.
- How deep it goes
- Explains generation, evaluation, BFS, DFS, pruning, and a GPT-4 implementation rather than only defining the technique.
- Examples
- Demonstrates Game of 24 with arithmetic branches, candidate labels, a GPT-4 workflow, and a final valid equation.
- What you can do after
- Apply it via a tree-search implementation that generates, evaluates, prunes, and selects intermediate reasoning paths.
AI Agents and Applications
Tree of thought is a reasoning technique that lets a language model explore, evaluate, refine, and backtrack across multiple reasoning paths.
- How it is used
- Improves deliberate reasoning, planning, and decision-making for tasks requiring strategic exploration.
- How deep it goes
- Defines exploration, evaluation, refinement, and backtracking but does not specify an implementation procedure.
- Examples
- Uses Game of 24, creative writing, and mini crosswords as application examples.
- What you can do after
- Evaluate when multiple reasoning paths and backtracking may improve a language-model solution.
Read how AI Agents and Applications explains Tree-of-thought →
Related concepts
- brainstormingcontrasts with · Brainstorming is an ideation technique for generating and exploring multiple ideas before organizing or evaluating them.
- premature convergenceaddresses · Premature convergence is the settling of a search, learning, or reasoning process on a suboptimal outcome before alternatives have been adequately explored.
- pipelineuses · A pipeline is an ordered or coordinated sequence of connected processing stages or tasks that passes data, work, or results toward an outcome.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





