wide-dress-57902
08/20/2025, 1:03 AMtall-airline-16756
08/20/2025, 1:03 AMtall-airline-16756
08/20/2025, 1:03 AMRoom
. Think of a Room
as the cozy space where everyone comes together to interact live. You can create sessions manually through a server API, or they can start automatically as soon as the first participant joins. The session wraps up when the last person leaves, and the room closes shortly after.
Session events are like little updates that happen throughout the session’s life. Here’s what they include:
• ParticipantUpdate: Happens when there’s a change in participant info.
• Data: Fired off when someone sends data.
• ChatMessage: Sent when a participant shares a chat message.
• SpeakersChanged: Shows when the list of active speakers changes.
• ConnectionQuality: Lets you know if a participant’s connection quality shifts.
• RoomUpdate and RoomMoved: Triggered when room details change or participants move between rooms.
• Close: Sent when the session ends, including why it ended.
On top of that, LiveKit also supports agent-related events like session.created
and session.updated
to help manage real-time AI interactions smoothly.
Sources: Core API primitives | LiveKit Docs | livekit/src/rtc_engine/rtc_session.rs | SessionCreatedEvent | LiveKit Agents | plugins/openai/src/realtime/api_proto.tswide-dress-57902
08/20/2025, 1:06 AMtall-airline-16756
08/20/2025, 1:06 AMuser_state_changed
event in LiveKit. It’s triggered by the AgentSession
whenever your state changes during a chat. This change is picked up by the Voice Activity Detection (VAD) module, which listens to your audio input.
When this event happens, it comes with a UserStateChangedEvent
object that has these handy details:
• old_state: What your state was before.
• new_state: What your state is now.
• created_at: The exact time this event was recorded.
Here’s what the different states mean:
• speaking: You’ve started talking (VAD noticed!).
• listening: You’ve stopped speaking.
• away: You haven’t responded for a bit (usually 15 seconds, but you can tweak this with the user_away_timeout
setting).
Just so you know, this event combines what used to be two separate ones—`user_started_speaking` and `user_stopped_speaking`—into one neat state change event in LiveKit Agents v1.0. It’s super useful for keeping an eye on how the conversation’s flowing, spotting when someone’s inactive, and helping agents respond just right based on what you’re doing.
Sources: Events and error handling | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.py | Agents v0.x migration guide | LiveKit Docs | Agents 0.x migration guide | LiveKit Docs | Turn detection and interruptions | LiveKit Docs