agent-1 is the standard conversational avatar agent. It wires a complete voice AI pipeline — speech-to-text, large language model, and text-to-speech — directly to an Avaluma avatar using LiveKit Inference. When a user speaks, the audio travels through AssemblyAI for transcription, OpenAI GPT-4.1-mini for a response, and Cartesia Sonic-3 for synthesis, with the final audio rendered by the avatar server into a live video stream.
Pipeline
Setup
1
Install the plugin
The
avaluma-livekit-plugin package provides the AvatarSession class that connects the agent pipeline to your avatar. The pyproject.toml already declares it as a dependency — no extra install step is needed when using Docker:pyproject.toml
2
Configure credentials
Copy
.env.example to .env.local and fill in your credentials:.env.local
3
Set your avatar ID
Open
agents/1-agent-with-livekit-inference/agent-1.py and set avatar_id to your .hvia filename without the extension:agent-1.py
4
Start the agent
Launch The container builds from the project root, loads
livekit-agent-1 with Docker Compose:.env.local, and mounts agent-1.py into the container at /app/src/agent.py.Full Agent Code
This is the complete source ofagent-1.py:
agent-1.py
Key Components Explained
AvatarSession
AvatarSession is the core of the Avaluma integration. You instantiate it with your license key, the avatar ID (matching your .hvia filename), and the avatar server URL:
await avatar.start() registers the avatar as a participant in the LiveKit room and connects it to the AgentSession so TTS audio frames are forwarded to the avatar server for rendering. The call blocks until the avatar participant has fully joined the room.
AgentSession with LiveKit Inference
TheAgentSession configures the full voice pipeline using LiveKit’s managed inference endpoints — no separate API keys are required for the STT, LLM, or TTS models:
Noise Cancellation
Background noise suppression is applied at the room input level usingnoise_cancellation.BVC():
Prewarm Function
Theprewarm function pre-loads the Silero VAD model into worker process memory before the first job arrives, eliminating cold-start latency:
Adding a New Agent
Follow these steps to create an additional agent alongsideagent-1:
1
Create a new agent directory
Add a directory under
agents/ and place your agent script inside it:2
Set a unique agent name
Inside your new script, set
agent_name to a value that is unique within your LiveKit project:agent-3.py
3
Add a service to docker-compose.yaml
Mount your script into the container and set
AGENT_NAME to match agent_name in your script:docker-compose.yaml
4
Start the new agent
