Class Hierarchy
Thevision_agents.core.avatars module exports two classes:
All three built-in implementations (LiveAvatar, Anam, LemonSlice) build on
AVSynchronizer for output, so it’s the recommended building block for custom avatars too.
Lifecycle
The agent drives the avatar through a fixed lifecycle:Agent.__init__queriesvideo_output()and callsattach_audio_input(stream), handing the avatar the inference flow’s audio output stream.Agent.join()callsawait avatar.start(), which opens the provider connection and begins consuming the input stream.- While running, the avatar drains
input_audio_stream, forwards audio to the provider, and exposes lip-synced video viavideo_output()and audio viaaudio_output(). Agent.close()callsawait avatar.close()for teardown.
avatar.audio_output() as outbound audio instead of the TTS stream directly — TTS still synthesises, the avatar lip-syncs and republishes.
Abstract Methods
Subclasses must implement all four:
Subclasses may also implement an
interrupt() method to stop the in-flight utterance at the provider during barge-in.
Properties & Helpers
AVSynchronizer
AVSynchronizer is a utility class that solves the lip-sync problem: provider video and audio arrive on separate streams, and pushing them straight onto the outbound WebRTC tracks usually drifts. It owns a paired audio_output and video_output, delays each video frame by the current audio buffer depth, and paces frames at the configured fps (overriding aiortc’s hardcoded 30 fps).
Building a Custom Avatar
A minimal subclass wraps anAVSynchronizer, exposes its tracks, and pumps provider frames into it from a consumer task started in start():
Usage
Pass an avatar to the agent at initialisation:Available Implementations
LiveAvatar
Real-time interactive avatars by HeyGen with WebSocket lip-sync.
Anam
Anam’s avatar SDK with configurable dimensions and frame rate.
LemonSlice
LemonSlice avatars delivered over LiveKit.