Namespace LMKit.Agents.Orchestration.Nodes
Classes
- AgentNode
Leaf node that delegates execution to a single Agent.
Per-agent AgentExecutionOptions are derived from the active OrchestrationOptions via the same single source-of-truth helper (CreateAgentOptions(OrchestrationOptions)) that every other orchestrator uses, so timeouts, sampling, completion-token caps, and reasoning level flow through identically whether the agent is invoked from a graph node or a classic PipelineOrchestrator stage.
When invoked under a GraphOrchestrator (the typical case), the per-agent run is routed through the orchestrator host so BeforeAgentExecution, AfterAgentExecution, distributed-trace spans, and streaming all behave identically to a PipelineOrchestrator stage. When invoked directly without a host, the node falls back to a plain RunAsync(string, AgentExecutionOptions, CancellationToken) call.
- ConditionalNode
Composite node that selects exactly one branch to execute, based on a caller-supplied selector. Equivalent in semantics to RouterOrchestrator but composable inside any larger graph.
The selector is awaited synchronously before any branch runs, so it can do asynchronous routing (e.g., consulting a router-agent's classification before dispatching). When the returned route name has no matching branch and no default branch is configured, the node fails.
- GraphOrchestrator
Executes an arbitrary IOrchestrationNode graph as an IOrchestrator.
This is the SOTA composable entry point for orchestrations that can't be expressed by a single sealed orchestrator class. Pipelines, parallel fan-outs, conditional routing, and arbitrary nestings of all three become first-class citizens because every composite is just another IOrchestrationNode.
Existing orchestrators (PipelineOrchestrator, ParallelOrchestrator, RouterOrchestrator, SupervisorOrchestrator) remain available for callers who prefer the named, prebuilt patterns. This type is purely additive.
- NodeContext
Per-invocation context flowing through an IOrchestrationNode graph.
Carries the per-node input string, the shared OrchestrationContext (where every node records its AgentExecutionResult, traces, and shared state), and the active OrchestrationOptions so child nodes inherit per-orchestration settings like MaxCompletionTokens and ReasoningLevel.
- NodeResult
Outcome of an IOrchestrationNode invocation.
Captures the textual output that downstream nodes consume as input, the underlying AgentExecutionResult when the node wrapped an agent (so callers can inspect tool calls, inference counts, etc.), an early-stop signal, and any error that aborted the node's execution.
- ParallelNode
Composite node that runs its children concurrently and aggregates their outputs. Equivalent in semantics to ParallelOrchestrator but composable inside any larger graph.
Each child receives the same input via a WithInput(string) snapshot of the parent context. The shared OrchestrationContext flows to every child; its mutators are lock-protected so concurrent
AddResult/AddTrace/SetStatecalls from multiple branches are safe.
- SequentialNode
Composite node that runs its children in order, piping each child's output into the next child's input. Equivalent in semantics to PipelineOrchestrator but composable inside any larger graph.
Honors StopOnFailure: if a child fails (returns a non-success NodeResult) and stop-on-failure is enabled, subsequent children are skipped. If ShouldStop is set during execution (e.g., by an AgentNode via the shared context), the loop also exits.
Interfaces
- IOrchestrationNode
Unit of composition for the graph-based orchestration API.
Each node represents a transformation from one NodeContext to a NodeResult. Nodes compose into arbitrary graphs (sequential pipelines, parallel fan-out, conditional routing, nested sub-graphs) without requiring a distinct orchestrator class per pattern. Existing orchestrators (PipelineOrchestrator, ParallelOrchestrator, RouterOrchestrator, SupervisorOrchestrator) remain available as familiar facades; this interface is the SOTA composable layer for callers who need patterns the prebuilt orchestrators don't express (e.g., a parallel block of pipelines feeding into a router).