- Python
- JavaScript
1
Install the plugin
Install the TruGen plugin from the LiveKit registry:
2
Generate an API key
- Using the TruGen Developer Platform, generate an API key from the developers page.
- Set the newly generated API key as
TRUGEN_API_KEYenvironment variable in your.envfile.
3
Add Avatar session to your LiveKit Agent
- Import the
trugenplugin fromlivekit.plugins:
- Instantiate a new
AvatarSessionand set the avatar ID:
- Start the avatar session, passing the current agent session and room context:
Complete Example
- To gracefully shut down, use
ctx.room.disconnect()to close the room connection orctx.shutdown()to end theJobContext.
More Resources
Available Avatars
Explore the full list of ready-to-use avatars.
TruGen Examples
Official GitHub examples for LiveKit + TruGen.
LiveKit Plugin Examples
Explore LiveKit Agent plugin examples.
LiveKit Documentation
Explore the full LiveKit documentation.