idle_frame_processor

Idle frame processor for timeout-based callback execution.

class pipecat.processors.idle_frame_processor.IdleFrameProcessor(*, callback: Callable[[IdleFrameProcessor], Awaitable[None]], timeout: float, types: list[type] | None = None, **kwargs)[source]

Bases: FrameProcessor

Monitors frame activity and triggers callbacks on timeout.

This processor waits to receive any frame or specific frame types within a given timeout period. If the timeout is reached before receiving the expected frames, the provided callback will be executed.

__init__(*, callback: Callable[[IdleFrameProcessor], Awaitable[None]], timeout: float, types: list[type] | None = None, **kwargs)[source]

Initialize the idle frame processor.

Parameters:
  • callback – Async callback function to execute on timeout. Receives this processor instance as an argument.

  • timeout – Timeout duration in seconds before triggering the callback.

  • types – Optional list of frame types to monitor. If None, monitors all frames.

  • **kwargs – Additional arguments passed to parent class.

async process_frame(frame: Frame, direction: FrameDirection)[source]

Process incoming frames and manage idle timeout monitoring.

Parameters:
  • frame – The frame to process.

  • direction – The direction of frame flow in the pipeline.

async cleanup()[source]

Clean up resources and cancel pending tasks.