Hello everyone, I'm currently developing an AI voi...
# ask-ai
b
Hello everyone, I'm currently developing an AI voice agent for my app I'm trying to figure out a way to toggle between push to talk and hands free mode in my app I have both the features developed, but im having a hard time toggling between them within the same AgentSession • push-to-talk is developed in a way where AgentSession.turn_detection = "manual" • handsfree mode is developed in a way where AgentSession.turn_detection = MultilingualModel() The problem i'm facing is that a AgentSession, or an Agent's turn_detection cannot be changed once it's initialized. Is there a way i can update the turn_detection?
t
Thanks for reaching out, YJ. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! I wanted to let you know that the
turn_detection
setting in an
AgentSession
can’t be changed once the session is initialized, as it’s a read-only property that needs to be set up right when you create the session. If you’re looking to switch between push-to-talk and hands-free modes, the best approach is to create separate
AgentSession
instances for each mode. Another option is to consider using independent components like
SpeechStream
or
RealtimeModelBeta
, which do allow you to update turn detection options on the fly, though they aren’t directly connected to
AgentSession
. Please feel free to reach out if you’d like me to walk you through examples or help with anything else—I’m here to help! Sources: livekit-plugins/livekit-plugins-turn-detector/README.md | examples/src/realtime_turn_detector.ts