Anam video avatar service for Pipecat
Project description
Pipecat Anam Integration
Generate real-time video avatars for your Pipecat AI agents with Anam.
Maintainer: Anam (@anam-org)
Installation
pip install pipecat-anam
Or with uv:
uv add pipecat-anam
You'll also need Pipecat with the services you use (STT, TTS, LLM, transport). For this repo's examples:
uv sync --extra dev --extra example
That installs all required Pipecat extras (deepgram, cartesia, google, daily, runner, webrtc) plus local tooling.
If you prefer pip:
pip install -e ".[dev,example]"
If you are building your own pipeline, install only the Pipecat extras you need.
Prerequisites
- Anam API key
- API keys for STT, TTS, and LLM (e.g., Deepgram, Cartesia, Google)
- A Daily.co room and (optional) meeting tokens for Daily WebRTC transport — see Auto-provisioning the Daily room.
Usage with Pipecat Pipeline
The AnamVideoService wraps around Anam's Python SDK for a seamless integration with Pipecat to create conversational AI applications where an Anam avatar provides synchronized video and audio output while your application handles the conversation logic. The AnamVideoService iterates over the (decoded) audio and video frames from Anam and passes them to the next service in the pipeline.
enable_audio_passthrough=True renders the avatar directly from your TTS audio (no separate Anam-side LLM or voice generation).
enable_session_replay=False disables Anam-side session recording.
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(),
])
See examples/video-avatar-anam-video-service.py for a complete working example.
Initializing the Anam avatar session
AnamVideoService opens its connection to the Anam Backend asynchronously. The StartFrame is propagated downstream immediately so the rest of the pipeline (LLM/TTS/...) can warm up in parallel. TTS audio starts forwarding once the avatar is ready; any TTS produced before then is held back so it doesn't get dropped on the way in or accumulates latency.
Prior to v0.0.4, AnamVideoService blocked on StartFrame until the avatar was ready, which serialised pipeline startup. The async path keeps initial response latency low.
Publishing directly to Daily
[!WARNING] Direct Daily egress is experimental and only supported for Cara-4 avatars. The transport and signalling path will change in upcoming
anamalpha releases. Pin to an exact alpha if you build on this; expect breaking changes between alphas.
AnamTransport is a drop-in replacement for Pipecat's DailyTransport. The Anam Backend publishes the avatar's synchronised audio and video directly into your Daily room, so the Pipecat bot doesn't have to receive and re-publish the avatar's A/V tracks.
The Daily room is bring-your-own: provision the room and mint two separate meeting tokens before starting the pipeline.
See the Daily REST API docs for rooms and meeting-tokens (or use pipecat's Daily helpers).
daily_avatar_token— for the Anam Backend (optional, but required for private rooms). If auser_nameclaim is set, it must matchdaily_avatar_user_name(or leave the claim empty). This lets the transport tell the avatar apart from end users. The transport will not forward TTS until the avatar has joined.daily_bot_token— for the Pipecat bot itself, used to capture the user's microphone for STT.
Requires anam==0.5.0a1 (pinned exactly — see the SDK's experimental-alpha warning).
from anam import PersonaConfig
from pipecat_anam import AnamTransport
transport = AnamTransport(
api_key=os.environ["ANAM_API_KEY"],
persona_config=PersonaConfig(
avatar_id=os.environ["ANAM_AVATAR_ID"],
# Direct Daily egress requires a Cara-4 avatar; stock avatars default to cara-3.
avatar_model="cara-4-latest",
enable_audio_passthrough=True,
),
daily_room_url=os.environ["DAILY_ROOM_URL"],
daily_bot_token=os.environ["DAILY_BOT_TOKEN"],
daily_avatar_token=os.environ["DAILY_AVATAR_TOKEN"],
daily_avatar_user_name=os.environ["DAILY_AVATAR_USER_NAME"],
)
Auto-provisioning the Daily room
AnamTransport does not mint Daily rooms or tokens itself. If you'd rather provision a room programmatically than pre-create one, use Pipecat's DailyRESTHelper with your DAILY_API_KEY to create the room and the two meeting tokens before constructing the transport:
import aiohttp
from pipecat.transports.daily.utils import (
DailyMeetingTokenParams,
DailyMeetingTokenProperties,
DailyRESTHelper,
DailyRoomParams,
)
async with aiohttp.ClientSession() as session:
helper = DailyRESTHelper(
daily_api_key=os.environ["DAILY_API_KEY"],
aiohttp_session=session,
)
room = await helper.create_room(DailyRoomParams())
avatar_token = await helper.get_token(
room.url,
params=DailyMeetingTokenParams(
properties=DailyMeetingTokenProperties(user_name="anam-avatar"),
),
)
bot_token = await helper.get_token(room.url)
transport = AnamTransport(
api_key=os.environ["ANAM_API_KEY"],
persona_config=PersonaConfig(
avatar_id=os.environ["ANAM_AVATAR_ID"],
# Direct Daily egress requires a Cara-4 avatar; stock avatars default to cara-3.
avatar_model="cara-4-latest",
enable_audio_passthrough=True,
),
daily_room_url=room.url,
daily_avatar_token=avatar_token,
daily_bot_token=bot_token,
)
Video Post-Filter Example
The output transport scales the avatar resolution to the configured output resolution. When the aspect ratios mismatch the video is stretched or squeezed. To avoid this, apply a video post-processing filter that crops the avatar to the output aspect ratio.
examples/video-avatar-anam-postfilter.py adds a CenterAspectCropFilter after AnamVideoService:
- Works on
OutputImageRawFrame; does not depend on Anam internals. - Assumes packed RGB24 bytes (
format="RGB"). - Performs a centered crop to match the configured output aspect ratio.
- Does not scale. Pipecat's output transport can still scale as needed.
- No-op when source and target aspect ratios already match.
The filter is self-contained in that file and can be lifted into any Pipecat pipeline that produces OutputImageRawFrame.
Running the Example
- Install dependencies:
uv sync --extra dev --extra example
- Set up your environment:
cp env.example .env
# Edit .env with your API keys
- Run the
AnamVideoServiceexample (Pipecat's built-in transports):
uv run python examples/video-avatar-anam-video-service.py -t daily
Or with the built-in WebRTC transport:
uv run python examples/video-avatar-anam-video-service.py -t webrtc
To run the AnamTransport example (direct Daily egress, Deepgram + Google + Cartesia):
uv run python examples/video-avatar-anam-transport.py
To run the center-aspect post-filter example with the WebRTC transport:
uv run python examples/video-avatar-anam-postfilter.py -t webrtc
Or with the Daily transport:
uv run python examples/video-avatar-anam-postfilter.py -t daily
Compatibility
- Tested with Pipecat v0.0.100+
- Python 3.10+
- Daily transport or built-in WebRTC transport
License
BSD-2-Clause - see LICENSE
Support
- Anam Lab (Build and test your persona and get your avatar_id.)
- Anam Documentation (API reference and SDK documentation)
- Anam Community Slack
- Pipecat Discord (
#community-integrations)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pipecat_anam-0.1.0a2.tar.gz.
File metadata
- Download URL: pipecat_anam-0.1.0a2.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8a3735edc36e4878f1ace9722208fc41e8791170aa6a20d1cbfc7049ac66732
|
|
| MD5 |
d64e5b4743dea4f9446ee5203bbe4306
|
|
| BLAKE2b-256 |
78a447a136c074955949385c209f650f001e71d6f9167b16180d53fcf2e68d1e
|
Provenance
The following attestation bundles were made for pipecat_anam-0.1.0a2.tar.gz:
Publisher:
release-alpha.yml on anam-org/pipecat-anam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_anam-0.1.0a2.tar.gz -
Subject digest:
c8a3735edc36e4878f1ace9722208fc41e8791170aa6a20d1cbfc7049ac66732 - Sigstore transparency entry: 1804235739
- Sigstore integration time:
-
Permalink:
anam-org/pipecat-anam@182175391e543c93e73d146e9094f4989f141a5a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/anam-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-alpha.yml@182175391e543c93e73d146e9094f4989f141a5a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pipecat_anam-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: pipecat_anam-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5daa9d4f951cc84c67ad7f70578148710bf0a4626add16b85add717e64085082
|
|
| MD5 |
426fd074d68312f354489e9134e13a87
|
|
| BLAKE2b-256 |
468edd1f668e39f451e1042057e74113ea0a38bbbbd79e3179e818c4b61b7640
|
Provenance
The following attestation bundles were made for pipecat_anam-0.1.0a2-py3-none-any.whl:
Publisher:
release-alpha.yml on anam-org/pipecat-anam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_anam-0.1.0a2-py3-none-any.whl -
Subject digest:
5daa9d4f951cc84c67ad7f70578148710bf0a4626add16b85add717e64085082 - Sigstore transparency entry: 1804235765
- Sigstore integration time:
-
Permalink:
anam-org/pipecat-anam@182175391e543c93e73d146e9094f4989f141a5a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/anam-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-alpha.yml@182175391e543c93e73d146e9094f4989f141a5a -
Trigger Event:
push
-
Statement type: