Skip to main content

UseAIAgentsWebSocketOptions

Agent Runtimes


Agent Runtimes / hooks/useAIAgentsWebSocket / UseAIAgentsWebSocketOptions

Interface: UseAIAgentsWebSocketOptions

Defined in: hooks/useAIAgentsWebSocket.ts:64

Options for the WebSocket hook.

Properties

autoReconnect?

optional autoReconnect?: boolean

Defined in: hooks/useAIAgentsWebSocket.ts:74

Auto-reconnect on unexpected disconnects.


baseUrl?

optional baseUrl?: string

Defined in: hooks/useAIAgentsWebSocket.ts:68

Override the service base URL (defaults to aiagentsRunUrl).


channels?

optional channels?: string[]

Defined in: hooks/useAIAgentsWebSocket.ts:80

Additional channels to subscribe to beyond the auto-subscribed user channel.


enabled?

optional enabled?: boolean

Defined in: hooks/useAIAgentsWebSocket.ts:66

Enable/disable the socket lifecycle.


maxReconnectAttempts?

optional maxReconnectAttempts?: number

Defined in: hooks/useAIAgentsWebSocket.ts:76

Max reconnect attempts before giving up (unbounded by default).


onClose?

optional onClose?: (info) => void

Defined in: hooks/useAIAgentsWebSocket.ts:86

Called when the socket closes.

Parameters

info

AIAgentsWebSocketCloseInfo

Returns

void


onMessage?

optional onMessage?: (msg) => void

Defined in: hooks/useAIAgentsWebSocket.ts:84

Called for every incoming message (optional).

Parameters

msg

WSMessage

Returns

void


onOpen?

optional onOpen?: () => void

Defined in: hooks/useAIAgentsWebSocket.ts:82

Called when the socket opens.

Returns

void


path?

optional path?: string

Defined in: hooks/useAIAgentsWebSocket.ts:70

WebSocket path (or full http/https URL) for the stream endpoint.


queryParams?

optional queryParams?: Record<string, string | number | boolean | null | undefined>

Defined in: hooks/useAIAgentsWebSocket.ts:72

Query string parameters to append to the WebSocket URL.


reconnectDelayMs?

optional reconnectDelayMs?: number | ((attempt) => number)

Defined in: hooks/useAIAgentsWebSocket.ts:78

Reconnect delay strategy (ms) or static delay in ms.