Groq Reasoning Agent

Use GPT-OSS 120B on Groq for a separate reasoning stage and final response.

Groq retired deepseek-r1-distill-llama-70b on October 2, 2025. Replace it with openai/gpt-oss-120b. See Groq deprecations.

reasoning_agent.py
"""
Groq Reasoning Agent
====================

Cookbook example for `groq/reasoning_agent.py`.
"""

from agno.agent import Agent
from agno.models.groq import Groq

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

# Create a reasoning agent that uses:
# - `deepseek-r1-distill-llama-70b` as the reasoning model
# - `openai/gpt-oss-120b` to generate the final response
reasoning_agent = Agent(
    model=Groq(id="openai/gpt-oss-120b"),
    reasoning_model=Groq(
        id="deepseek-r1-distill-llama-70b", temperature=0.6, max_tokens=1024, top_p=0.95
    ),
)

# Prompt the agent to solve the problem
reasoning_agent.print_response("Is 9.11 bigger or 9.9?", stream=True)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

With the substitutions below, Agno runs the separate reasoning_model stage before the final model call. This adapter uses the first stage's answer text, or text inside its <think> tags, for that handoff; the current Groq response parser does not retain the provider's separate reasoning field.

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno groq

Export your Groq API key

export GROQ_API_KEY="your_groq_api_key_here"

Replace DeepSeek R1 Distill

Replace deepseek-r1-distill-llama-70b with openai/gpt-oss-120b in the saved file.

Run the example

Save the code above as reasoning_agent.py, then run:

python reasoning_agent.py

Full source: cookbook/90_models/groq/reasoning_agent.py