how can i connect/disconnect tavus avatar in realt...
# ask-ai
a
how can i connect/disconnect tavus avatar in realtime ?
t
Thanks for reaching out, bogdanmelnikbo. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! To get your Tavus avatar connected in real-time, just follow these simple steps: 1. First, set up your authentication by adding
TAVUS_API_KEY
to your
.env
file. 2. Next, install the plugin by running:
pip install "livekit-agents[tavus]~=1.0"
3. Then, create and start an avatar session with this snippet:
Copy code
from livekit.plugins import tavus

avatar = tavus.AvatarSession(
    replica_id="...",  # ID of the Tavus replica to use
    persona_id="..."   # ID of the Tavus persona to use
)
await avatar.start(session, room=ctx.room)
4. Finally, start the agent session like this:
Copy code
await session.start(
    agent=Agent(instructions="Talk to me!"),
    room=ctx.room,
)
Just a heads-up—I couldn’t find specific info on how to disconnect the Tavus avatar. If you want, I’m here to help you figure that out or answer any other questions! Sources: examples/avatar_agents/tavus/README.md | Tavus virtual avatar integration guide | LiveKit Docs
a
im disconnected tavus avatar by removing him from room. How can i restore session.output.audio to default?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!