Basic Voice Agent
Build a voice agent with LiveKit Agents using VoiceGateway to route STT, LLM, and TTS requests.Prerequisites
Configuration
Createvoicegw.yaml in your project root:
Basic Usage
LiveKit Agent Integration
Multiple agents in one process
When one process serves multiple agents (e.g., one worker handling several entrypoints), set the active project per call context:Checking Costs
Monitoring Latency
VoiceGateway automatically records TTFB and total latency for every request. View these metrics through the dashboard or the HTTP API:latency.ttfb_warning_ms config value (default 500ms) triggers a log warning when TTFB exceeds the threshold, useful for catching provider degradation early.
What Happens Under the Hood
When you callinference.STT("deepgram/nova-3"):
- The factory parses
"deepgram/nova-3"into provider"deepgram"and model"nova-3". - The active project is resolved (set_project / env / yaml default /
"default"). - The provider’s API key is looked up: per-project entry first, then top-level
providers:. - The Registry lazily imports and instantiates
DeepgramProvider. - The provider creates a
livekit.plugins.deepgram.STTinstance. - The instance is wrapped in
InstrumentedSTTto track cost, latency, and the session id. - You get back an object that behaves exactly like the underlying LK plugin instance.
voicegateway.inference or direct plugin imports.