Fast Reasoning
Time a GPT-OSS call and a separate DeepSeek-plus-Qwen pipeline on the same math prompt.
Compares Groq speed with and without a reasoning model.
"""
Fast Reasoning
==============
Compares Groq speed with and without a reasoning model.
"""
import time
from agno.agent import Agent
from agno.models.deepseek import DeepSeek
from agno.models.groq import Groq
from rich.console import Console
# ---------------------------------------------------------------------------
# Create Agents
# ---------------------------------------------------------------------------
console = Console()
task = "What is 23 x 47? Show your step-by-step reasoning."
# Fast agent - no reasoning model
fast_agent = Agent(
model=Groq(id="openai/gpt-oss-120b"),
markdown=True,
)
# Reasoning agent - uses DeepSeek for thinking
reasoning_agent = Agent(
model=Groq(id="qwen/qwen3.6-27b"),
reasoning_model=DeepSeek(id="deepseek-reasoner"),
markdown=True,
)
# ---------------------------------------------------------------------------
# Run Agents
# ---------------------------------------------------------------------------
if __name__ == "__main__":
console.rule("[bold cyan]Groq Fast Reasoning Demo[/bold cyan]")
console.rule("[bold green]Fast Agent (No Reasoning)[/bold green]")
start = time.time()
fast_agent.print_response(task, stream=True)
console.print(f"\n[dim]Response time: {time.time() - start:.2f}s[/dim]")
console.rule("[bold blue]Reasoning Agent (DeepSeek)[/bold blue]")
start = time.time()
reasoning_agent.print_response(task, stream=True, show_full_reasoning=True)
console.print(f"\n[dim]Response time: {time.time() - start:.2f}s[/dim]")DeepSeek retired the deepseek-reasoner alias after July 24, 2026. Before running, replace DeepSeek(id="deepseek-reasoner") with DeepSeek(id="deepseek-v4-flash") in the saved program. The final answer uses Groq in a separate call, so both DEEPSEEK_API_KEY and GROQ_API_KEY are required. See the DeepSeek V4 migration notice.
The current Groq adapter reads answer text but does not copy the provider's separate reasoning field into Agno reasoning output. When Groq is the explicit reasoning stage, Agno hands its answer text to the final model as a fallback. show_full_reasoning cannot recover the dropped provider field.
The first pipeline uses GPT-OSS 120B on Groq without an extra Agno reasoning stage; that model itself supports reasoning. The second uses native DeepSeek for the separate stage and Qwen 3.6 on Groq for the answer. These are different models and call counts, so their elapsed times do not isolate reasoning overhead or establish one model's speed or answer quality.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno groq openaiExport your API keys
export DEEPSEEK_API_KEY="your_deepseek_api_key_here"
export GROQ_API_KEY="your_groq_api_key_here"Run the example
Save the code above as fast_reasoning.py, then run:
python fast_reasoning.pyFull source: cookbook/10_reasoning/models/groq/fast_reasoning.py