Pipeline Idle Detection
Automatically detect and handle idle pipelines with no bot activity
Overview
Pipeline idle detection is a feature that monitors activity in your pipeline and can automatically cancel tasks when no meaningful bot interactions are occurring. This helps prevent pipelines from running indefinitely when a conversation has naturally ended but wasn’t properly terminated.
How It Works
The system monitors specific “activity frames” that indicate the bot is actively engaged in the conversation. By default, these are:
BotSpeakingFrame
- When the bot is speakingLLMFullResponseEndFrame
- When the LLM has completed a response
If no activity frames are detected within the configured timeout period (5 minutes by default), the system considers the pipeline idle and can automatically terminate it.
Idle detection only starts after the pipeline has begun processing frames. The
idle timer resets whenever an activity frame (as specified in
idle_timeout_frames
) is received.
Configuration
You can configure idle detection behavior when creating a PipelineTask
:
Configuration Parameters
Timeout in seconds before considering the pipeline idle. Set to None
to
disable idle detection.
Frame types that should prevent the pipeline from being considered idle.
Whether to automatically cancel the pipeline task when idle timeout is reached.
Handling Idle Timeouts
You can respond to idle timeout events by adding an event handler:
Example Implementation
Here’s a complete example showing how to configure idle detection with custom handling: