Skip to main content
The Pipecat React SDK provides hooks for accessing client functionality, managing media devices, and handling events.

usePipecatClient

Provides access to the PipecatClient instance originally passed to PipecatClientProvider.

useRTVIClientEvent

Allows subscribing to RTVI client events. It is advised to wrap handlers with useCallback.
Arguments
RTVIEvent
required
function
required

usePipecatClientMediaDevices

Manage and list available media devices.

usePipecatClientMediaTrack

Access audio and video tracks.
Arguments
'audio' | 'video'
required
'bot' | 'local'
required

usePipecatClientTransportState

Returns the current transport state.

usePipecatClientCamControl

Controls the local participant’s camera state.

usePipecatClientMicControl

Controls the local participant’s microphone state.

usePipecatConversation

The primary hook for accessing the conversation message stream. Returns the current list of messages (ordered for display) and a function to inject messages programmatically. Each assistant message’s text parts are split into spoken and unspoken segments based on real-time speech progress, so you can style them differently (e.g. dim unspoken text).
Options
(message: ConversationMessage) => void
Called once when a new message first enters the conversation. The message may or may not be complete at this point — check message.final.
(message: ConversationMessage) => void
Called whenever an existing message’s content changes (e.g. streaming text appended, function call status changed, message finalized). Check message.final to detect finalization.
Record<string, AggregationMetadata>
Metadata for aggregation types to control rendering and speech progress behavior. Used to determine which aggregations should be excluded from position-based speech splitting.
Returns
ConversationMessage[]
The current list of conversation messages, ordered for display. Assistant messages have their text parts split into { spoken, unspoken } based on real-time speech progress.
(message: { role: string; parts: ConversationMessagePart[] }) => void
Programmatically inject a message into the conversation (e.g. a system prompt or user-typed input).

useConversationContext

Lower-level hook that provides direct access to the conversation context. Use this when you only need injectMessage without subscribing to the message stream, or to check whether the connected bot supports BotOutput events.
Returns
(message: { role: string; parts: ConversationMessagePart[] }) => void
Programmatically inject a message into the conversation.
boolean | null
Whether the connected bot supports BotOutput events (RTVI 1.1.0+). null means detection hasn’t completed yet.