Tavus offers integration with Pipecat, an open-source framework for building multimodal conversational agents by Daily. You can easily add Tavus Digital Twins to your Pipecat apps and give them a video layer.

You can keep your Pipecat workflow as-is and just add the new TavusVideoService. To get started, you can follow the following steps or learn more from this sample code.

Step 1: Setup Tavus Replica

First, you need to set up TavusVideoService with your replica and persona.

tavus = TavusVideoService(
            api_key=os.getenv("TAVUS_API_KEY"),
            replica_id=os.getenv("TAVUS_REPLICA_ID"),
            persona_id=os.getenv("TAVUS_PERSONA_ID", "pipecat0"),
            session=session,
        )

Step 2: Ignore Tavus Replica’s Microphone

Once Tavus Replica is added to the Daily room, you need to ignore its microphone. To do that, you need to get persona and look up persona_name.

persona_name = await tavus.get_persona_name()

You can then ignore their microphone.

if participant.get("info", {}).get("userName", "") == persona_name:
  logger.debug(f"Ignoring {participant['id']}'s microphone")
  await transport.update_subscriptions(
    participant_settings={
    participant["id"]: {
    "media": {"microphone": "unsubscribed"},
    }
  }
)

Step 3: Initiate the Conversation

Once your user enters the Daily room, you can kick off the conversation.

if participant.get("info", {}).get("userName", "") != persona_name:
  messages.append(
    {"role": "system", "content": "Please introduce yourself to the user."}
  )
  await task.queue_frames([LLMMessagesFrame(messages)])