billowy-analyst-47555
07/24/2025, 8:45 PMtall-airline-16756
07/24/2025, 8:45 PMtall-airline-16756
07/24/2025, 8:46 PMsession.update_agent(). For example, you can define multiple agent classes (e.g., ShortAgent and LongAgent) and switch between them as needed. Here's an example: class ShortAgent(Agent):
@function_tool
async def change_agent(self):
"""Change the agent to the long agent."""
self.session.update_agent(LongAgent())
class LongAgent(Agent):
@function_tool
async def change_agent(self):
"""Change the agent to the short agent."""
self.session.update_agent(ShortAgent())
• Single Worker, Multiple Agents: The LiveKit Agents framework allows a single worker to host multiple agent instances simultaneously. Each agent runs in its own process for isolation, but all agent logic can be contained within the same codebase and worker process. This enables seamless switching between agents without requiring separate backend processes for each agent type.
This approach provides flexibility and efficiency, as all agent logic can be managed within a single deployable worker while dynamically creating and switching between different agent personalities or capabilities based on user interaction.
Sources: Agents Overview | LiveKit Docs | complex-agents/medical_office_triage/triage.py | Anatomy of an Agent | LiveKit Docstall-airline-16756
07/29/2025, 7:02 PM