Router
Classify input → dispatch to one specialist Agent. OpenAI Agents
SDK March 2026 “Handoff” pattern, plus the classify-and-route shape
every framework reinvents (CrewAI sequential, LangGraph conditional
edges).
┌── refund_agent
prompt ──► classifier ──► technical_agent ◄── only ONE
└── faq_agent ◄── chosen runs
1 classifier call + 1 specialist run.Pattern
- Classify. A small fast LLM call decides which route handles the input best.
- Dispatch. The chosen specialist
Agentruns to completion with its own model / memory / tools / architecture. - Return. The specialist’s output becomes the Router’s output. No cross-specialist synthesis.
Compared to Supervisor
- Cheaper. 1 Classification + 1 specialist; no synthesis pass.
- Deterministic. Single specialist owns the task end-to-end.
- Less flexible. No multi-domain tasks; routing errors cascade.
Usage
from loomflow import Agent
from loomflow.architecture import RouterRoute
from loomflow.team import Team
billing = Agent("Handle billing questions.", model="claude-opus-4-7", tools=[...])
tech = Agent("Handle technical questions.", model="claude-opus-4-7", tools=[...])
sales = Agent("Handle sales questions.", model="claude-opus-4-7")
team = Team.router(
routes=[
RouterRoute(name="billing", agent=billing,
description="Charges, refunds, invoicing, plan changes."),
RouterRoute(name="tech", agent=tech,
description="Errors, debugging, integration help."),
RouterRoute(name="sales", agent=sales,
description="Pricing, demos, contracts, partnerships."),
],
instructions="You are the customer support entry point.",
model="claude-haiku-4-5", # small fast classifier
)
result = await team.run("My credit card was charged twice.")
# Routed to billing.When to use
- Customer support. Route to billing / tech / sales / general.
- Coding agent gateway. Route to language-specific specialists.
- Search front-end. Route between retrieval strategies.
The classifier is the cost knob. Use a small fast model (Haiku, gpt-4o-mini) for the classifier and reserve the big model for specialists.
RouterRoute descriptions are the prompt. The classifier sees each
route’s name + description; the description is what makes routing
correct or wrong. Be specific about what each route handles AND what
it doesn’t (e.g. “Handle billing. NOT refunds, those go to support”).
Last updated on