Skip to main content

Multi-agent router

Several specialist agents behind one app. Each message goes to the best match, using single routing.

This example: a customer support desk with two specialists. Billing handles charges and refunds. Product answers how-to questions from the product guide.

Example (replies vary)
You: I was charged twice this month.
→ selected_agent: billing
Agent: Sorry about that. A duplicate charge is usually a pending
authorisation that drops off in 3–5 days. If both charges have
settled, reply with the invoice numbers and I'll start a refund.

You: How do I set up the Slack integration?
→ selected_agent: product
Agent: Go to Settings → Integrations → Slack, click Connect, and ...
from custodian_labs import Custodian, CustodianSquad

squad = CustodianSquad(
custodians=[
Custodian(
name="billing",
model="gpt-6-luna",
system_prompt="You answer billing, invoice and refund questions.",
topics=["billing", "charge", "invoice", "refund", "payment"],
),
Custodian(
name="product",
model="gpt-6-luna",
system_prompt="You answer product questions from the product guide.",
topics=["feature", "setup", "how to", "integration"],
).add_data_source_file("./product-guide.pdf"),
],
routing_mode="single",
)

app = squad.deploy()
reply = app.chat("I was charged twice this month.")
print(reply.selected_agent, "→", reply.response) # billing → ...
Learn more