Tavus offers integration with the LiveKit Agents framework, an open-source framework for building conversational agents by LiveKit. You can easily add Tavus Replicas to your LiveKit agents and give them a video layer.

You can keep your LiveKit AgentSession workflow as-is and just create a new Tavus conversation with certain settings.

Tavus Setup

Authentication

Make sure you’ve grabbed an API key in your platform homepage. You’re going to need this key in your LiveKit Agents script.

Replica and Persona Setup

Although you may use any Phoenix-2/Phoenix-3 replica for this, we recommend you try out one of our Phoenix-3 replicas, or better yet ones that are marked as ‘PRO’ that are optimized for conversational quality. For persona creation, ensure that the pipeline_mode is set to echo and define a transport layer under layers, making sure to correctly set the transport_type inside to be livekit.

LiveKit Setup

Once you’ve got your replica and persona ID ready, you can integrate it directly into LiveKit’s AgentSession workflow via an AvatarSession.

To get started, install the plugin from PyPI: pip install livekit-agents[tavus]~=1.0

You would then instantiate an AvatarSession in conjunction with an AgentSession, as follows:

from livekit import agents
from livekit.agents import AgentSession, RoomOutputOptions
from livekit.plugins import tavus

async def entrypoint(ctx: agents.JobContext):
   await ctx.connect()

   session = AgentSession(
      # ... stt, llm, tts, etc.
   )

   avatar = tavus.AvatarSession(
      replica_id="...",  # ID of the Tavus replica to use
      persona_id="...",  # ID of the Tavus persona to use (see preceding section for configuration details)
   )

   # Start the avatar and wait for it to join
   await avatar.start(session, room=ctx.room)

   # Start your agent session with the user
   await session.start(
      room=ctx.room,
      room_output_options=RoomOutputOptions(
         # Disable audio output to the room. The avatar plugin publishes audio separately.
         audio_enabled=False,
      ),
      # ... agent, room_input_options, etc....
   )

You can find further code snippets and implemention details on LiveKit’s integration guide.