agreeable-dream-41746
10/31/2025, 3:53 PMRuntimeError(\n \"cannot schedule new speech, the speech scheduling is draining/pausing\"\n )\nRuntimeError: cannot schedule new speech, the speech scheduling is draining/pausing", "level": "ERROR", "name": "asyncio", "room": "voice_assistant_room_XXX", "pid": XXX, "job_id": "XXX", "timestamp": "2025-10-31T15:46:00.320114+00:00"}
I'm using livekit cloud and getting this error at some point and agent stops replyingtall-airline-16756
10/31/2025, 3:53 PMtall-airline-16756
10/31/2025, 3:54 PMRuntimeError: cannot schedule new speech, the speech scheduling is draining/pausing. This happens when the speech scheduling system is temporarily paused or draining, often during agent transitions like when an agent is running its on_exit() callback or getting ready to hand off to another agent.
Here are some friendly tips to help you resolve this:
• Try to avoid generating speech while agents are transitioning or shutting down.
• For tool responses, the system smartly uses force=True to skip the draining state, so you usually don’t need to do anything extra.
• If you’re working with custom speech generation, it’s best to wait until the draining process finishes before scheduling new speech.
• Keep an eye on the agent’s lifecycle state to know the right moment to resume scheduling.
If you’re still running into this issue or want some more guidance, please don’t hesitate to reach out. I’m happy to walk you through more troubleshooting steps and make sure you feel confident moving forward!
Sources: agents/src/voice/agent_activity.ts | Events and error handling | LiveKit docs | livekit-agents/livekit/agents/voice/speech_handle.py | Agent Session & Client Integration | livekit/livekit_composite | DeepWikiagreeable-dream-41746
10/31/2025, 3:55 PMtall-airline-16756
10/31/2025, 3:55 PMRuntimeError: cannot schedule new speech, the speech scheduling is draining/pausing message you're seeing. This error isn't due to memory issues or problems with your cloud setup. Instead, it's a controlled behavior that happens when the agent's speech scheduling system is paused or draining—usually during agent transitions, handoffs, or shutdowns.
While memory or resource limits can sometimes affect how stable the agent is, they aren't the direct cause of this error. LiveKit Cloud gracefully handles draining during scaling or deployment by pausing speech scheduling as part of its normal process.
If this error pops up often for you, here are a few things you might want to check:
• Take a look at your agent logic to make sure transitions or shutdowns aren't triggering the draining state too soon.
• Try using the force=True parameter for tool responses that need to go through even when paused.
• Double-check that your cloud resources align with LiveKit’s recommendations, like having 4 cores and 8GB RAM per worker.
If you'd like, I’m here to help you work through this error or chat about how to optimize your setup. Just let me know!
Sources: Deploy and scale agents on LiveKit Cloud | Deploying to custom environments | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki