OpenAI Separate Reasoning Model

Use a native GPT-5.2 reasoning stage before a GPT-4.1 response.

GPT-4.1 can generate the main response; it is not a supported separate native reasoner. This example assigns that stage to GPT-5.2.

Add the following code to your Python file

reasoning_model_gpt4_1_example.py
from agno.agent import Agent
from agno.models.openai.responses import OpenAIResponses

agent = Agent(
    model=OpenAIResponses(id="gpt-4.1"),
    reasoning_model=OpenAIResponses(id="gpt-5.2", reasoning_effort="medium", reasoning_summary="auto"),
)
agent.print_response(
    "Solve the trolley problem. Evaluate multiple ethical frameworks. "
    "Include an ASCII diagram of your solution.",
    stream=True,
)

Set up your virtual environment

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

Install dependencies

uv pip install -U agno openai

Export your OpenAI API key

  export OPENAI_API_KEY="your_openai_api_key_here"

Run Agent

python reasoning_model_gpt4_1_example.py