Skip to main content

LiveKit Worker

For production deployments, run the Voiceblox agent as a standalone LiveKit worker process. The worker connects to your LiveKit server, watches for new rooms, and starts an agent for each room that has a valid AgentConfig in its metadata.

Starting the worker

pnpm agent:start
For development (auto-reloads on file changes):
pnpm agent:dev

Required environment variables

LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=APIxxxxxxxxxx
LIVEKIT_API_SECRET=your-secret
Plus any provider API keys needed by your agent config.

How it works

  1. The worker process connects to your LiveKit server
  2. When a new room is created with AgentConfig JSON in the metadata, the worker picks it up
  3. The worker calls graphToConfig() to parse the config
  4. It builds LLM, TTS, and STT instances using buildLLM(), buildTTS(), buildSTT()
  5. The agent joins the room and starts the conversation

Worker mode vs. local mode

ModeWhen usedHow started
Worker modeProductionpnpm agent:start
Local modeIn-browser testing/api/agent-session endpoint
Worker mode reads config from room metadata. Local mode receives config directly from the API request.

Provider API keys in worker mode

The worker resolves provider API keys from environment variables. If a key is not set, it falls back to LiveKit’s inference gateway (if LiveKit credentials are configured).

Deploying with Docker

See Docker Compose for running the worker alongside the web app in a container.