Hand a task across

Specialists

A handoff lets a front-desk or triage agent delegate a conversation to a specialist agent when a request requires domain expertise (such as billing or technical support). Define the specialist agents first, then pass them in handoffs=[…].

A handoff lets one agent pass the conversation to a specialist.

Build the specialists first. Pass those agent objects in handoffs.

Example

from praisonai import Agent

tech = Agent(
    name="TechnicalSupport",
    instructions="You are a technical support specialist.",
)
billing = Agent(
    name="Billing",
    instructions="You are a billing specialist.",
)
desk = Agent(
    name="CustomerService",
    instructions="For technical issues, hand off to TechnicalSupport.",
    handoffs=[tech, billing],
)
print(desk.chat("I cannot install the software"))

Try it Yourself

Example explained

  • handoffs — A list of agent objects, not their names.

Billing handoff

Route a non-technical billing question. Edit the message to force billing on your machine.

Expected output: the triage agent routes the billing question to the billing specialist, which returns the domain-specific answer.

Example

from praisonai import Agent

tech = Agent(name="TechnicalSupport", instructions="You fix installs.")
billing = Agent(name="Billing", instructions="You answer invoice questions briefly.")
desk = Agent(
    name="CustomerService",
    instructions="Hand off billing to Billing and technical issues to TechnicalSupport.",
    handoffs=[tech, billing],
)
print(desk.chat("My invoice shows the wrong plan"))

Try it Yourself

Example explained

  • from praisonai import Agent — Imports Agent needed for billing handoff.
  • Agent(…) — Instantiates the Agent configured for billing handoff.
  • .chat(…) — Executes the configured run for billing handoff and returns the result.

Reference: documentation