Skip to content

feat(core): add user transcription timeout - #6182

Merged
chenghao-mou merged 13 commits into
mainfrom
chenghao/feat/stt-transcription-timeout-AGT-3024
Aug 2, 2026
Merged

feat(core): add user transcription timeout#6182
chenghao-mou merged 13 commits into
mainfrom
chenghao/feat/stt-transcription-timeout-AGT-3024

Conversation

@chenghao-mou

Copy link
Copy Markdown
Member
  • add a new event when vad detects any speech, but stt fails to produce any transcript during that timeout
from livekit.agents import AgentSession, UserTranscriptionTimeoutEvent

  session = AgentSession(
      stt=...,
      llm=...,
      tts=...,
      # VAD heard speech but no transcript landed within 5s of the user stopping.
      # 5.0 is the default; set to None to disable.
      transcription_timeout=5.0,
  )

  @session.on("user_transcription_timeout")
  def _on_transcription_timeout(ev: UserTranscriptionTimeoutEvent) -> None:
      # ev.speech_duration   -> total VAD speech (s) this turn that produced no transcript
      # ev.vad_speech_started_at -> when the user first started speaking (epoch seconds)

      # ignore very short blips (coughs, door slams) that VAD picks up as "speech"
      if ev.speech_duration < 0.7:
          return

      session.generate_reply(
          instructions="Tell the user you didn't catch that and ask them to repeat it.",
      )

@chenghao-mou
chenghao-mou requested a review from a team as a code owner June 22, 2026 13:36
devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread livekit-agents/livekit/agents/voice/audio_recognition.py Outdated
@davidzhao

Copy link
Copy Markdown
Member

should we have a default handler with the above implementation? any downsides of having this work automatically?

@longcw

longcw commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

should we have a default handler with the above implementation? any downsides of having this work automatically?

I am wondering how many false alarms it may have, it can by risky if there are some background noise.

@chenghao-mou
chenghao-mou force-pushed the chenghao/feat/stt-transcription-timeout-AGT-3024 branch from ce6b32c to 9f45ae6 Compare July 28, 2026 10:10
devin-ai-integration[bot]

This comment was marked as resolved.

@chenghao-mou
chenghao-mou requested a review from a team July 28, 2026 14:11
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@chenghao-mou
chenghao-mou merged commit 0ec083f into main Aug 2, 2026
23 checks passed
@chenghao-mou
chenghao-mou deleted the chenghao/feat/stt-transcription-timeout-AGT-3024 branch August 2, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants