> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fast Reasoning

> Time Llama 3.3 70B on Groq answering a math problem and check its reasoning depth.

<Warning>
  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](https://console.groq.com/docs/deprecations).
</Warning>

```python fast_reasoning.py theme={null}
"""
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

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno groq
    ```
  </Step>

  <Step title="Export your Groq API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export GROQ_API_KEY="your_groq_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:GROQ_API_KEY="your_groq_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Replace Llama 3.3">
    Replace `llama-3.3-70b-versatile` with `openai/gpt-oss-120b` in the saved file.
  </Step>

  <Step title="Run the example">
    Save the code above as `fast_reasoning.py`, then run:

    ```bash theme={null}
    python fast_reasoning.py
    ```
  </Step>
</Steps>

Full source: [cookbook/10\_reasoning/models/groq/fast\_reasoning.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/models/groq/fast_reasoning.py)
