OpenAI Deep Research Agent

Build a cited web research agent with OpenAI Responses, with a current alternative to the retired Deep Research recipe.

OpenAI shut down o4-mini-deep-research on July 23, 2026. The source also describes a research function that it never registers. Use the current web research example below. See OpenAI deprecations.

deep_research_agent.py
"""
Openai Deep Research Agent
==========================

Cookbook example for `openai/responses/deep_research_agent.py`.
"""

from textwrap import dedent

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

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=OpenAIResponses(id="o4-mini-deep-research", max_tool_calls=1),
    instructions=dedent("""
        You are an expert research analyst with access to advanced research tools.

        When you are given a schema to use, pass it to the research tool as output_schema parameter to research tool.

        The research tool has two parameters:
        - instructions (str): The research topic/question
        - output_schema (dict, optional): A JSON schema for structured output
    """),
)

agent.print_response(
    """Research the economic impact of semaglutide on global healthcare systems.
    Do:
    - Include specific figures, trends, statistics, and measurable outcomes.
    - Prioritize reliable, up-to-date sources: peer-reviewed research, health
      organizations (e.g., WHO, CDC), regulatory agencies, or pharmaceutical
      earnings reports.
    - Include inline citations and return all source metadata.

    Be analytical, avoid generalities, and ensure that each section supports
    data-backed reasoning that could inform healthcare policy or financial modeling."""
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

Current Web Research Example

This uses a general Responses model with an explicit web search tool. Its instructions ask for source-backed findings and uncertainty; assess the cited sources before using the report.

research_current.py
from agno.agent import Agent
from agno.models.openai import OpenAIResponses

agent = Agent(
    model=OpenAIResponses(id="gpt-5.6-sol"),
    tools=[{"type": "web_search"}],
    instructions=[
        "Search for primary sources and cite links beside supported claims.",
        "Distinguish measured results from forecasts and identify missing evidence.",
    ],
    markdown=True,
)
result = agent.run(
    "Research how cities have measured the impact of electric bus adoption. "
    "Compare operating costs and emissions, with dates and source links."
)
print(result.content)
if result.citations:
    print(result.citations)

Run the Example

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 the example

Save the current web research example as research_current.py, then run:

python research_current.py

Full source: cookbook/90_models/openai/responses/deep_research_agent.py