Skip to main content
The WebSocket interface provides real-time bidirectional communication between clients and agents using JSON messages.

Quick Start

Clients connect to ws://localhost:8000/ws and exchange JSON messages.

Wire Protocol

Client to Server

Server to Client

Heartbeat

The interface sends periodic heartbeat pings. Clients should respond with pong messages to keep the connection alive.

Constructor Reference

str
default:"/ws"
WebSocket endpoint path.
bool
default:"false"
Require authentication during the WebSocket handshake.

FastAPI Integration

Use create_router() to mount the WebSocket endpoint on an existing FastAPI app:

Imports