Skip to content

Heartbeat event handler #3648

@OmerCohenAviv

Description

@OmerCohenAviv

pipecat version

0.0.100

Python version

No response

Operating System

No response

what we have tried:

As a workaround, we subclassed PipelineTask and overrode the entire _heartbeat_monitor_handler method to add our custom logic. It works, but it's fragile since we're duplicating the entire method implementation and it could break with future updates.

Question

Hey!

We just started using heartbeats in our pipeline - really helpful feature for detecting blocked pipelines.

One thing we noticed: when a timeout occurs (no heartbeat frame received within 10 seconds), the only feedback is a warning log. There's no way for consumers to react programmatically - for example, to emit metrics, trigger alerts, or cancel the pipeline.

Other timeout scenarios like idle detection have an on_idle_timeout event handler that consumers can subscribe to. It would be great to have the same pattern for heartbeat timeouts.

Proposal

  1. Add an on_heartbeat_timeout event handler that fires when a heartbeat frame is not received within the expected time window
  2. Make the heartbeat monitor timeout configurable (currently hardcoded to 10x the heartbeat interval via HEARTBEAT_MONITOR_SECS)

The changes are minimal but definitely impactful.

Happy to create a PR for this if the approach sounds good!

Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions