N1N Tool Use

Call web search tools from GPT-5 mini running through the N1N gateway.

Use an N1N API key with access to this model and its required capabilities. Check your account's enabled model catalog before running.

tool_use.py
"""
N1N Tool Use
============

Cookbook example for `n1n/tool_use.py`.
"""

from agno.agent import Agent
from agno.models.n1n import N1N
from agno.tools.websearch import WebSearchTools

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

agent = Agent(
    model=N1N(id="gpt-5-mini"),
    markdown=True,
    tools=[WebSearchTools()],
)

agent.print_response("What is happening in France?", stream=True)

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

if __name__ == "__main__":
    pass

Run the Example

Set up your virtual environment

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

Install dependencies

uv pip install -U agno ddgs openai

Export your N1N API key

export N1N_API_KEY="your_n1n_api_key_here"

Run the example

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

python tool_use.py

Full source: cookbook/90_models/n1n/tool_use.py