deferred_user_turn_stop_strategy
Wrapper that defers a stop strategy’s finalization to another strategy.
- class pipecat.turns.user_stop.deferred_user_turn_stop_strategy.DeferredUserTurnStopStrategy(inner: BaseUserTurnStopStrategy, **kwargs)[source]
Bases:
BaseUserTurnStopStrategyWraps a stop strategy and suppresses its
on_user_turn_stoppedevent.Event subscriptions added to the wrapper are forwarded directly to the inner strategy, except for
on_user_turn_stopped, which is dropped. The inner strategy’s frame-side and inference-triggered events therefore reach external listeners (the controller, etc.) unchanged; finalization is left to another strategy in the chain such asLLMTurnCompletionUserTurnStopStrategy.Use the
deferred()helper for ergonomic construction:stop=[ deferred(TurnAnalyzerUserTurnStopStrategy(turn_analyzer=...)), LLMTurnCompletionUserTurnStopStrategy(), ]
- __init__(inner: BaseUserTurnStopStrategy, **kwargs)[source]
Initialize the deferred wrapper.
- Parameters:
inner – The strategy whose finalization should be deferred.
**kwargs – Additional keyword arguments forwarded to the base class.
- property inner: BaseUserTurnStopStrategy
Return the wrapped strategy.
- add_event_handler(event_name: str, handler)[source]
Forward event subscriptions to the inner strategy.
on_user_turn_stoppedis silently dropped — that’s the whole point of the wrapper. Every other event handler is attached to the inner strategy directly, so the inner’s events reach the listener without any per-event proxy method on the wrapper.
- async setup(task_manager: BaseTaskManager)[source]
Set up the inner strategy.
- async process_frame(frame: Frame) ProcessFrameResult | None[source]
Forward frame processing to the inner strategy.
- pipecat.turns.user_stop.deferred_user_turn_stop_strategy.deferred(strategy: BaseUserTurnStopStrategy) DeferredUserTurnStopStrategy[source]
Defer this stop strategy’s finalization to another strategy.
Wraps
strategyin aDeferredUserTurnStopStrategy: the inner strategy continues to drive inference-triggered events, but itson_user_turn_stoppedevent is suppressed. Use when another strategy in the chain (e.g.LLMTurnCompletionUserTurnStopStrategy) owns finalization.Example:
stop=[ deferred(TurnAnalyzerUserTurnStopStrategy(turn_analyzer=...)), LLMTurnCompletionUserTurnStopStrategy(), ]
- Parameters:
strategy – The stop strategy to defer.
- Returns:
A wrapper that exposes the inner strategy’s behavior with finalization suppressed.