Add an Anam avatar to your Pipecat pipeline

·

The pipecat-anam package is live, and adding a video avatar to a Pipecat agent is now one install and one service in the pipeline.

pip install pipecat-anam

Where Anam fits in the Pipecat ecosystem

Pipecat already has avatar integrations for Tavus and HeyGen. Both are solid. Tavus works well if you want a trained voice replica tied to the avatar. HeyGen has a good selection of pre-built avatars and handles the audio routing itself.

Anam is a different setup. You own the full pipeline: your STT, your LLM, your TTS. Anam sits at the end as the visual layer. No pre-trained replica required, no routing through a separate room. You pass TTS audio in, get synchronized avatar video and audio out. The avatar animates in real time from whatever audio your pipeline produces.

The pipeline

AnamVideoService slots in after your TTS stage, before transport output:

from anam import PersonaConfig
from pipecat_anam import AnamVideoService

persona_config = PersonaConfig(
    avatar_id="your-avatar-id",
    enable_audio_passthrough=True,
)

anam = AnamVideoService(
    api_key=os.environ["ANAM_API_KEY"],
    persona_config=persona_config,
    api_base_url="https://api.anam.ai",
    api_version="v1",
)

pipeline = Pipeline([
    transport.input(),
    stt,
    context_aggregator.user(),
    llm,
    tts,
    anam,  # Video avatar (returns synchronized audio/video)
    transport.output(),
    context_aggregator.assistant(),
])
from anam import PersonaConfig
from pipecat_anam import AnamVideoService

persona_config = PersonaConfig(
    avatar_id="your-avatar-id",
    enable_audio_passthrough=True,
)

anam = AnamVideoService(
    api_key=os.environ["ANAM_API_KEY"],
    persona_config=persona_config,
    api_base_url="https://api.anam.ai",
    api_version="v1",
)

pipeline = Pipeline([
    transport.input(),
    stt,
    context_aggregator.user(),
    llm,
    tts,
    anam,  # Video avatar (returns synchronized audio/video)
    transport.output(),
    context_aggregator.assistant(),
])
from anam import PersonaConfig
from pipecat_anam import AnamVideoService

persona_config = PersonaConfig(
    avatar_id="your-avatar-id",
    enable_audio_passthrough=True,
)

anam = AnamVideoService(
    api_key=os.environ["ANAM_API_KEY"],
    persona_config=persona_config,
    api_base_url="https://api.anam.ai",
    api_version="v1",
)

pipeline = Pipeline([
    transport.input(),
    stt,
    context_aggregator.user(),
    llm,
    tts,
    anam,  # Video avatar (returns synchronized audio/video)
    transport.output(),
    context_aggregator.assistant(),
])

The service handles the WebRTC connection to Anam's backend, manages the session lifecycle, and pushes synchronized audio and video frames downstream through async iterators. You don't manage the connection directly.

What the integration handles

A few things worth knowing about how it behaves in a real pipeline:

Interruption is handled via InterruptionFrame. When a user interrupts mid-response, the frame signals the session, resets the send queue, and the avatar stops speaking cleanly. No manual cleanup needed.

Anam supports any ingested sample rate without downsampling. Return audio comes back as 16-bit stereo 48kHz Opus and gets resampled for downstream compatibility. If you're chaining other audio services after the avatar, this matters. You're not getting degraded audio passed to the next stage.

Metrics are on by default. can_generate_metrics() returns True, so TTFB tracking and pipeline profiling work as expected.

The example stack

The foundational example in the repo uses Deepgram for STT, Cartesia for TTS, Google for the LLM, and Daily or smallwebrtc for transport. That's a reasonable starting point, but because Anam only handles the visual layer, you can swap any of those for whatever you're already using.

The Anam Python SDK handles the WebRTC connection and session management under the hood. If you want to go deeper on the connection level (custom ICE servers, session replay), the API reference covers it.

Getting started

Install the package, grab your API key from Anam Lab, pick an avatar ID from the gallery, and drop AnamVideoService into your pipeline. The full setup is on GitHub, and the PyPI page has version history if you're tracking compatibility. The integration is tested against Pipecat v0.0.103 and up.

If you're already running a Pipecat agent, adding the avatar layer is a few lines. If you're starting fresh, the example in the repo covers the full stack end to end.

Never miss a post

Get new blog entries delivered straight to your inbox.

Never miss a post

Get new blog entries delivered straight to your inbox.

In this article

Table of Content