Learn how to properly terminate Pipecat pipelines for clean shutdown and resource management
EndFrame
: A queued ControlFrame that triggers graceful shutdown after processing pending framesCancelFrame
: A SystemFrame that triggers immediate shutdown, discarding pending framesEndFrame
from outside your pipeline:
EndTaskFrame
upstream from inside your pipeline:
EndFrame
is queued and processes after any pending frames (like goodbye messages)EndFrame
EndFrame
reaches the end of the pipeline, shutdown is completetask.cancel()
pushes a CancelFrame
downstream from the PipelineTaskCancelFrame
s are SystemFrame
s and bypass queues for immediate processingCancelFrame
and shut down immediatelypush_frame()
can block termination frames from reaching the end of the pipeline.
Solution: Ensure your custom processors propagate all frames downstream, including EndFrame
and CancelFrame
:
EndFrame
or CancelFrame
from the middle of the pipeline may not reach the pipeline source properly.
Solution: Use the appropriate frame type and direction:
EndTaskFrame
to EndFrame
and
CancelTaskFrame
to CancelFrame
when pushing downstream, ensuring proper
termination handling throughout the pipeline.