refined-hydrogen-81988
10/23/2025, 2:57 PMtall-airline-16756
10/23/2025, 2:57 PMtall-airline-16756
10/23/2025, 2:58 PMAgentSession.update_agent() method. This handy feature lets you smoothly hand off between agents while keeping the session context intact. Here are a few examples to guide you:
• Long or Short Agent: You can switch between agents with different speaking styles using a function tool. For example, the ShortAgent can call self.session.update_agent(LongAgent()) to switch over to LongAgent.
• Personal Shopper: Depending on what the user needs—whether it's sales, returns, or triage—you can transfer control between agents. The _transfer_to_agent method helps update the session with the new agent seamlessly.
• TTS Provider Comparison: If you want to switch between Text-to-Speech providers like Rime or ElevenLabs during a session, each provider has its own agent class, and users can request to switch as needed.
If you want to dive deeper and see detailed examples, feel free to check out the python-agents-examples repository on GitHub. It’s a great resource to help you get started!
Sources: Workflows | LiveKit Docs | pipeline-tts/changing_language/README.md