docs
Team
A Team is a group of agents with an LLM router that analyzes each message and picks the best agent to handle it, acting as a smart dispatcher.
Creating a team
Python
from ninetrix import Ninetrix
ntx = Ninetrix(provider="anthropic", model="claude-sonnet-4-6")
coder = ntx.agent(
name="coder",
instructions="Write clean, tested Python code.",
tools=[run_python, write_file],
)
reviewer = ntx.agent(
name="reviewer",
instructions="Review code for bugs, security issues, and style.",
tools=[read_file, run_linter],
)
docs_writer = ntx.agent(
name="docs-writer",
instructions="Write clear API documentation and README files.",
tools=[read_file, write_file],
)
team = ntx.team(
name="engineering-team",
agents=[coder, reviewer, docs_writer],
# Optional: use a cheap model for routing
router_model="claude-haiku-4-5-20251001",
)
Running the team
Python
# The router picks the best agent
result = team.run("Write a function that validates email addresses")
print(result.output) # Code from the coder agent
print(result.routed_to) # "coder"
result = team.run("Review this PR for security issues")
print(result.routed_to) # "reviewer"
result = team.run("Update the README with the new API endpoints")
print(result.routed_to) # "docs-writer"
# Async version
result = await team.arun("Write tests for the email validator")
How routing works
- The router LLM receives the message plus each agent's name and instructions
- It picks the best agent based on the message content
- The selected agent runs with the full message
- The result includes
routed_toso you know which agent handled it
Cost optimization
Set
router_model to a fast, cheap model (Haiku, Gemini Flash). The router only reads agent descriptions and the message — it doesn't need a powerful model.