Skip to content

Feature Request: Add utterance_end_latency to STTMetrics for streaming STT #5063

Description

@kimdwkimdw

Feature Type

Would make my life easier

Feature Description

Problem

The current STTMetrics provides audio_duration, duration, and streamed, but the duration field is always 0 for streaming STT as documented:

duration — For non-streaming STT, the amount of time (seconds) it took to create the transcript. Always 0 for streaming STT.

This means there is no responsiveness metric for streaming STT in the current metrics system. Every other pipeline component has one:

Component Responsiveness Metric
LLM ttft (Time to First Token)
TTS ttfb (Time to First Byte)
EOU end_of_utterance_delay
STT (streaming) ❌ None

For operators running production voice agents, this gap makes it impossible to:

  • Monitor streaming STT engine performance over time
  • Compare different STT providers (e.g., Deepgram vs. Google vs. AssemblyAI) under the same pipeline conditions
  • Alert on STT latency regressions
  • Attribute end-to-end latency to specific pipeline stages

Proposed Solution

Add a new field utterance_end_latency to STTMetrics, defined as:

The wall-clock delay from the end of user speech (VAD END_OF_SPEECH) to the arrival of the final transcript (FINAL_TRANSCRIPT).

This is conceptually identical to TTFS (Time To Final Segment) — an industry metric introduced by Pipecat for benchmarking streaming STT in real-time voice agent applications. TTFS has become the de facto standard for evaluating streaming STT responsiveness, with benchmark results published across major providers.

Why utterance_end_latency (TTFS) matters

In a voice agent pipeline, the end-to-end response latency is roughly:

total_latency ≈ STT_latency + eou.end_of_utterance_delay + llm.ttft + tts.ttfb

Today, STT_latency for streaming mode is a black box — it cannot be measured through STTMetrics. Adding utterance_end_latency closes this observability gap and gives operators the full picture.

Workarounds / Alternatives

Implementation

A draft implementation is available in PR #4966:

👉 #4966

Summary of changes

  • Adds utterance_end_latency (type: float, default: 0) to the STTMetrics dataclass
  • Records _end_of_speech_time on SpeechEventType.END_OF_SPEECH in SpeechHandle
  • Computes latency on SpeechEventType.FINAL_TRANSCRIPT as time.time() - _end_of_speech_time
  • Emits the value via the existing metrics_collected event — no new events or APIs required
  • Fully backward-compatible: the field defaults to 0 and only populates when both events occur

Example output

STT utterance_end_latency=0.342s  (provider=deepgram, model=nova-3, streamed=true)

Additional Context

Related Issues

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions