icy-nightfall-64225
08/07/2025, 2:20 AMtall-airline-16756
08/07/2025, 2:20 AMtall-airline-16756
08/07/2025, 2:21 AMpip install "livekit-agents[hedra]~=1.0"
2. Set up your Hedra API key:
Create a .env
file and add:
HEDRA_API_KEY=your_hedra_api_key
3. Place your avatar image:
Name your avatar image avatar.png
, avatar.jpg
, or avatar.jpeg
and place it in the same directory as your agent script.
4. Load the avatar image in your agent script:
from PIL import Image
import os
avatar_dir = os.path.dirname(os.path.abspath(__file__))
avatar_image = None
for ext in ['.png', '.jpg', '.jpeg']:
image_path = os.path.join(avatar_dir, f'avatar{ext}')
if os.path.exists(image_path):
avatar_image = Image.open(image_path)
break
if not avatar_image:
raise FileNotFoundError("No avatar image found. Please place an avatar.png, avatar.jpg, or avatar.jpeg in the avatars directory.")
5. Create and start the avatar session:
from livekit.plugins import hedra
avatar_session = hedra.AvatarSession(
avatar_image=avatar_image,
)
await avatar_session.start(
session, # Your AgentSession instance
room=ctx.room,
)
Let me know if you need further assistance with the implementation!icy-nightfall-64225
08/07/2025, 4:11 AMtall-airline-16756
08/07/2025, 4:11 AMicy-nightfall-64225
08/07/2025, 4:11 AMtall-airline-16756
08/07/2025, 4:12 AM