Pattern [17]

Reasoning Techniques

Algorithms / Design Patterns (e.g., Breadth-First Search, Recursion)

> Agentic Definition

Advanced cognitive architectures like Chain-of-Thought (CoT), Tree-of-Thought (ToT), and ReAct (Reason+Act) that structure the model's internal processing to solve complex problems.

> Description

Advanced cognitive architectures like Chain-of-Thought (CoT), Tree-of-Thought (ToT), and ReAct (Reason+Act) that structure the model's internal processing to solve complex problems.

≈ How It Maps to Algorithms / Design Patterns

The "method" by which the problem is solved. ToT is essentially a search algorithm (BFS/DFS) applied to the space of "thoughts."

≠ Key Divergence

Reasoning is prompted, not coded. You don't write the for loop; you tell the model how to think about the loop. You are programming the cognitive process, not the instruction set.

> Key Takeaway

Adapt: Programming is now "Prompt Engineering" at the architectural level. You are defining the algorithms of thought.

The Code

Before: Coded Algorithm

Coded Algorithm
1def solve(problem):
2 # Explicit implementation of A* search
3 open_set = {start}
4 while open_set:
5 current = lowest_f_score(open_set)
6 if current == goal:
7 return path
8 ...

After: Cognitive Prompting

Cognitive Prompting
1prompt = """
2Solve this problem using a Tree of Thought approach.
31. Generate 3 possible next steps.
42. Evaluate each step for feasibility.
53. Discard impossible paths.
64. Expand the best path.
7Let's think step by step.
8"""
9
10llm.generate(prompt)

Production Notes

  • More reasoning steps = higher latency. CoT increases token count significantly. Use only when the task complexity demands it.

Unlock code examples & production notes

Free account — no credit card required.

Sign Up Free

Already have an account? Log in

Frequently Asked Questions

When should I use the Reasoning Techniques pattern?

Advanced cognitive architectures like Chain-of-Thought (CoT), Tree-of-Thought (ToT), and ReAct (Reason+Act) that structure the model's internal processing to solve complex problems.

How does Reasoning Techniques relate to Algorithms / Design Patterns (e.g., Breadth-First Search, Recursion)?

The "method" by which the problem is solved. ToT is essentially a search algorithm (BFS/DFS) applied to the space of "thoughts." However, there is a key divergence: Reasoning is prompted, not coded. You don't write the for loop; you tell the model how to think about the loop. You are programming the cognitive process, not the instruction set.

What are the production trade-offs of Reasoning Techniques?

More reasoning steps = higher latency. CoT increases token count significantly. Use only when the task complexity demands it.