prehistoric-printer-73777
08/27/2025, 3:24 PMtall-airline-16756
08/27/2025, 3:24 PMtall-airline-16756
08/27/2025, 3:25 PMlivekit-agents does support multi-agent functionality, which means agents can smoothly hand off control to each other during a session. This happens through function_tool-decorated methods or by using the update_agent method if you want to manage it programmatically.
Here’s a simple example to show how one agent can hand off to another:
@function_tool
async def information_gathered(self, context: RunContext[StoryData], name: str, location: str):
context.userdata.name = name
context.userdata.location = location
story_agent = StoryAgent(name, location)
return story_agent, "Let's start the story!"
In this snippet, the current agent gathers some user info, then passes control to a StoryAgent to keep the session going. The framework takes care of switching control automatically.
If you prefer, you can also use the update_agent method to switch agents directly like this:
self.session.update_agent(LongAgent())
Feel free to ask if you want me to walk you through more examples or if there’s anything else you’d like to know!
Sources: Workflows | LiveKit Docs | livekit-agents/livekit/agents/voice/run_result.py | complex-agents/medical_office_triage/triage.py | Workflows | LiveKit Docs | Building Multi-Agent Architectures with LiveKit Agentsprehistoric-printer-73777
08/27/2025, 3:26 PMtall-airline-16756
08/27/2025, 3:27 PMlivekit-agents can have its own unique TTS, LLM, and system prompt by setting these up individually in the agent's class constructor. Here's a simple way to do it:
1. Define System Prompt (Instructions):
class IntroAgent(Agent):
def __init__(self):
super().__init__(
instructions="Your name is Echo. You are a storyteller... gather a few pieces of information from the user..."
)
2. Configure LLM per Agent:
llm = openai.LLM(model="gpt-4o-mini")
3. Configure TTS per Agent:
tts = openai.TTS(voice="ash")
4. Combine All in a Custom Agent Class:
class TriageAgent(Agent):
def __init__(self):
super().__init__(
instructions="You are a triage assistant...",
stt=deepgram.STT(),
llm=openai.LLM(model="gpt-4o-mini"),
tts=cartesia.TTS(),
vad=silero.VAD.load()
)
So, each agent can really have its own special setup for how it behaves, sounds, and thinks. If you want, I’m here to help with more examples or any questions you have!
Sources: examples/voice_agents/mcp/mcp-agent.py | Building voice agents | LiveKit Docs | Realtime model integrations | LiveKit Docs | Gemini Live API integration guide | LiveKit Docs