Hello, voice

Before we talk about handoffs, you need a single agent that works. A LiveKit voice agent is a composition of speech-to-text, a language model, text-to-speech, and voice activity detection. Wire them once and the rest of the course builds on top.

The voice agent pipeline

How audio becomes a response, turn by turn.

triage_agent.py
python
from livekit.agents.voice import Agent, AgentSession
from livekit.plugins import deepgram, silero
from utils.livekit_utils import get_livekit_llm

class HelloAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a friendly voice assistant. Keep replies short and natural.",
            stt=deepgram.STT(),
            llm=get_livekit_llm(),
            tts=deepgram.TTS(model="aura-asteria-en"),
            vad=silero.VAD.load(),
        )

Every voice agent is a subclass of Agent with the audio plugins wired in. Instructions are the system prompt. The plugins handle the audio pipeline so your code only deals with turns.

Voice activity detection decides when the caller has finished speaking so the agent can take its turn. STT transcribes whatever it hears, but without VAD the agent either interrupts constantly or waits forever. Silero runs locally and is fast enough to keep turn-taking natural.

Quiz: Quiz

Loading practice…