Prerequisites
- An Anam API key (get one here)
- A persona ID from Anam Lab
- The
anampackage installed (pip install anam)
Connect and stream
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.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. Withanam 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

