Agent Keep Alive
Send periodic KeepAlive messages to prevent the WebSocket from timing out during long silences.
KeepAlive is a JSON message you send to the server to keep an idle WebSocket open. The server closes connections that go silent, so when you stop streaming audio for an extended period, send KeepAlive to hold the session.
Most agent conversations do not need KeepAlive. You’ll normally stream microphone audio continuously so the user can speak at any moment.
When to use it
Send KeepAlive only during a period when the client isn’t sending audio. While idle, send one KeepAlive every 8 seconds.
Example payload
The server doesn’t respond to KeepAlive.
KeepAlive does not extend the maximum session length of 2 hours. The server closes every session at the 2-hour mark, however much traffic it has seen.