Skip to main content
This quickstart shows you how to connect to an Anam persona and receive audio and video frames.

Prerequisites

  • An Anam API key (get one here)
  • A persona ID from Anam Lab
  • The anam package installed (pip install anam)

Connect and stream

This connects to the persona and prints frame metadata as it arrives. Replace the print calls with your own rendering logic.
When you save SDK video frames to a file, set the output writer or muxer to 25 fps. This is an output encoding hint; session.video_frames() yields frames as they arrive. Encoding saved output at 30 fps can make audio and video drift out of sync.
Never expose your API key in client-side code. The Python SDK is designed for server-side use. See Usage in Production for session token patterns.

Send a message

You can send text to the persona during a session:

Use the event-driven API

If you prefer callbacks over async iterators:

Multi-utterance persona turns

In a tool-driven response, a persona can speak before a tool call and continue after the tool returns. With anam version 0.11.0 or later, completed persona messages expose those spoken parts through the optional utterances field:
message.content remains the complete concatenated turn. message.utterances is None for user messages and whenever the engine does not provide utterance IDs, so continue to handle content as the fallback. For live captions, persona MESSAGE_STREAM_EVENT_RECEIVED payloads include an optional utterance_id. Consecutive chunks with the same ID belong to the same utterance; append their content in arrival order.
Multi-utterance turns require an LLM that supports interleaved tool calling: text before and after a tool call in one turn. Anam-provided LLMs hosted by OpenAI or Azure support this behavior; LLMs hosted by Groq do not.

Next steps

GitHub Repository

Source code, full API reference, and examples

Cookbook: Python BYO LLM

Bring your own LLM with the Python SDK
Last modified on August 18, 2026