WebSocket protocol negotiation between client and server — ensures compatibility and graceful degradation.
The protocol uses semantic versioning — clients and servers are compatible if they share the same major version:
| Client Version | Server Version | Compatible? |
|---------------|----------------|-------------|
| 1.0.0 | 1.0.0 | ✅ Yes |
| 1.2.0 | 1.0.0 | ✅ Yes (same major) |
| 2.0.0 | 1.0.0 | ❌ No (different major) |
The protocol defines these standard event types:
| Event Type | Direction | Description |
|-----------|-----------|-------------|
| chat | Client → Server | User sends a message |
chat
| chat_abort | Client → Server | Abort an active run |
chat_abort
| ping / pong | Both | Keepalive |
ping
pong
| run_content | Server → Client | Delta token (streaming) |
run_content
| run_completed | Server → Client | Run finished |
run_completed
| run_error | Server → Client | Run failed |
run_error
| tool_call_started | Server → Client | Tool execution began |
tool_call_started
| tool_call_completed | Server → Client | Tool returned result |
tool_call_completed
| reasoning | Server → Client | Agent reasoning/thinking |
reasoning
| Endpoint | Method | Description |
|----------|--------|-------------|
| /api/protocol | GET | Get protocol version and supported event types |
/api/protocol
| /api/protocol/negotiate | POST | Check client compatibility |
/api/protocol/negotiate