Overview
Pipecat services emit events for connection lifecycle management and service-specific activity. These events let you monitor WebSocket connections, handle errors, and react to service behavior.Connection Events
All WebSocket-based STT and TTS services share a common set of connection events. These are emitted by the baseSTTService and TTSService classes, so they work the same way regardless of which provider you use.
Events Summary
on_connected
Fired when the service’s WebSocket connection is established. This is useful for logging, monitoring connection health, or triggering actions that depend on the service being ready.Not all STT and TTS services use WebSocket connections. HTTP-based services
(e.g., Azure TTS, Google TTS) do not emit connection events.
on_disconnected
Fired when the service’s WebSocket connection is closed, whether due to normal shutdown or an error.on_connection_error
Fired when a WebSocket connection error occurs. The error is also pushed as anErrorFrame through the pipeline.
WebSocket-based services automatically reconnect with exponential backoff (3
retries, 4-10s waits) when connection errors occur. The
on_connection_error
event fires for each failed attempt.TTS Events
on_tts_request
Fired just before a TTS synthesis request is sent to the service. This is useful for logging, monitoring, or modifying behavior based on what text is being synthesized.LLM Events
on_function_calls_started
Fired when the LLM starts making function (tool) calls. This event is emitted before the function calls are executed.on_completion_timeout
Fired when an LLM completion request times out. This can happen with slow models or large context windows. The timeout is also pushed as an error frame.Related
- Events Overview - Overview of all events in Pipecat
- FrameProcessor Events - Error handling and frame monitoring events
- Turn Events - User and assistant turn lifecycle events