nice-room-70150
09/23/2025, 3:36 AMtall-airline-16756
09/23/2025, 3:37 AMtall-airline-16756
09/23/2025, 3:37 AMnice-room-70150
09/23/2025, 3:38 AMtall-airline-16756
09/23/2025, 3:38 AMVADEvent with the type VADEventType.START_OF_SPEECH when it detects speech.
• You can listen for these events in your agent and handle them with the on_start_of_speech method.
from livekit.agents.vad import VADEventType
async def process_vad():
async for vad_event in agent.vad_stream:
if vad_event.type == VADEventType.START_OF_SPEECH:
print("User started speaking")
2. Using STT Engines:
• Some STT engines, like Deepgram, Azure, or Google Cloud, also emit START_OF_SPEECH events when speech is detected.
• This can be a helpful fallback if VAD isn’t available or isn’t working perfectly for your needs.
3. Session-Level Events:
• LiveKit agents also provide higher-level session events, such as user_started_speaking, which you can subscribe to for managing state or logging.
@session.on("user_started_speaking")
def on_user_speak():
print("User began speaking")
If you’d like, I’m here to help with more examples or to walk you through your specific use case—just let me know!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | agents/src/vad.ts | home_assistant/homeautomation.py