What is Reasoning?
Reasoning gives Agents the ability to "think" before responding and "analyze" the results of their actions (i.e. tool calls), greatly improving the Agents' ability to solve problems that require sequential tool calls.
Imagine asking a regular AI agent to solve a complex math problem, analyze a scientific paper, or plan a multi-step travel itinerary. Often, it rushes to an answer without fully thinking through the problem. The result? Wrong calculations, incomplete analysis, or illogical plans.
Now imagine an agent that pauses, thinks through the problem step-by-step, validates its reasoning, catches its own mistakes, and only then provides an answer. This is reasoning in action, and it transforms agents from quick responders into careful problem-solvers.
Why Reasoning Matters
Without reasoning, agents struggle with tasks that require:
- Multi-step thinking - Breaking complex problems into logical steps
- Self-validation - Checking their own work before responding
- Error correction - Catching and fixing mistakes mid-process
- Strategic planning - Thinking ahead instead of reacting
Example: Ask a normal agent "Which is bigger: 9.11 or 9.9?" and it might incorrectly say 9.11 (comparing digit by digit instead of decimal values). A reasoning agent thinks through the decimal comparison logic first and gets it right.
How Reasoning Works
The features of reasoning are available both on Agents and Teams.
Reasoning Models
Chain-of-Thought (CoT): The model thinks through a problem step-by-step internally, breaking down complex reasoning into logical steps before producing an answer. This is used by reasoning models and reasoning agents.
ReAct (Reason and Act): An iterative cycle where the agent alternates between reasoning and taking actions:
- Reason - Think through the problem, plan next steps
- Act - Take action (call a tool, perform calculation)
- Observe - Analyze the results
- Repeat - Continue reasoning based on new information until solved
This pattern is particularly useful with reasoning tools and when agents need to validate assumptions through real-world feedback.
Three Approaches to Reasoning
Kern gives you three ways to add reasoning to your agents, each suited for different use cases:
1. Reasoning Models
What: Pre-trained models that natively think before answering (e.g. OpenAI gpt-5, Claude 4.5 Sonnet, Gemini 2.0 Flash Thinking, DeepSeek-R1).
How it works: The model generates an internal chain of thought before producing its final response. This happens at the model layer: you simply use the model and reasoning happens automatically.
Best for:
- Single-shot complex problems (math, coding, physics)
- Problems where you trust the model to handle reasoning internally
- Use cases where you don't need to control the reasoning process
Example:
1from kern.agent import Agent2from kern.models.openai import OpenAIResponses34# Setup your Agent using a reasoning model5agent = Agent(model=OpenAIResponses(id="gpt-5.2"))67# Run the Agent8agent.print_response(9 "Solve the trolley problem. Evaluate multiple ethical frameworks. Include an ASCII diagram of your solution.",10 stream=True,11 show_full_reasoning=True,12)Read more about reasoning models in the Reasoning Models Guide.
Reasoning Model + Response Model
Here's a powerful pattern: use one model for reasoning (like DeepSeek-R1) and another for the final response (like GPT-4o). Why? Reasoning models are excellent at solving problems but often produce robotic or overly technical responses. By combining a reasoning model with a natural-sounding response model, you get accurate thinking with polished output.
1from kern.agent import Agent2from kern.models.anthropic import Claude3from kern.models.groq import Groq45# Setup your Agent using Claude as main model, and DeepSeek as reasoning model6claude_with_deepseek_reasoner = Agent(7 model=Claude(id="claude-sonnet-4-5"),8 reasoning_model=Groq(9 id="deepseek-r1-distill-llama-70b", temperature=0.6, max_tokens=1024, top_p=0.9510 ),11)1213# Run the Agent14claude_with_deepseek_reasoner.print_response(15 "9.11 and 9.9 -- which is bigger?",16 stream=True,17 show_full_reasoning=True,18)2. Reasoning Tools
What: Give any model explicit tools for thinking (like a scratchpad or notepad) to work through problems step-by-step.
How it works: You provide tools like think() and analyze() that let the agent explicitly structure its reasoning process. The agent calls these tools to organize its thoughts before responding.
Best for:
- Adding reasoning to non-reasoning models (like regular GPT-4o or Claude 3.5 Sonnet)
- When you want visibility into the reasoning process
- Tasks that benefit from structured thinking (research, analysis, planning)
Example:
1from kern.agent import Agent2from kern.models.anthropic import Claude3from kern.tools.reasoning import ReasoningTools45# Setup our Agent with the reasoning tools6reasoning_agent = Agent(7 model=Claude(id="claude-sonnet-4-5"),8 tools=[9 ReasoningTools(add_instructions=True),10 ],11 instructions="Use tables where possible",12 markdown=True,13)1415# Run the Agent16reasoning_agent.print_response(17 "Write a report on NVDA. Only the report, no other text.",18 stream=True,19 show_full_reasoning=True,20)Read more about reasoning tools in the Reasoning Tools Guide.
3. Reasoning Agents
What: Transform any regular model into a reasoning system through structured chain-of-thought processing via prompt engineering.
How it works: Set reasoning=True on any agent. Kern creates a separate reasoning agent that uses your same model (not a different one) but with specialized prompting to force step-by-step thinking, tool use, and self-validation. Works best with non-reasoning models like gpt-4o or Claude Sonnet. With reasoning models like gpt-5-mini, you're usually better off using them directly.
Best for:
- Transforming regular models into reasoning systems
- Complex tasks requiring multiple sequential tool calls
- When you need automated chain-of-thought with iteration and self-correction
Example:
1from kern.agent import Agent2from kern.models.openai import OpenAIResponses34# Transform a regular model into a reasoning system5reasoning_agent = Agent(6 model=OpenAIResponses(id="gpt-5.2"), # Regular model, not a reasoning model7 reasoning=True, # Enables structured chain-of-thought8 markdown=True,9)1011# The agent will now think step-by-step before responding12reasoning_agent.print_response(13 "Solve the trolley problem. Evaluate multiple ethical frameworks. Include an ASCII diagram of your solution.",14 stream=True,15 show_full_reasoning=True,16)Learn more: Reasoning Agents Guide
Choosing the Right Approach
Here's how the three approaches compare:
| Approach | Transparency | Best Use Case | Model Requirements |
|---|---|---|---|
| Reasoning Models | Continuous (full reasoning trace) | Single-shot complex problems | Requires reasoning-capable models |
| Reasoning Tools | Structured (explicit step-by-step) | Structured research & analysis | Works with any model |
| Reasoning Agents | Iterative (agent interactions) | Multi-step tool-based tasks | Works with any model |