Beta Feature: The LiveKit integration is currently in beta. Features and APIs may change as we continue to improve the integration based on user feedback.
Installation
pip install livekit-plugins-anam
Quick Start
import os
from livekit.agents import Agent, AgentSession, JobContext
from livekit.plugins import openai, anam
async def entrypoint(ctx: JobContext):
# Create agent session with OpenAI Realtime model
session = AgentSession(
llm=openai.realtime.RealtimeModel(voice="alloy"),
)
# Configure Anam avatar
anam_avatar = anam.AvatarSession(
persona_config=anam.PersonaConfig(
name="Cara",
avatarId="a49abb10-9a29-4099-b950-e68534742fb2",
),
api_key=os.getenv("ANAM_API_KEY"),
)
# Start the avatar session
await anam_avatar.start(session, room=ctx.room)
# Start the agent
await session.start(
agent=Agent(instructions="Talk to me!"),
room=ctx.room,
)
# Generate initial greeting
session.generate_reply(instructions="say hello to the user")
Configuration
Environment Variables
Set the following environment variables:
# Required: Anam API credentials
ANAM_API_KEY=your_anam_api_key
# Required: OpenAI API credentials
OPENAI_API_KEY=your_openai_api_key
# Required: LiveKit credentials
LIVEKIT_URL=your_livekit_url
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret
PersonaConfig
Configure your avatar’s appearance and behavior:
persona_config = anam.PersonaConfig(
name="Avatar Name",
avatarId="uuid-of-your-avatar",
)
Avatar Options
Anam provides several options for avatars:
- Stock Avatars: Browse a collection of ready-to-use avatars in the Avatar Gallery
- Custom Avatars: Create your own personalized avatar using Anam Lab
To use a stock avatar, simply copy the avatar ID from the gallery and use it in your PersonaConfig. For custom avatars, create them in the lab and use the generated avatar ID.
Support
For support with the Anam LiveKit plugin: