> ## 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.

# OpenAI Default Chain Of Thought

> Contrasts an explicit gpt-4o reasoning_model fallback against reasoning=True built-in chain-of-thought on the same fibonacci prompt.

Demonstrates fallback chain-of-thought and built-in reasoning in one script.

```python default_chain_of_thought.py theme={null}
"""
OpenAI Default Chain Of Thought
===============================

Demonstrates fallback chain-of-thought and built-in reasoning in one script.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat

# ---------------------------------------------------------------------------
# Create Agents
# ---------------------------------------------------------------------------
manual_cot_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    reasoning_model=OpenAIChat(
        id="gpt-4o",
        max_tokens=1200,
    ),
    markdown=True,
)

default_cot_agent = Agent(
    model=OpenAIChat(id="gpt-4o", max_tokens=1200),
    reasoning=True,
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agents
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    prompt = "Give me steps to write a python script for fibonacci series"

    print("=== Explicit reasoning_model fallback ===")
    manual_cot_agent.print_response(
        prompt,
        stream=True,
        show_full_reasoning=True,
    )

    print("\n=== Built-in reasoning=True ===")
    default_cot_agent.print_response(
        prompt,
        stream=True,
        show_full_reasoning=True,
    )
```

## Run the Example

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

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

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

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

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

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

Full source: [cookbook/10\_reasoning/agents/default\_chain\_of\_thought.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/agents/default_chain_of_thought.py)
