Overview
In some scenarios, turn detection happens externally, either through a dedicated processor or an external service. Pipecat providesExternalUserTurnStrategies, a user turn strategy that defers turn handling to these external sources.
External turn management might be needed when:
- Multiple context aggregators: Parallel pipelines with multiple LLMs need a single, shared source of turn events
- External services with turn detection: Services like Deepgram Flux or Speechmatics provide their own turn detection
ExternalUserTurnStrategies to defer turn handling to the external source.
External Services
Some speech-to-text services provide built-in turn detection. When using these services, configure your context aggregator withExternalUserTurnStrategies to let the service handle turn management:
UserTurnProcessor
UserTurnProcessor is a frame processor for managing user turn lifecycle when you need a single source of turn events shared across multiple context aggregators. It emits UserStartedSpeakingFrame and UserStoppedSpeakingFrame frames and handles interruptions.
UserTurnProcessor only manages user turn start and end events. It does not
handle transcription aggregation, that remains the responsibility of the
context aggregators.Constructor Parameters
Configured strategies for starting and stopping user turns. See User Turn
Strategies for
available options.
Timeout in seconds to automatically stop a user turn if no stop strategy
triggers.
Timeout in seconds for detecting user idle state. The processor will emit an
on_user_turn_idle event when the user has been idle (not speaking) for this
duration after the bot finishes speaking. Set to 0 to disable idle
detection. See Detecting Idle
Users for details.Event Handlers
UserTurnProcessor provides event handlers for turn lifecycle events:
Usage with Parallel Pipelines
When using parallel pipelines with multiple context aggregators, placeUserTurnProcessor before the parallel pipeline and configure each context aggregator with ExternalUserTurnStrategies:
Related
- User Turn Strategies - Configure turn detection strategies
- Parallel Pipeline - Run multiple pipeline branches concurrently
- Turn Events - Handle turn lifecycle events