Skip to main content
The SDK is a convenience. If you are not in a browser — a mobile app, a server bridge, your own telephony stack — connect to the WebSocket yourself.

Getting a URL

The response carries websocketUrl:
The field is websocketUrl. It is short-lived and single-use — create a fresh one per call rather than caching it. No additional authentication is needed on the socket itself; the URL is the credential, which is also why it must not be shared or logged.

Audio

Binary frames carry audio; text frames carry JSON. For pcm, send 16-bit mono at the inputSampleRate you requested.

Messages you receive

Messages you send

Client tool calls

An invocation arrives as:
Do the work, then reply with the same invocationId:
The invocationId is how a result is matched to its call. Send a different one — or none — and the agent waits for an answer that never arrives, which the caller hears as the agent freezing mid-sentence.
Report failures rather than staying silent, so the agent can explain and move on:
Using the SDK? registerTool handles all of this — invocation matching, results, and errors — so you never touch invocationId yourself.

Injecting a message

Push text into a live call as though the caller had spoken it. This is how a deferred tool result gets back into the conversation:

Ending

Close the socket to hang up, or watch for the hangup message when the agent ends it. For the agent to be able to end a call gracefully, assign the hangUp system tool — without it, a finished agent simply waits.