Table of Contents

Class ConditionalNode

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

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.

public sealed class ConditionalNode : IOrchestrationNode
Inheritance
ConditionalNode
Implements
Inherited Members

Constructors

ConditionalNode(string, Func<NodeContext, string>, IReadOnlyDictionary<string, IOrchestrationNode>, IOrchestrationNode)

Convenience overload for synchronous selectors.

ConditionalNode(string, Func<NodeContext, CancellationToken, Task<string>>, IReadOnlyDictionary<string, IOrchestrationNode>, IOrchestrationNode)

Initializes a new ConditionalNode.

Properties

Branches

Gets the routing branches keyed by route name.

DefaultBranch

Gets the default branch invoked when the selector's route name does not match any configured branch, or null if no default is configured (in which case an unmatched route fails the node).

Name

Stable name for tracing / observability. Two nodes in the same graph should not share a name.

Methods

InvokeAsync(NodeContext, CancellationToken)

Executes this node with the supplied context and returns its result. Implementations must:

  • Honor cancellationToken — surface cancellation rather than spinning silently.
  • Record results into Orchestration via AddResult / AddTrace for observability.
  • Avoid mutating the input context's scalar properties beyond what is documented.
Share