Actions

Action management system for conversation flows.

This module provides the ActionManager class which handles execution of actions during conversation state transitions. It supports:

  • Built-in actions (TTS, conversation ending)

  • Custom action registration

  • Synchronous and asynchronous handlers

  • Pre and post-transition actions

  • Error handling and validation

Actions are used to perform side effects during conversations, such as:

  • Text-to-speech output

  • Database updates

  • External API calls

  • Custom integrations

class pipecat_flows.actions.FunctionActionFrame(action: dict, function: Callable[[dict[str, Any], FlowManager], Awaitable[None]])[source]

Bases: ControlFrame

Frame containing a function action to be executed.

Parameters:
  • action – Action configuration dictionary.

  • function – Function handler to execute.

action: dict
function: Callable[[dict[str, Any], FlowManager], Awaitable[None]]
class pipecat_flows.actions.ActionFinishedFrame[source]

Bases: ControlFrame

Frame indicating that an action has completed execution.

class pipecat_flows.actions.ActionManager(worker: PipelineWorker, flow_manager: FlowManager)[source]

Bases: object

Manages the registration and execution of flow actions.

Actions are executed during state transitions and can include:

  • Text-to-speech output

  • Database updates

  • External API calls

  • Custom user-defined actions

Built-in actions:

  • tts_say: Speak text using TTS

  • end_conversation: End the current conversation

  • function: Execute inline functions in the pipeline

Custom actions can be registered using register_action().

__init__(worker: PipelineWorker, flow_manager: FlowManager)[source]

Initialize the action manager.

Parameters:
  • worker – PipelineWorker instance used to queue frames.

  • flow_manager – FlowManager instance that this ActionManager is part of.

async execute_actions(actions: list[ActionConfig] | None) None[source]

Execute a list of actions.

Parameters:

actions – List of action configurations to execute.

Raises:

ActionError – If action execution fails.

Note

Each action must have a ‘type’ field matching a registered handler.

schedule_deferred_post_actions(post_actions: list[ActionConfig]) None[source]

Schedule “deferred” post-actions to be executed after next LLM completion.

Parameters:

post_actions – List of actions to execute after LLM response.

clear_deferred_post_actions() None[source]

Clear any scheduled deferred post-actions.