"Is it possible that LiveKit's internal audio proc...
# ask-ai
s
"Is it possible that LiveKit's internal audio processing creates persistent background tasks that survive AgentSession.aclose() ? This might cause cpu staircase issues
t
Thanks for reaching out, MBMBMB. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I want to assure you that LiveKit's internal audio processing is thoughtfully designed to gracefully end all background tasks when
AgentSession.aclose()
is called. This includes stopping audio forwarding tasks, closing audio sources, and making sure no operations are left hanging. Normally, this helps prevent any CPU staircase issues you might worry about. If you’re noticing some unusual CPU activity, it might be helpful to take a look at a few things: • Whether any custom
AsyncIterator
implementations are properly terminating. • Any third-party plugins you’re using (like TTS or STT) that could potentially keep tasks running. • Your logs, to see if there are any tasks that haven’t been cancelled or any
aclose()
calls that didn’t complete fully. Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real...