Class OrchestratorBase
- Namespace
- LMKit.Agents.Orchestration
- Assembly
- LM-Kit.NET.dll
Base class for orchestrator implementations.
Provides common functionality for timeout handling, context management, and result building. Subclass this when implementing a custom orchestration strategy that does not match PipelineOrchestrator, ParallelOrchestrator, RouterOrchestrator, or SupervisorOrchestrator.
public abstract class OrchestratorBase : IOrchestrator
- Inheritance
-
OrchestratorBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Examples
Subscribing to lifecycle events common to every orchestrator:
using LMKit.Agents.Orchestration;
// OrchestratorBase is the parent of every prebuilt orchestrator, so the same
// event API works for Pipeline, Parallel, Router, Supervisor, and graph hosts.
var pipeline = new PipelineOrchestrator()
.AddStage("research", researcher)
.AddStage("write", writer);
pipeline.BeforeAgentExecution += (s, e) => Console.WriteLine($"-> {e.Agent.Identity?.Persona}");
pipeline.AfterAgentExecution += (s, e) => Console.WriteLine($"<- {e.Result.Status}");
var result = await pipeline.ExecuteAsync("Topic: edge AI");
Properties
- DefaultOptions
Gets or sets the default options for this orchestrator.
- Name
Gets the name of this orchestrator.
Methods
- CreateAgentOptions(OrchestrationOptions)
Builds the per-agent AgentExecutionOptions derived from an OrchestrationOptions instance.
Returns null when no field on
optionsis set, so the underlying agent runs with its own configured defaults. This is the single source of truth for orchestration-to-agent option propagation; every orchestrator (including SupervisorOrchestrator's delegated workers via DelegateTool) consumes this helper to ensure uniform behavior.
- ExecuteAgentAsync(Agent, string, OrchestrationContext, OrchestrationOptions, CancellationToken)
Executes a single agent with event notifications and optional streaming.
- ExecuteAsync(string, OrchestrationOptions, CancellationToken)
Executes the orchestration with the specified options.
- ExecuteAsync(string, CancellationToken)
Executes the orchestration with default options.
- ExecuteCoreAsync(OrchestrationContext, OrchestrationOptions, CancellationToken)
Core orchestration logic implemented by derived classes.
- Truncate(string, int)
Truncates a string for display.
Events
- AfterAgentExecution
Fired after each agent execution.
- BeforeAgentExecution
Fired before each agent execution.