Async Basic Agent
Run a Nexus agent asynchronously with aprint_response.
Code
import asyncio
from agno.agent import Agent
from agno.models.nexus import Nexus
agent = Agent(model=Nexus(id="anthropic/claude-sonnet-4-6"), markdown=True)
asyncio.run(agent.aprint_response("Share a 2 sentence horror story"))
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openaiConfigure 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"
nexusLeave 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 basic.py, then run:
python basic.py