Lab build

Real-time voice agent on LiveKit

Voice assistant chaining speech-to-text, GPT-4o and ElevenLabs speech, with per-stage latency metrics.

Role
Builder, end to end
Group
Agents and MCP
Services
AI & LLM systems

What it does

A LiveKit Agents worker joins a room and runs a voice pipeline: Silero voice activity detection, OpenAI speech-to-text, GPT-4o for responses and ElevenLabs text-to-speech. A metrics variant subscribes to LLM, STT, end-of-utterance and TTS events and prints token counts, tokens per second, time to first token and durations for latency tuning.

What was built

  1. 01

    Assistant agent combines Silero VAD, OpenAI STT (whisper-1), GPT-4o and ElevenLabs TTS in one AgentSession.

  2. 02

    Entrypoint connects to the LiveKit room and starts the session for each job.

  3. 03

    LLM metrics handler logs prompt and completion tokens, tokens per second and time to first token.

  4. 04

    STT, end-of-utterance and TTS metrics are captured to locate latency in the pipeline.

  5. 05

    ElevenLabs voice IDs can be swapped to change the agent's voice.

The pipeline, layer by layer

Five layers, one pipeline.

  1. L1Transport

    • LiveKit room
  2. L2Speech in

    • Silero VAD
    • Whisper STT
  3. L3Reasoning

    • GPT-4o agent session
  4. L4Speech out

    • ElevenLabs TTS
  5. L5Observability

    • Latency metrics handlers

Stack

  • LiveKit Agents
  • OpenAI GPT-4o
  • OpenAI Whisper
  • ElevenLabs
  • Silero VAD
  • asyncio
  • Jupyter

Next lab build · 30 / 46

Autonomous trading floor on MCP

Four autonomous trader agents research markets and manage simulated accounts through MCP servers on a schedule.

Previous: Transaction monitoring dashboard in Grafana

Need a system like this in production? Tell us about it.