1. Using the LiveKit Agents Framework
If you already use LiveKit Agents to build your voice agent, the simplest option is livekit-plugins-spatialreal. The plugin hooks into your agent pipeline, sends TTS audio to Spatialreal, and publishes the lip-synced avatar stream into your LiveKit room—so you don’t manage the Server SDK or egress config yourself.How it works
- Your agent runs as usual (VAD, STT, LLM, TTS or Realtime), your current AgentSession setup.
- The plugin intercepts TTS audio from the agent and sends it to Spatialreal.
- Spatialreal generates the avatar stream and publishes it to the same LiveKit room.
- Your client join the room and use the Spatialreal RTC client to render the avatar.
Python: livekit-plugins-spatialreal
Install| Variable | Required | Description |
|---|---|---|
SPATIALREAL_API_KEY | Yes | Your Spatialreal API key |
SPATIALREAL_APP_ID | Yes | Your Spatialreal app ID |
SPATIALREAL_AVATAR_ID | Yes | Avatar to use |
SPATIALREAL_CONSOLE_ENDPOINT | No | Override console endpoint |
SPATIALREAL_INGRESS_ENDPOINT | No | Override ingress endpoint |
LIVEKIT_URL | Yes | Your LiveKit server URL |
LIVEKIT_API_KEY | Yes | LiveKit API key |
LIVEKIT_API_SECRET | Yes | LiveKit API secret |
AvatarSession and start it with your agent session and room. The plugin will attach to the pipeline and publish the avatar to the room.
JavaScript plugin (coming soon)
JavaScript/TypeScript plugin for the LiveKit Agents framework will be available soon.2. Using the Server SDK with LiveKit Egress
If you are not using LiveKit Agents (e.g. custom voice agent server), you can still send avatar output to a LiveKit room by using the Spatialreal AvatarKit Server SDK with LiveKit egress enabled. In this setup:- Your server sends audio to the avatar service and passes LiveKit egress config (room URL, credentials, room name, publisher id).
- The avatar service streams audio + animation directly into the LiveKit room (no need for your server to relay that data).
- Clients join the room and use @spatialwalk/avatarkit-rtc to render the avatar.
Configuration
| Field | Description |
|---|---|
url | LiveKit server URL (e.g., wss://your-livekit-server.com) |
api_key | LiveKit API key |
api_secret | LiveKit API secret |
room_name | LiveKit room name to publish to |
publisher_id | Publisher identity in the room |
Golang Example
Python Example
Important Notes
When LiveKit egress is enabled:- The
TransportFrames/transport_framescallback will not be invoked - Audio and animation data are published directly to the specified LiveKit room
- Your client must use the @spatialwalk/avatarkit-rtc package to render the avatar (standard video players won’t work). See LiveKit Client Guide for client setup.
Interrupt
You can interrupt the avatar (e.g. when the user asks a new question). The interrupt uses the most recent request ID, even afterend=true was sent.
Golang
Summary
| Approach | Best for | Where to go |
|---|---|---|
| LiveKit Agents + Plugin | Python (or future JS) agents using the LiveKit Agents framework | livekit-plugins-spatialreal (this page, section 1) |
| Server SDK + LiveKit egress | Custom backends, any language with a Server SDK (Go, Python, etc.) | This page, section 2 |

