Skip to content

Messaging Protocol

UClaw uses a bidirectional WebSocket protocol layered with JSON RPC frames to communicate between clients and active agent instances. This allows real-time text streaming, instant status updates, and interactive tool calls.

Message Types

Every frame sent over the WebSocket has a type property.

1. Client to Server

rpc-request

Triggers a method execution on the remote agent.

json
{
  "type": "rpc-request",
  "id": "c1387d84-c5a4-4d82-8418-5a4df0cf1e2a",
  "method": "updateConfig",
  "args": [
    {
      "modelTier": "capable"
    }
  ]
}

2. Server to Client

rpc-response

Returns the execution result or error for an earlier request.

json
{
  "type": "rpc-response",
  "id": "c1387d84-c5a4-4d82-8418-5a4df0cf1e2a",
  "result": null,
  "error": null
}

text-delta

Streams a text chunk from the generating language model.

json
{
  "type": "text-delta",
  "delta": "Hello"
}

error

Broadcasts connection-level execution or usage errors.

json
{
  "type": "error",
  "errorText": "Insufficient balance"
}