Connection
Query parameters
Example
Sending messages
Send a JSON message to the WebSocket to interact with the agent:Receiving messages
The server sends JSON messages over the WebSocket. Each message has atype field indicating what it is.
Stream start
Signals the beginning of a new AI message.Tool running
Sent when a pre-response tool is being executed. The message can be displayed as a loading indicator.Stream chunk
A token (word or partial word) of the AI’s response, delivered as it’s generated.Stream end
Signals the end of an AI message and includes the complete response.An agent may send multiple messages in a single response. Each message follows the full start → chunks → end sequence. An
end_response event (see below) signals that all messages for the response are complete.