@session.on("user_state_changed") def _user_st...
# ask-ai
h
@session.on("user_state_changed") def _user_state_changed(ev: UserStateChangedEvent): nonlocal inactivity_task if ev.new_state == "away": Does the stage change when the user sends text input instead of voice input?
t
Thanks for reaching out, James. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thank you for reaching out! Could you please help me understand a bit more about what you mean by "stage" here? Are you talking about something custom you've set up in your application, or are you wondering about a particular state change event in LiveKit when text input is sent instead of voice? I'm here to help, so any extra details you can share would be great! Sources: livekit-agents/livekit/agents/voice/agent_session.py | Text and transcriptions | LiveKit Docs | agents/src/voice/room_io/room_io.ts | Agents v0.x migration guide - Python | LiveKit Docs
h
I meant user state which changes based on user_away_timeout inside AgentSession.
t
Thank you for your question! The
user_away_timeout
in
AgentSession
is designed to keep an eye on silence in audio streams to check if a user might be away. It works by using voice activity detection (VAD) and audio input, so if you're sending text input, it won't impact the
user_away_timeout
or switch the status to "away." Text input is handled separately and doesn’t influence the audio-based user state. If anything is unclear or you’d like to dive deeper, please don’t hesitate to reach out—I’m here to help! Sources: Events and error handling | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.py | Text and transcriptions | LiveKit Docs