ZDR Reasoning Agent

Use store=False and local conversation history for stateless Responses API reasoning.

store=False disables storage of the response as application state; it does not enable account-level Zero Data Retention. ZDR requires a separately approved and configured organization or project. See OpenAI’s data controls for eligibility and endpoint restrictions.

Agno requests encrypted reasoning content for stateless continuation. InMemoryDb stores conversation history in this Python process and add_history_to_context sends that history on subsequent calls. The agent’s name or instructions do not change provider retention settings.

Code

"""
Use stateless Responses API reasoning with conversation history in this process.

Account-level Zero Data Retention requires separate approval and configuration.
"""

from agno.agent import Agent
from agno.db.in_memory import InMemoryDb
from agno.models.openai import OpenAIResponses

agent = Agent(
    name="Stateless Reasoning Agent",
    session_id="zdr_demo_session",
    model=OpenAIResponses(
        id="o4-mini",
        store=False,
        reasoning_summary="auto",  # Requesting a reasoning summary
    ),
    instructions="You are a helpful AI assistant.",
    db=InMemoryDb(),
    add_history_to_context=True,
    stream=True,
)

agent.print_response("What's the largest country in Europe by area?")
agent.print_response("What's the population of that country?")
agent.print_response("What's the population density per square kilometer?")

Usage

Set up your virtual environment

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

Set your API key

export OPENAI_API_KEY=xxx

Install dependencies

uv pip install -U openai agno

Run Agent

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

python zdr_reasoning_agent.py