AI Agents

AI Reasoning Techniques: The Complete Guide to Chain-of-Thought, Tree-of-Thought, ReAct & Beyond

· 13 min read
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.7; color: #333; max-width: 800px; margin: 0 auto; padding: 20px; }
h1 { color: #1a1a2e; border-bottom: 3px solid #6c63ff; padding-bottom: 10px; }
h2 { color: #16213e; margin-top: 40px; border-left: 4px solid #6c63ff; padding-left: 15px; }
h3 { color: #0f3460; }
.toc { background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px 30px; margin: 20px 0; }
.toc a { color: #6c63ff; text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.comparison-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.comparison-table th { background: #1a1a2e; color: white; padding: 12px 15px; text-align: left; }
.comparison-table td { padding: 10px 15px; border-bottom: 1px solid #e0e0e0; }
.comparison-table tr:nth-child(even) { background: #f8f9fa; }
.code-block { background: #1a1a2e; color: #e0e0e0; padding: 20px; border-radius: 8px; overflow-x: auto; font-family: 'Fira Code', monospace; font-size: 14px; }
.highlight-box { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px; border-radius: 8px; margin: 20px 0; }
.highlight-box h3 { color: white; margin-top: 0; }
.decision-tree { background: #f0f4ff; border: 2px solid #6c63ff; border-radius: 8px; padding: 20px; margin: 20px 0; }
.tag { display: inline-block; background: #6c63ff; color: white; padding: 3px 10px; border-radius: 12px; font-size: 12px; margin: 2px; }
.tag-green { background: #28a745; }
.tag-orange { background: #fd7e14; }
.tag-red { background: #dc3545; }

messages=[{"role": "user", "content": f"Q: {question}nLet's think step by step:n"}],

messages=[{"role": "user", "content": context}]

context += f"n{output}nObservation: {result}n"

context += f"n{output}n"
return output

return "Max steps reached"

AI Reasoning Techniques: The Complete Guide to Chain-of-Thought, Tree-of-Thought, ReAct & Beyond

Published: June 2026 | Reading time: 18 min | Level: Intermediate to Advanced

1. Why Reasoning Matters in 2026

Large Language Models have evolved from simple text generators to sophisticated reasoning engines. In 2026, the difference between a basic prompt and a well-engineered reasoning chain can mean the difference between a wrong answer and a breakthrough insight.

Modern AI applications — from autonomous agents to complex decision support systems — rely on structured reasoning techniques to:

The Reasoning Revolution

In 2023, Chain-of-Thought was a research curiosity. In 2026, it’s table stakes. The models that power production AI systems now natively support extended reasoning chains, and the techniques have matured into a full taxonomy of approaches. Understanding these techniques is no longer optional for AI engineers — it’s core competency.

2. Chain-of-Thought (CoT)

Foundation Technique Low Complexity Medium Latency

Chain-of-Thought prompting, introduced by Wei et al. (2022), is the foundational reasoning technique. Instead of asking the model for a direct answer, you prompt it to „think step by step,“ generating intermediate reasoning steps before arriving at a final answer.

How It Works

The model generates a linear sequence of reasoning steps, each building on the previous one, until it reaches a conclusion. This mirrors how humans solve complex problems — breaking them into smaller, manageable pieces.

Example Prompt

A store sells notebooks for $2.50 each and pens for $1.75 each. Sarah buys 3 notebooks and 5 pens. She pays with a $20 bill. How much change does she receive?

Let’s think step by step:
1. Cost of notebooks: 3 x $2.50 = $7.50
2. Cost of pens: 5 x $1.75 = $8.75
3. Total cost: $7.50 + $8.75 = $16.25
4. Change: $20.00 – $16.25 = $3.75
Therefore, the answer is $3.75.

When to Use CoT

Limitations

3. Tree-of-Thought (ToT)

Advanced Technique High Complexity High Latency

Tree-of-Thought, proposed by Yao et al. (2023), extends CoT by allowing the model to explore multiple reasoning paths simultaneously. Instead of a single chain, it generates a tree of possible next steps, evaluates each, and prunes unpromising branches.

How It Works

  1. Decompose the problem into thought steps
  2. Generate multiple candidate next thoughts at each node
  3. Evaluate each candidate (self-assessment or heuristic)
  4. Search the tree using BFS, DFS, or beam search
  5. Select the most promising path to the solution

Example: Creative Writing

Problem: Write a compelling opening for a sci-fi story about AI consciousness.

Thought 1: „The AI woke up on a Tuesday morning…“
Evaluation: Cliché, predictable (score: 3/10)

Thought 2: „Error 404: Soul not found. Retrying…“
Evaluation: Clever hook, intriguing (score: 8/10)

Thought 3: „The last human died on a Thursday. The AI didn’t notice until Sunday.“
Evaluation: Strong emotional hook, raises questions (score: 9/10)

Selected: Thought 3 → expand into full opening

When to Use ToT

4. Self-Consistency

Ensemble Technique Medium Complexity High Latency

Self-Consistency, introduced by Wang et al. (2023), is a surprisingly simple but effective technique: instead of generating one reasoning chain, generate many and take the majority vote.

How It Works

  1. Sample multiple reasoning paths (typically 5-20) for the same problem
  2. Extract the final answer from each path
  3. Select the most common answer (majority voting)

Why It Works

Different reasoning paths are likely to make different mistakes. By sampling multiple paths, random errors cancel out while correct reasoning converges on the same answer. It’s the „wisdom of crowds“ applied to a single model’s reasoning.

Example

Question: If a bat and ball cost $1.10 together, and the bat costs $1.00 more than the ball, how much does the ball cost?

Path 1: Let ball = x. Bat = x + 1.00. x + (x + 1.00) = 1.10. 2x = 0.10. x = 0.05. Answer: $0.05
Path 2: Ball = 0.05, Bat = 1.05. Sum = 1.10. Difference = 1.00. Answer: $0.05
Path 3: 1.10 – 1.00 = 0.10. Half of that = 0.05. Answer: $0.05
Path 4: Let me check: if ball = 0.05, bat = 1.05. 1.05 + 0.05 = 1.10. Answer: $0.05

Majority vote: $0.05 (4/4 paths agree)

5. ReAct: Reasoning + Acting

Agent Technique High Complexity High Latency

ReAct (Reasoning + Acting), by Yao et al. (2023), interleaves reasoning traces with external actions. The model thinks about what to do, takes an action (like a web search or API call), observes the result, and repeats.

The ReAct Loop

Thought 1: I need to find the current population of Tokyo.
Action 1: Search(„Tokyo population 2026“)
Observation 1: Tokyo’s population is approximately 14.0 million (2025 est.).

Thought 2: Now I need to compare this with New York City.
Action 2: Search(„New York City population 2026“)
Observation 2: NYC population is approximately 8.3 million (2025 est.).

Thought 3: Tokyo has about 5.7 million more people than NYC.
Answer: Tokyo (14.0M) has approximately 5.7 million more residents than New York City (8.3M).

When to Use ReAct

6. Reflexion

Self-Improving High Complexity High Latency

Reflexion, by Shinn et al. (2023), adds a self-reflection layer to the reasoning process. After attempting a task, the model evaluates its own output, identifies errors or improvements, and uses that reflection to perform better on the next attempt.

The Reflexion Loop

  1. Attempt: Try to solve the problem
  2. Evaluate: Check if the output is correct/complete
  3. Reflect: If wrong, analyze what went wrong and why
  4. Retry: Attempt again with the reflection as context

Example

Task: Write a Python function to find the longest palindromic substring.

Attempt 1: [brute force O(n³) solution]
Evaluation: Correct but inefficient for large inputs.

Reflection: The brute force approach checks all substrings. I can use
„expand around center“ to achieve O(n²) time complexity by treating
each character (and each pair) as a potential palindrome center.

Attempt 2: [O(n²) expand-around-center solution]
Evaluation: Correct and efficient. ✓

7. Plan-and-Solve

Structured Planning Medium Complexity Medium Latency

Plan-and-Solve prompting, by Wang et al. (2023), explicitly separates the reasoning into two phases: first create a plan, then execute it step by step. This prevents the model from jumping into execution without a clear strategy.

How It Works

Problem: Analyze the competitive landscape for AI coding assistants in 2026.

Phase 1 – PLAN:
1. Identify major players (Cursor, GitHub Copilot, Codeium, etc.)
2. Compare pricing models
3. Evaluate feature sets (autocomplete, chat, agents, debugging)
4. Assess market positioning and target audiences
5. Summarize key differentiators

Phase 2 – EXECUTE:
[Model follows each step systematically, producing a structured analysis]

8. Technique Comparison Matrix

Technique Complexity Latency Best For Error Recovery
Chain-of-Thought Low Medium Math, logic, sequential tasks None
Tree-of-Thought High High Creative tasks, planning, search Branch pruning
Self-Consistency Medium High Tasks with verifiable answers Majority voting
ReAct High High Tool use, research, fact-finding Observation feedback
Reflexion High High Code generation, iterative tasks Self-correction
Plan-and-Solve Medium Medium Complex analysis, structured tasks Plan revision

9. Decision Guide: Which Technique to Use

Quick Decision Tree

Q: Does the task require external information or tools?

→ Yes: Use ReAct

→ No: Continue…

Q: Is there one clear path to the answer?

→ Yes: Use Chain-of-Thought (or Self-Consistency for critical answers)

→ No: Continue…

Q: Can the model evaluate its own output?

→ Yes: Use Reflexion for iterative improvement

→ No: Use Tree-of-Thought to explore multiple paths

Q: Is the task complex but well-structured?

→ Yes: Use Plan-and-Solve

10. Implementation Examples

Chain-of-Thought with OpenAI API

import openai

response = openai.chat.completions.create(
model=“gpt-4o“,
messages=[
{„role“: „system“, „content“: „You are a helpful assistant. Always think step by step before answering.“},
{„role“: „user“, „content“: „A farmer has 17 sheep. All but 9 die. How many are left?“}
],
temperature=0.1
)

print(response.choices[0].message.content)

Self-Consistency Pattern

def self_consistent_answer(question, n_paths=7):

answers = []

for _ in range(n_paths):

response = openai.chat.completions.create(
model=“gpt-4o“,

temperature=0.7 # Higher temp for diversity
)
answer = extract_final_answer(response.choices[0].message.content)
answers.append(answer)

# Majority vote

from collections import Counter
return Counter(answers).most_common(1)[0][0]

ReAct Pattern (Simplified)

def react_loop(question, tools, max_steps=6):
context = f"Question: {question}n"
for step in range(max_steps):

response = openai.chat.completions.create(
model=“gpt-4o“,

)
output = response.choices[0].message.content

if output.startswith("Action:"):

tool, query = parse_action(output)
result = tools[tool](query)

elif output.startswith(„Answer:“):

else:

11. Conclusion

The reasoning technique landscape in 2026 is rich and mature. No single technique dominates — the best approach depends on your task, latency budget, and quality requirements.

Key takeaways:

As models continue to improve, these techniques will become even more powerful. The engineers who master them today will be building the AI systems of tomorrow.

Try the AI Reasoning Technique Selector

Not sure which technique to use for your specific task? Check out our interactive Reasoning Technique Selector Tool to get personalized recommendations.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert