Skip to main content
Avatars consume the agent’s audio output and produce a synced video and audio feed of a virtual character. They run in passthrough mode: the avatar owns the agent’s outbound video and audio tracks, and its output never feeds back into the LLM or any video processors.

Class Hierarchy

The vision_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:
  1. Agent.__init__ queries video_output() and calls attach_audio_input(stream), handing the avatar the inference flow’s audio output stream.
  2. Agent.join() calls await avatar.start(), which opens the provider connection and begins consuming the input stream.
  3. While running, the avatar drains input_audio_stream, forwards audio to the provider, and exposes lip-synced video via video_output() and audio via audio_output().
  4. Agent.close() calls await avatar.close() for teardown.
When an avatar is set, the agent publishes 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 an AVSynchronizer, 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.