Protocol Reference
The Voice Socket protocol is v1. Two frame kinds travel over one WebSocket:
- Binary frames carry raw audio — PCM
s16le, 24 kHz, mono — in both directions. - JSON frames carry events. Every JSON frame includes
"v": 1. A future breaking change bumps that number; additive fields don't.
Connect at:
wss://core.eurekatechlabs.com/v1/voice/{agentId}Audio format
| Value | |
|---|---|
| Encoding | pcm_s16le (signed 16-bit, little-endian) |
| Sample rate | 24000 Hz |
| Channels | mono |
| Wire | raw binary WebSocket frames (no base64, no header) |
Both directions use the same format. The session.created frame echoes it back so you don't have to hardcode it.
Server → client
Binary audio
Each binary frame is a chunk of agent voice as PCM s16le @ 24 kHz. Play it in order.
`session.created`
Sent once, immediately after the socket is authorized. This is your "ready" signal.
{
"v": 1,
"type": "session.created",
"sessionId": "f7c2…",
"audio": { "input": "pcm_s16le@24000", "output": "pcm_s16le@24000" },
"agent": { "id": "agt_xxxxxxxxxxxx", "mode": "realtime" }
}sessionId is the call's session ID (a UUID) — the same ID you'll see in webhooks and call history.
`transcript`
Conversation text, as it's finalized.
{ "v": 1, "type": "transcript", "role": "user", "text": "what are your hours?", "final": true }
{ "v": 1, "type": "transcript", "role": "assistant", "text": "We're open 9 to 5.", "final": true, "interrupted": false }| Field | Notes |
|---|---|
role |
user or assistant |
text |
the transcribed / spoken text |
final |
true — v1 emits finalized turns |
interrupted |
when present on an assistant turn, true means the caller barged in mid-reply |
`interrupted`
Barge-in: the caller started speaking over the agent. Stop and flush any agent audio you have queued for playback.
{ "v": 1, "type": "interrupted" }`tool.called`
The agent invoked a tool.
{ "v": 1, "type": "tool.called", "id": "t1", "name": "lookup_order", "args": { "orderId": "1234" } }`tool.completed`
The tool finished. Pair it with tool.called by id. For a slow function tool this can arrive after later transcript frames, so match on id — never on order.
{ "v": 1, "type": "tool.completed", "id": "t1", "name": "lookup_order", "result": { "ok": true, "data": { "status": "shipped" } } }result is { "ok": true, "data": … } on success, or { "ok": false, "error": "…" } on failure. See Tools for the full picture.
`error`
A recoverable or fatal error. Fatal ones are followed by the socket closing (see close codes).
{ "v": 1, "type": "error", "code": "max_session_time", "message": "maximum session duration reached" }`session.ended`
The final frame before the socket closes.
{ "v": 1, "type": "session.ended", "reason": "client_closed" }Common reason values: client_closed, bridge_error.
Client → server
Binary audio
Send microphone audio as binary frames — PCM s16le @ 24 kHz, mono. Keep each frame ≤ 64 KB; larger frames are dropped.
`end`
Graceful close. The session finalizes and bills.
{ "v": 1, "type": "end" }Closing the WebSocket has the same effect.
Not in v1:
session.updateandinterruptcontrol frames are accepted by the protocol shape but ignored — per-session prompt/first-message overrides and client-driven interrupts aren't wired yet. Set behaviour in the agent config. Barge-in is detected automatically from your audio.
Frame summary
| Direction | Frame | Kind |
|---|---|---|
| → client | agent voice | binary |
| → client | session.created |
JSON |
| → client | transcript |
JSON |
| → client | interrupted |
JSON |
| → client | tool.called |
JSON |
| → client | tool.completed |
JSON |
| → client | error |
JSON |
| → client | session.ended |
JSON |
| → server | mic audio | binary |
| → server | end |
JSON |
See Limits & Errors for close codes and caps.
