user_mute

class pipecat.turns.user_mute.AlwaysUserMuteStrategy[source]

Bases: BaseUserMuteStrategy

User mute strategy that always mutes the user while the bot is speaking.

__init__()[source]

Initialize the always user mute strategy.

async process_frame(frame: Frame) bool[source]

Process an incoming frame.

Parameters:

frame – The frame to be processed.

Returns:

Whether the strategy is muted.

class pipecat.turns.user_mute.BaseUserMuteStrategy(**kwargs)[source]

Bases: BaseObject

Base class for strategies that decide whether user frames should be muted.

A user mute strategy determines whether incoming user frames should be suppressed based on the current system state.

Typical heuristics include: - The bot is currently speaking, so user should be muted - A function call or tool execution is in progress - The system is otherwise not ready to accept user input

The strategy is evaluated per frame and returns a boolean indicating whether the user should be muted.

__init__(**kwargs)[source]

Initialize the base user mute strategy.

property task_manager: BaseTaskManager

Returns the configured task manager.

async setup(task_manager: BaseTaskManager)[source]

Initialize the strategy with the given task manager.

Parameters:

task_manager – The task manager to be associated with this instance.

async cleanup()[source]

Cleanup the strategy.

async process_frame(frame: Frame) bool[source]

Process an incoming frame.

Parameters:

frame – The frame to be processed.

Returns:

Whether the strategy is muted.

class pipecat.turns.user_mute.FirstSpeechUserMuteStrategy[source]

Bases: BaseUserMuteStrategy

User mute strategy that mutes the user only during the bot’s first speech.

This strategy allows user input before the bot starts speaking. Once the bot begins its first speaking turn, user frames are muted until the bot finishes that speech. After the bot completes its first speaking turn, user input is no longer muted by this strategy.

Use this strategy when early user input is acceptable, but interruptions during the bot’s initial response should be prevented.

__init__()[source]

Initialize the first-bot-speech user mute strategy.

async process_frame(frame: Frame) bool[source]

Process an incoming frame.

Parameters:

frame – The frame to be processed.

Returns:

Whether the strategy is muted.

class pipecat.turns.user_mute.FunctionCallUserMuteStrategy[source]

Bases: BaseUserMuteStrategy

User mute strategy that mutes the user while a function call is executing.

This strategy ensures that user input does not interfere with ongoing function execution. While a function call is active, all user frames are muted. Once the function call completes or is canceled, user input is allowed again.

__init__()[source]

Initialize the function call user mute strategy.

async process_frame(frame: Frame) bool[source]

Process an incoming frame.

Parameters:

frame – The frame to be processed.

Returns:

Whether the strategy is muted.

class pipecat.turns.user_mute.MuteUntilFirstBotCompleteUserMuteStrategy[source]

Bases: BaseUserMuteStrategy

User mute strategy that mutes the user until the bot completes its first speech.

This strategy mutes user frames immediately from the start of the interaction, even if the bot has not started speaking yet. User input remains muted until the bot finishes its first speaking turn.

After the bot completes its initial speech, all subsequent user frames are allowed to pass through without muting.

Use this strategy when the bot must fully control the beginning of the interaction and deliver its first response without any user interruption.

__init__()[source]

Initialize the mute-until-first-bot-complete user mute strategy.

async process_frame(frame: Frame) bool[source]

Process an incoming frame.

Parameters:

frame – The frame to be processed.

Returns:

Whether the strategy is muted.

Submodules