类 FanoutPipeline
java.lang.Object
io.agentscope.core.pipeline.FanoutPipeline
Fanout pipeline implementation for parallel agent execution.
This pipeline distributes the same input to multiple agents and executes
them either concurrently or sequentially, collecting all results.
Execution flow:
Input -> [Agent1, Agent2, ..., AgentN] -> [Output1, Output2, ..., OutputN]
Features:
- Fan-out pattern execution (one input, multiple outputs)
- Configurable concurrent vs sequential execution
- Input isolation (each agent gets a copy of the input)
- Result aggregation into a list
- Enhanced error handling with detailed agent failure information
- Composite exception collection for multiple agent failures
- Individual agent error isolation without affecting others
-
嵌套类概要
嵌套类修饰符和类型类说明static classBuilder for creating fanout pipelines with fluent API. -
构造器概要
构造器构造器说明FanoutPipeline(List<AgentBase> agents) Create a fanout pipeline with concurrent execution enabled by default.FanoutPipeline(List<AgentBase> agents, boolean enableConcurrent) Create a fanout pipeline with the specified agents and execution mode.FanoutPipeline(List<AgentBase> agents, boolean enableConcurrent, reactor.core.scheduler.Scheduler scheduler) Create a fanout pipeline with the specified agents, execution mode and scheduler. -
方法概要
修饰符和类型方法说明static FanoutPipeline.Builderbuilder()Create a builder for constructing fanout pipelines.Execute the pipeline with the given input message.Execute the pipeline with the given input message and structured output.Get the list of agents in this pipeline.Get a description of this pipeline.booleanCheck if concurrent execution is enabled.booleanisEmpty()Check if this pipeline is empty (has no agents).intsize()Get the number of agents in this pipeline.reactor.core.publisher.Flux<Event> Stream execution events from all agents with default options.reactor.core.publisher.Flux<Event> stream(Msg input, StreamOptions options) Stream execution events from all agents with specified options.reactor.core.publisher.Flux<Event> stream(Msg input, StreamOptions options, Class<?> structuredOutputClass) Stream execution events from all agents with structured output support.toString()
-
构造器详细资料
-
FanoutPipeline
Create a fanout pipeline with the specified agents and execution mode. Uses boundedElastic scheduler by default for concurrent execution.- 参数:
agents- List of agents to execute in parallelenableConcurrent- True for concurrent execution, false for sequential
-
FanoutPipeline
public FanoutPipeline(List<AgentBase> agents, boolean enableConcurrent, reactor.core.scheduler.Scheduler scheduler) Create a fanout pipeline with the specified agents, execution mode and scheduler.- 参数:
agents- List of agents to execute in parallelenableConcurrent- True for concurrent execution, false for sequentialscheduler- Custom scheduler for execution
-
FanoutPipeline
Create a fanout pipeline with concurrent execution enabled by default.- 参数:
agents- List of agents to execute in parallel
-
-
方法详细资料
-
execute
从接口复制的说明:PipelineExecute the pipeline with the given input message. -
execute
从接口复制的说明:PipelineExecute the pipeline with the given input message and structured output. -
getAgents
Get the list of agents in this pipeline.- 返回:
- Copy of the agents list
-
size
public int size()Get the number of agents in this pipeline.- 返回:
- Number of agents
-
isEmpty
public boolean isEmpty()Check if this pipeline is empty (has no agents).- 返回:
- True if pipeline has no agents
-
isConcurrentEnabled
public boolean isConcurrentEnabled()Check if concurrent execution is enabled.- 返回:
- True if agents execute concurrently
-
getDescription
从接口复制的说明:PipelineGet a description of this pipeline.- 指定者:
getDescription在接口中Pipeline<List<Msg>>- 返回:
- Human-readable description of the pipeline
-
stream
Stream execution events from all agents with default options.Events from multiple agents are merged (concurrent mode) or concatenated (sequential mode) based on the pipeline configuration.
- 参数:
input- Input message to distribute to all agents- 返回:
- Flux of events emitted during execution from all agents
-
stream
Stream execution events from all agents with specified options.Events from multiple agents are merged (concurrent mode) or concatenated (sequential mode) based on the pipeline configuration.
- 参数:
input- Input message to distribute to all agentsoptions- Stream configuration options- 返回:
- Flux of events emitted during execution from all agents
-
stream
public reactor.core.publisher.Flux<Event> stream(Msg input, StreamOptions options, Class<?> structuredOutputClass) Stream execution events from all agents with structured output support.Events from multiple agents are merged (concurrent mode) or concatenated (sequential mode) based on the pipeline configuration.
- 参数:
input- Input message to distribute to all agentsoptions- Stream configuration optionsstructuredOutputClass- The class type for structured output (optional)- 返回:
- Flux of events emitted during execution from all agents
-
toString
-
builder
Create a builder for constructing fanout pipelines.- 返回:
- New pipeline builder
-