zdr_reasoning_agent.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Run the example
Save the code above as
zdr_reasoning_agent.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Run o4-mini with store=False and reasoning_summary=“auto”, keeping multi-turn context in an InMemoryDb for Zero Data Retention.
"""
An example of using OpenAI Responses with reasoning features and ZDR mode enabled.
Read more about ZDR mode here: https://openai.com/enterprise-privacy/.
"""
from agno.agent import Agent
from agno.db.in_memory import InMemoryDb
from agno.models.openai import OpenAIResponses
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
name="ZDR Compliant 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 operating in Zero Data Retention mode for maximum privacy and compliance.",
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?")
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
pass
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno openai
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run the example
zdr_reasoning_agent.py, then run:python zdr_reasoning_agent.py
Was this page helpful?