witty-yak-62929
10/30/2025, 11:54 AMtall-airline-16756
10/30/2025, 11:54 AMtall-airline-16756
10/30/2025, 11:54 AMTranscriptionReceived event, you can rely on the firstReceivedTime and startTime properties from the TranscriptionSegment object. By finding the difference between these two, you'll get the end-to-end transcription latency.
Here's a simple way to approach it:
• Use the useTranscriber hook to listen for the RoomEvent.TranscriptionReceived event and keep track of transcription segments.
• For each final transcription segment, calculate the latency as firstReceivedTime - startTime.
Just make sure that both firstReceivedTime and startTime are defined, and use the .final flag to avoid calculating too early. If you'd like, I’m here to help with more details or some example code!
Sources: hooks/useDataStreamTranscriptions.ts | Text and transcriptions | LiveKit Docs | livekit-android-test/src/test/java/io/livekit/android/room/RoomTranscriptio... | Live Conversations with AI using ChatGPT and WebRTC | Network Quality & Bandwidth Management | livekit/livekit_composite | DeepWi...witty-yak-62929
10/30/2025, 11:57 AMtall-airline-16756
10/30/2025, 11:58 AMTranscriptionReceived event and React SDK don’t directly measure the true end-to-end audio latency because they only show the timestamp when the transcription reaches the client, not the entire timeline from audio input to agent response.
To get a more accurate picture of end-to-end latency, LiveKit offers backend metrics like EOUMetrics (End-of-Utterance Metrics). These include:
• Transcription Delay: The time it takes to finish transcribing after the user stops speaking.
• End-of-Utterance Delay: The time between when the user finishes speaking and when the agent decides to end their turn.
These metrics are automatically generated during the agent’s operation and you can access them through the backend agent SDK. If you'd like, I’m here to help you set up or walk you through using these metrics—just let me know!
Sources: Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | agents/src/voice/audio_recognition.ts | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik... | livekit-agents/livekit/agents/voice/audio_recognition.py | Logs, metrics, and telemetry | LiveKit Docswitty-yak-62929
10/30/2025, 12:02 PMtall-airline-16756
10/30/2025, 12:02 PMMetricsReport.e2e_latency field. This metric captures the total latency from user input to the agent’s output. Plus, LiveKit’s OpenTelemetry integration is a great tool to get trace-based observability, helping you analyze the full conversation latency across every component.
If you’d like, I’m here to help you set up these metrics or show you how to combine them for a complete monitoring solution—just let me know!
Sources: Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Logs, metrics, and telemetry | LiveKit Docs | livekit/livekit_metrics.pb.gowitty-yak-62929
10/30/2025, 12:08 PMtall-airline-16756
10/30/2025, 12:09 PMe2e_latency field from the MetricsReport in LiveKit. Here's a simple example in Python that you might find useful:
Python Example:
from livekit.agents import AgentSession, MetricsCollectedEvent
# Set up event listener for metrics
def on_metrics_collected(event: MetricsCollectedEvent):
metrics = event.metrics
# Check if this is a metrics report with e2e_latency
if hasattr(metrics, 'e2e_latency') and metrics.e2e_latency is not None:
print(f"End-to-end latency: {metrics.e2e_latency:.4f} seconds")
# Register the event listener
session = AgentSession()
session.on("metrics_collected", on_metrics_collected)
This snippet listens for the metrics_collected event and pulls out the e2e_latency value, which tells you the total latency from user input all the way to the agent's response. If you'd like, I’m here to provide more examples or help you with another programming language—just let me know!
Sources: livekit/livekit_metrics.pb.go | Logs, metrics, and telemetry | LiveKit Docs