`Setup` - `*Server:* LiveKit server (self-hosted)...
# ask-ai
i
Setup
•
*Server:* LiveKit server (self-hosted)
•
*Worker:* livekit-agents (Python), WorkerType.ROOM
•
Voice pipeline:
◦
vad = silero.VAD.load()
◦
stt = assemblyai.STT(...)
◦
llm = openai.LLM(model="gpt-4o-mini")
◦
tts = openai.TTS(model="tts-1", voice="alloy")
•
*Avatar:* livekit.plugins.bey.AvatarSession
•
*Audio output:* whatever Bey plugin wires up (TranscriptSynchronizer -> DataStreamAudioOutput)
High-level behaviour
•
*Without avatar*:
• Multiple sessions back-to-back in the same worker work perfectly. • Every user turn → STT final → LLM → TTS → audio is played. •
*With avatar enabled*:
•
Session-1 (first job in the worker)
▪︎
Everything works: avatar speaks, user replies, multiple turns.
•
TTS metrics are logged, and we see:
• ◦ playback finished event received {"caller_identity": "bey-avatar-room-fdfd6b2c"} •
Session-2 (second job in the same worker)
▪︎
LLM + TTS still run (I see TTS metrics with non-zero audio_duration for multiple turns).
▪︎
Avatar shows up in the room.
◦
BUT there is *never* a single playback finished event logged for that session's avatar identity.
So effectively: *audio is generated, but the Bey/Datastream side never acknowledges playback on the 2nd session.*
t
The issue with the Bey AvatarSession not acknowledging playback in the second session might be related to participant identity conflicts or RPC connection state challenges. Let’s work through some steps together to help troubleshoot and hopefully resolve this: • Verify Participant Cleanup: It’s important to make sure the avatar participant from the first session fully disconnects before starting a new one. Could you check if any previous avatar workers are still connected to the room? • Use Unique Participant Identities: To avoid conflicts, try configuring unique participant identities for each session. For example, adding a unique identifier to the default identity can really help. • Monitor RPC Communication: Since playback acknowledgment depends on LiveKit’s RPC system, it would be great to review your logs for any RPC-related errors that might show communication issues between the agent and avatar worker. • Implement Session Cleanup: Ensuring proper cleanup between sessions by waiting for the avatar worker to completely disconnect before starting a new session can make a big difference. To better assist you, could you please share a bit more about: 1. Are you reusing the same room for multiple sessions, or creating new rooms each time? 2. What specific playback acknowledgment behavior are you expecting versus what you’re actually seeing? For instance, are APIs not resolving or is the agent not detecting playback completion? 3. Have you noticed any RPC-related errors in the agent or LiveKit server logs? 4. Does this issue happen consistently on the second session, or is it more intermittent? 5. Are you using custom participant identities for the avatar, or sticking with the default? Your answers will really help us get to the heart of the issue and find the best solution together. Looking forward to your reply! Sources: Bringing AI avatars to voice agents | plugins/bey/README.md