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 ...
- Python
- TypeScript
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 → ...
import { Agent, AgentTeam } from "@custodianlabs/sdk";
const team = new AgentTeam({
agents: [
new Agent({
name: "billing",
model: "gpt-6-luna",
systemPrompt: "You answer billing, invoice and refund questions.",
topics: ["billing", "charge", "invoice", "refund", "payment"],
}),
new Agent({
name: "product",
model: "gpt-6-luna",
systemPrompt: "You answer product questions from the product guide.",
topics: ["feature", "setup", "how to", "integration"],
}).addDataSourceFile("./product-guide.pdf"),
],
routingMode: "single",
});
const app = await team.deploy();
const reply = await app.chat("I was charged twice this month.");
console.log(reply?.selectedAgent, "→", reply?.response); // billing → ...
Learn more
- Multi-agent routing: how agents are picked, how to choose
topics, and when to use each mode.