lively-lawyer-41553
10/17/2025, 4:10 AMon_enter function is hit or before transferring to the next agent?
For example I wanted to change the stt model for an agent to
session.stt = google.STT(
model="telephony",
spoken_punctuation=False,
credentials_info=json.loads(GOOGLE_APPLICATION_CREDENTIALS),
)
but I got this error:
AttributeError: property 'stt' of 'AgentSession' object has no settertall-airline-16756
10/17/2025, 4:10 AMtall-airline-16756
10/17/2025, 4:11 AMsession.stt, vad, min_interruption_duration, and min_interruption_words dynamically during a session isn’t supported just yet. These settings are part of the VoiceOptions dataclass and need to be set right when you initialize the AgentSession.
Here’s a little example to help you see how to set them up during session creation:
session = AgentSession(
stt=your_stt_instance, # Cannot be changed later
vad=your_vad_instance, # Cannot be changed later
min_interruption_duration=0.5, # Cannot be changed later
min_interruption_words=0, # Cannot be changed later
min_endpointing_delay=0.5, # CAN be updated with update_options()
max_endpointing_delay=3.0, # CAN be updated with update_options()
)
It’s good to know that some parameters like min_endpointing_delay and max_endpointing_delay can be updated on the fly using session.update_options(). However, for the ones you mentioned, if you need to change them, you’ll have to recreate the session.
If you’d like to share a bit more about what you’re trying to achieve, I’d be happy to help brainstorm some alternative solutions—maybe something like agent replacement or session recreation—that could work well for your needs.
Sources: livekit-agents/livekit/agents/voice/agent_activity.py