Skip to main content
The gateway opens a WebSocket at:
Agent responses (text, tool calls, approval requests…) are only sent through this channel. The REST API /chat/send only initiates a turn.

Packet format

Every packet, in both directions, has the form:
requestID is set by the client and echoed by the gateway in the response, helping match requests with responses.

Usage flow

1

Authenticate

Send immediately after connecting:
The gateway returns AuthSuccessEvent or AuthFailedEvent with { "cause": "…" }.
2

Register listener for a session

Response: RegisterChatListenerSuccessEvent or RegisterChatListenerFailEvent ({ cause }).
3

Send a message via REST

Call POST /api/v1/user/chat/send with { sessionID, text }. See REST API.
4

Receive responses

The gateway pushes ReceivedChatMessageEvent events:
The message field is a JSON string. See the type values below.

Client-sent events

For SubmitToolApprovalEvent, data.requestID is the ID of the approval request received in the APPROVAL_REQUEST_MESSAGE message.

Message types

role accepts one of the values AGENT, USER, SYSTEM, DEVELOPER.