Overview
ParallelPipeline
allows you to create multiple independent processing branches that run simultaneously, sharing input and coordinating output. It’s particularly useful for multi-agent systems, parallel stream processing, and creating redundant service paths.
Each branch receives the same downstream frames, processes them independently, and the results are merged back into a single stream. System frames (like StartFrame
and EndFrame
) are synchronized across all branches.
Constructor Parameters
Multiple lists of processors, where each list defines a parallel branch. All
branches execute simultaneously when frames flow through the pipeline.
Usage Examples
Multi-Agent Conversation
Create a conversation with two AI agents that can interact with the user independently:Redundant Services with Failover
Set up redundant services with automatic failover:Cross-Branch Communication
Using Producer/Consumer processors to share data between branches:How It Works
ParallelPipeline
adds special source and sink processors to each branch- System frames (like
StartFrame
andEndFrame
) are sent to all branches - Other frames flow downstream to all branch sources
- Results from each branch are collected at the sinks
- The pipeline ensures
EndFrame
s are only passed through after all branches complete