lemon-nest-44301
07/12/2025, 1:58 AMtall-airline-16756
07/12/2025, 1:58 AMtall-airline-16756
07/12/2025, 2:01 AMlistening
state (and permits speech) after the audio track is fully published and participant linking is confirmed. Premature transition during initialization can trigger agent speech too early.
• Connection Monitoring: Rigorously monitor room.connectionState
and confirm the room connection is established before enabling agent speech. Avoid triggering response generation or session.say()
until connection and subscription are complete.
• Audio Pipeline: Match your VAD, turn detection, and queue_size_ms
settings to those used by the playground. A queue_size_ms
of at least 2000ms and default threshold values help prevent timing issues and audio underruns.
To align your app's behavior with the agent playground, review these areas for differences—especially state machine logic, track publication timing, and initialization event ordering.
For a more targeted fix, please compare your initialization flow with the patterns above, or provide a code snippet of your agent's connection/startup logic if further help is needed.
Sources: Agents Overview | LiveKit Docs | Web and mobile frontends | LiveKit Docs | Speech & Audio Processing | livekit/livekit_composite | DeepWiki | Agent speech and audio | LiveKit Docs | agents/src/pipeline/pipeline_agent.ts | README.mdlemon-nest-44301
07/12/2025, 2:24 AMtall-airline-16756
07/12/2025, 2:25 AMLiveKitRoom
React component won't automatically handle prepareConnection
or set up preConnectBuffer
for you—you'll need to take care of these details yourself. Think of it like preparing ingredients before cooking a meal!
• `prepareConnection`: You'll want to give this a manual call (like when your page first loads) before switching shouldConnect
on. The component won't do any DNS/TLS warming up on its own, so it's on you to get things ready.
• `preConnectBuffer`: Yep, this is another thing you'll need to set when you're turning on the microphone. The component isn't going to do this automatically for you.
In your setup, double-check that you're calling prepareConnection
before connecting, and make sure you've set preConnectBuffer: true
when you enable the mic. If you're bringing your own Room instance to LiveKitRoom
, configure these settings on that instance before you connect.
These two steps are key for smooth wake-word interactions and avoiding those tricky race conditions that might be causing your headaches. You've got this!
Sources: packages/react/src/hooks/useLiveKitRoom.ts | components/app.tsx | complex-agents/nova-sonic/nova-sonic-form-agent/components/app.tsx | src/room/Room.tslemon-nest-44301
07/12/2025, 2:26 AMtall-airline-16756
07/12/2025, 2:29 AMlemon-nest-44301
07/12/2025, 2:42 AMtall-airline-16756
07/12/2025, 2:43 AM