is there an example of multiagent and letting llm ...
# ask-ai
r
is there an example of multiagent and letting llm decide which agent to transfer to?
t
Thanks for reaching out, Weilan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes, there are examples of multi-agent systems where an LLM decides which agent to transfer to. Here are some key examples: • Medical Office Triage System: A TriageAgent determines patient needs and routes them to appropriate departments, such as support or billing, using function tools to make transfer decisions. • Publishing House Editor System: A LeadEditorAgent analyzes story ideas and decides which specialist editor (e.g., children’s books or novels) to transfer to based on the content provided. • Personal Shopper System: A TriageAgent routes customers to teams like sales based on their identified needs and user data. The core mechanism involves function tools that allow the LLM to analyze the conversation context and user intent, then intelligently call the appropriate transfer function to route to the most suitable specialized agent. This approach ensures decisions are made dynamically based on the conversation content rather than simple rule-based routing. If you need further details or specific implementation examples, let me know! Sources: telephony/warm_handoff.py | main.py | Workflows | LiveKit Docs
d
give us a code example
t
Here’s a handy code example from a Medical Office Triage System where a TriageAgent helps guide users to the right department based on what they need:
Copy code
from livekit import function_tool

class TriageAgent:
    @function_tool
    async def transfer_to_support(self, context):
        await self.session.say("I'll transfer you to our Patient Support team...")
        return await self._transfer_to_agent("support", context)

    @function_tool
    async def transfer_to_billing(self, context):
        await self.session.say("I'll transfer you to our Medical Billing department...")
        return await self._transfer_to_agent("billing", context)
In this example, the LLM uses function tools to figure out whether to connect the user with support or billing, depending on the conversation. If you'd like a different example or want me to walk you through it in more detail, just let me know—I’m here to help!