Skip to main content

Multi-agent hand-off

A triage agent answers first, then hands the conversation to an expert, using chain routing.

This example: a payments support line. A fast triage agent sorts out what went wrong, then a payments expert takes over and resolves it.

Example (replies vary)
You: A payment has been stuck as pending for two days.

→ triage: "Issue: stuck payment. Status: pending 48h.
Likely cause: bank verification hold."
→ payments_expert: picks up the triage notes and answers

Agent: Payments pending for more than 24 hours are usually held for
bank verification. Here's what to do:
1. Check your bank app for a verification request.
2. ...

handoff_path: ["triage", "payments_expert"]
from custodian_labs import Custodian, CustodianSquad

squad = CustodianSquad(
custodians=[
Custodian(
name="triage",
model="gpt-6-luna",
system_prompt="Classify the payment issue and summarize the key facts for the expert.",
topics=["billing", "support", "payment"],
can_handoff_to=["payments_expert"],
),
Custodian(
name="payments_expert",
model="gpt-6-luna",
system_prompt="Using the triage notes, resolve the payment issue step by step.",
),
],
routing_mode="chain",
max_handoffs=3,
)

reply = squad.deploy().chat("A payment has been stuck as pending for two days.")
print(reply.handoff_path) # ['triage', 'payments_expert']
print(reply.response)
Learn more