Can I let multiple agents speak with each other an...
# ask-ai
t
Can I let multiple agents speak with each other and another user in a single session?
t
Thanks for reaching out, Tim. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes, multiple agents and a user can communicate in a single session in LiveKit. This is supported through the following mechanisms: • Multi-Agent Workflows: LiveKit allows workflows where multiple agents can operate within a single session. Agents can invoke tasks or hand off control to other agents, enabling multiple personas with unique traits to interact in the same session. • Agent Handoff: Agents can hand off control to another agent during a session. For example, an introductory agent can gather information and then pass control to another agent to continue the conversation. • Multiple Agent Dispatch: You can dispatch multiple agents to a single room by including multiple
RoomAgentDispatch
entries in the
RoomConfiguration
. • Communication Architecture: LiveKit's room concept acts as a bridge between participants, allowing agents and users to communicate using LiveKit WebRTC. Each participant in the room can be a user or an agent. This architecture supports complex scenarios, such as multi-user transcription or workflows involving multiple AI personas interacting with users in the same session. Sources: LiveKit Docs | Workflows | LiveKit Docs | examples/other/transcription/multi-user-transcriber.py | Agent dispatch | LiveKit Docs | LiveKit Docs
t
I'm looking specifically to have multiple distinct agents in a session instanstaneously; i.e. it could be two agents having a conversation with the user stepping in. Is there a ref for this somewhere?
t
Hey there! I totally get what you're looking for, and I'm excited to share how LiveKit makes multi-agent interactions super flexible. Think of it like having a team of helpful friends ready to jump in and assist you. • Agent Handoff: Imagine one agent smoothly passing the conversation to another, kind of like tag-teaming to give you the best possible help. Maybe a friendly intro agent hands off to a storytelling expert who can dive deeper into your specific needs. • Dynamic Agent Switching: With
session.update_agent()
, we can switch agents mid-conversation as easily as changing channels. It's all about making sure you get exactly the right support at the right moment. • Multi-Agent Transfer System: This is where it gets really cool - we can create a seamless flow where specialized agents work together. Picture a support journey where you're smoothly guided from initial triage to specific solutions, all without missing a beat. • Multiple Agent Sessions: Need different agents for different people? No problem! We can set up individual agent sessions, just like in our multi-user transcriber example where everyone gets personalized attention. The best part? Each agent can be totally unique - with their own instructions, speech recognition, language models, and more. It's like having a team of specialists ready to help you out. Curious to know more? I'd love to walk you through some specific examples or code snippets. Just say the word! Sources: README.md | complex-agents/medical_office_triage/README.md | Workflows | LiveKit Docs | README.md
t
Hey there! Thanks so much for sharing that awesome example. I totally see how that role-playing scenario really highlights how different agents can work together seamlessly. It's a perfect illustration of how agents can chat and collaborate in such a natural, dynamic way - exactly what you're looking to achieve! Got any specific questions or want to dive deeper into how we can make this work for you? I'm all ears and happy to help you figure this out!