BaseObserver

class pipecat.observers.base_observer.FramePushed(source, destination, frame, direction, timestamp)[source]

Bases: object

Represents an event where a frame is pushed from one processor to another within the pipeline.

This data structure is typically used by observers to track the flow of frames through the pipeline for logging, debugging, or analytics purposes.

Parameters:
  • source (FrameProcessor)

  • destination (FrameProcessor)

  • frame (Frame)

  • direction (FrameDirection)

  • timestamp (int)

source

The processor sending the frame.

Type:

FrameProcessor

destination

The processor receiving the frame.

Type:

FrameProcessor

frame

The frame being transferred.

Type:

Frame

direction

The direction of the transfer (e.g., downstream or upstream).

Type:

FrameDirection

timestamp

The time when the frame was pushed, based on the pipeline clock.

Type:

int

source: FrameProcessor
destination: FrameProcessor
frame: Frame
direction: FrameDirection
timestamp: int
class pipecat.observers.base_observer.BaseObserver(*, name=None)[source]

Bases: BaseObject

This is the base class for pipeline frame observers. Observers can view all the frames that go through the pipeline without the need to inject processors in the pipeline. This can be useful, for example, to implement frame loggers or debuggers among other things.

Parameters:

name (str | None)

abstractmethod async on_push_frame(data)[source]

Handle the event when a frame is pushed from one processor to another.

This method should be implemented by subclasses to define specific behavior (e.g., logging, monitoring, debugging) when a frame is transferred through the pipeline.

Parameters:

data (FramePushed) – The event data containing details about the frame transfer.