For free and developer tiers, Groq will shut down
llama-3.3-70b-versatile on August 16, 2026. Replace it with openai/gpt-oss-120b before that date. See Groq deprecations.fast_reasoning.py
"""
Fast Reasoning
==============
Demonstrates this reasoning cookbook example.
"""
import time
from agno.agent import Agent
from agno.models.groq import Groq
from rich.console import Console
# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
console = Console()
# Test task requiring reasoning
task = "What is 23 × 47? Show your step-by-step reasoning."
console.rule("[bold cyan]Groq Fast Reasoning Demo[/bold cyan]")
# Test with Llama 3.3 (reasoning capable)
console.print(
"\n[bold blue]Llama 3.3 70B Versatile (Reasoning Capable)[/bold blue]"
)
try:
start = time.time()
agent_deepseek = Agent(
model=Groq(id="llama-3.3-70b-versatile"),
markdown=True,
)
response = agent_deepseek.run(task, stream=False)
end = time.time()
console.print(response.content)
console.print(f"\n[dim]Response time: {end - start:.2f}s[/dim]")
if response.reasoning_content:
reasoning_len = len(response.reasoning_content.split())
console.print(f"[dim]Reasoning depth: ~{reasoning_len} words[/dim]")
except Exception as e:
console.print(f"[red]Error: {e}[/red]")
# Test with Llama for comparison
console.print("\n[bold green]Llama 3.3 70B (Standard Mode)[/bold green]")
try:
start = time.time()
agent_llama = Agent(
model=Groq(id="llama-3.3-70b-versatile"),
markdown=True,
)
response = agent_llama.run(task, stream=False)
end = time.time()
console.print(response.content)
console.print(f"\n[dim]Response time: {end - start:.2f}s[/dim]")
except Exception as e:
console.print(f"[red]Error: {e}[/red]")
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
run_example()
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U agno groq
3
Export your Groq API key
export GROQ_API_KEY="your_groq_api_key_here"
$Env:GROQ_API_KEY="your_groq_api_key_here"
4
Replace Llama 3.3
Replace
llama-3.3-70b-versatile with openai/gpt-oss-120b in the saved file.5
Run the example
Save the code above as
fast_reasoning.py, then run:python fast_reasoning.py