What’s happening: Sarvam’s server closes WebSocket connections after 1 minute of inactivity (confirmed in Sarvam docs). The
LiveKit Sarvam plugin’s connection pool (max_session_duration=3600) doesn’t detect this. It hands out a dead WebSocket → “Cannot
write to closing transport”.
Why it’s NOT fixed in the plugin: The LiveKit Sarvam plugin (v1.5.8) does not send keepalive pings. The Sarvam docs explicitly
say: “Send ping messages to maintain long-running connections. The connection automatically closes after one minute of
inactivity.” But the plugin never sends pings.
Independently verified against livekit-plugins-sarvam/tts.py on main (v1.5.8) max_session_duration=3600 and mark_refreshed_on_get=False are there as you reported, and there’s no keepalive / heartbeat / ping logic wired in. So it’s a real plugin-side gap, not a usage issue.
The pattern other TTS plugins use (per your comparison with Cartesia/Neuphonic/Murf/AsyncAI: max_session_duration=300, mark_refreshed_on_get=True) is the simplest fix, drop session duration well under Sarvam’s 60s server-side timeout and let mark_refreshed_on_get reset age on reuse. Actual WebSocket pings are a more complete fix but require a lot more code. Either path closes the bug.
Since you’ve already filed Sarvam TTS: connection pool config causes stale WebSocket failures · Issue #5681 · livekit/agents · GitHub, it’s worth attaching a small PR with the one-line config change, that lands a review faster than waiting for the keepalive-design discussion.