Skip to content

[Suggestion] Voice agent latency profiling: measure and optimize TTFB across STT, LLM, and TTS (Python) #551

Description

@deepgram-robot

What to build

A recipe that instruments a Deepgram Voice Agent pipeline to measure and display per-component latency — time-to-first-byte for STT, LLM inference, and TTS — enabling developers to identify bottlenecks and optimize end-to-end response time.

Why this matters

Voice agent latency directly impacts user experience — delays over 500ms feel unnatural and erode trust. Developers building production voice agents need visibility into where time is spent across the STT → LLM → TTS pipeline to make informed optimization decisions (model selection, endpoint configuration, audio buffer sizes). This recipe provides a reusable profiling pattern that works with Deepgram's Voice Agent API, helping developers achieve sub-second total response times.

Suggested scope

  • Language: Python
  • Deepgram APIs: Voice Agent API (WebSocket), STT (Nova-3), TTS (Aura)
  • What it should include:
    • Timestamped event logging for each pipeline stage (user speech end → STT final → LLM first token → TTS first audio byte → audio playback start)
    • Per-turn latency breakdown displayed in terminal
    • Rolling average and P95 latency statistics
    • Comparison mode: run the same conversation with different models/configurations and compare latency profiles
    • Export latency data as CSV or JSON for further analysis
  • Complexity: Medium

Acceptance criteria

  • Runnable with minimal setup (clone, add API key, run)
  • README explains the latency measurement methodology
  • Uses current SDK version
  • Accurately measures per-component TTFB (not just total round-trip)
  • Displays actionable latency breakdown per conversation turn

Raised by the DX intelligence system.


Queued by PM — Engineer will pick this up as a priority:user recipe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    action:generateQueue action: generate code examplespriority:userUser-submitted request — prioritizetype:queueIssue is in the automation queue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions