Agent with Tools

Give a Nexus agent web search with WebSearchTools.

Code

tool_use.py
"""Run `uv pip install ddgs` to install dependencies."""

from agno.agent import Agent
from agno.models.nexus import Nexus
from agno.tools.websearch import WebSearchTools

agent = Agent(
    model=Nexus(id="anthropic/claude-sonnet-4-6"),
    tools=[WebSearchTools()],
    markdown=True,
)

agent.print_response("Whats happening in France?")

Usage

Set up your virtual environment

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

Install dependencies

uv pip install -U agno openai ddgs

Configure Nexus

Install Nexus, then create nexus.toml in the directory where you will start the gateway:

[server]
listen_address = "127.0.0.1:8000"

[llm]
enabled = true

[llm.protocols.openai]
enabled = true
path = "/llm"

[llm.providers.anthropic]
type = "anthropic"
api_key = "{{ env.ANTHROPIC_API_KEY }}"

[llm.providers.anthropic.models."claude-sonnet-4-6"]

The Nexus model sends OpenAI-compatible requests to http://localhost:8000/llm/v1/ by default. Nexus requires every model to be declared in nexus.toml.

Start Nexus

In a dedicated server terminal, set the provider key and start the gateway from the directory that contains nexus.toml:

export ANTHROPIC_API_KEY="your-anthropic-api-key"
nexus

Leave this terminal running. The provider key belongs to the Nexus process. Open a second terminal in your example directory, activate the Python virtual environment there, and run the Agno client. Exporting the key only in that client terminal does not configure the gateway.

Run Agent

In the second terminal with your virtual environment activated, save the code above as tool_use.py, then run:

python tool_use.py