from textwrap import dedent
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.exa import ExaTools
agent = Agent(
model=OpenAIChat(id="gpt-5-mini"),
tools=[ExaTools(research=True, research_model="exa-research-pro")],
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
Example: If user says "Research X. Use this schema {'type': 'object', ...}", you must call research tool with the schema.
If no schema is provided, the tool will auto-infer an appropriate schema.
Present the findings exactly as provided by the research tool.
"""),
)
# Example 1: Basic research with simple string
agent.print_response(
"Perform a comprehensive research on the current flagship GPUs from NVIDIA, AMD and Intel. Return a table of model name, MSRP USD, TDP watts, and launch date. Include citations for each cell."
)
Create a virtual environment
Terminal
and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set your API key
export OPENAI_API_KEY=xxx
export EXA_API_KEY=xxx
Install libraries
pip install -U agno openai exa_py
Run Agent
python cookbook/examples/agents/deep_research_agent_exa.py