Table of Contents

Class ParallelOrchestrator

Namespace
LMKit.Agents.Orchestration
Assembly
LM-Kit.NET.dll

Orchestrator that executes multiple agents concurrently and aggregates results.

All agents receive the same input and execute in parallel. Results are combined using a configurable aggregation strategy.

public sealed class ParallelOrchestrator : OrchestratorBase, IOrchestrator
Inheritance
ParallelOrchestrator
Implements
Inherited Members

Examples

var parallel = new ParallelOrchestrator()
    .AddAgent(technicalReviewerAgent)
    .AddAgent(legalReviewerAgent)
    .AddAgent(marketingReviewerAgent)
    .WithAggregator((results, ctx) => string.Join("\n\n", results.Select(r => r.Content)));

var result = await parallel.ExecuteAsync("Review this proposal...");

Remarks

Use Cases

  • Gathering multiple perspectives on a topic
  • Parallel analysis with different specialized agents
  • Ensemble approaches for improved accuracy
  • Fan-out/fan-in patterns

Constructors

ParallelOrchestrator()

Initializes a new instance of the ParallelOrchestrator class.

ParallelOrchestrator(params Agent[])

Initializes a parallel orchestrator with the specified agents.

Properties

MaxDegreeOfParallelism

Gets or sets the maximum degree of parallelism.

Set to -1 (default) for unlimited parallelism.

Name

Gets the name of this orchestrator.

Methods

AddAgent(Agent)

Adds an agent to the parallel execution set.

AddAgent(Agent, Func<string, OrchestrationContext, string>)

Adds an agent with a custom input for this agent.

AddAgent(string, Agent)

Adds a named agent to the parallel execution set.

ExecuteCoreAsync(OrchestrationContext, OrchestrationOptions, CancellationToken)

Executes all agents in parallel.

WithAggregator(Func<IReadOnlyList<AgentExecutionResult>, OrchestrationContext, string>)

Sets the aggregation function for combining results.