Skip to main content
This client does in Python what the Node.js SDK’s LiveAvatar does: start a session, stream audio, interrupt, get speech events, and relay browsers’ WebRTC handshakes. Copy it into your project as talking_avatar.py.

The client

talking_avatar.py

Direct output with FastAPI

The server starts the avatar and serves the page’s route. The page uses LiveAvatarView, or plain WebRTC.
main.py
Open http://localhost:8000, click Start, then push your agent’s voice with await app.state.avatar.push_audio(pcm). In a real app, start a LiveAvatar when a conversation starts, keep it by conversation ID, route /avatar/{conversation_id} to it, and close() it when the conversation ends.

Your LiveKit room

For voice agents on LiveKit (LiveKit Agents, Pipecat with LiveKit…). Mint a publish-only token for the avatar; it joins your room with a video track avatar and its voice as avatar-audio.
Then push your agent’s TTS audio to the avatar instead of publishing it yourself, and have your clients play the avatar’s tracks. No handle_view route is needed.

Stream TTS audio

Events and errors

See close codes.