Table of Contents

Class NodeContext

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

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.

public sealed class NodeContext
Inheritance
NodeContext
Inherited Members

Constructors

NodeContext(string, OrchestrationContext, OrchestrationOptions)

Initializes a new NodeContext.

NodeContext(string, OrchestrationContext, OrchestrationOptions, OrchestratorBase)

Initializes a new NodeContext with an explicit host orchestrator.

Properties

Host

The orchestrator running this graph, when one is available. Used by AgentNode to route per-agent invocations through OrchestratorBase so that BeforeAgentExecution, AfterAgentExecution, distributed-trace spans, and streaming behave identically to a prebuilt orchestrator. May be null when a node is invoked directly (without a host).

Input

Input string handed to this node. For sequential pipelines this is the previous node's output; for fan-out parallel blocks it is the originating upstream input forwarded to every child.

Options

The per-call options applied to every agent invocation reachable from this graph. Used by AgentNode to derive the per-agent AgentExecutionOptions via CreateAgentOptions(OrchestrationOptions).

Orchestration

The orchestration-wide accumulator: results, traces, shared state. Mutations here are visible across nodes in the same graph (and across concurrent parallel branches, which is why OrchestrationContext's mutators are lock-protected).

Methods

ExecuteAgentAsync(Agent, string, string, CancellationToken)

Runs an agent inside this graph's host orchestrator so BeforeAgentExecution, AfterAgentExecution, distributed-trace spans, and streaming behave identically to a prebuilt orchestrator stage.

Use this from a custom IOrchestrationNode when you want to invoke an agent (for routing, classification, transformation, etc.) and have it participate in the orchestrator's full lifecycle. When no host is attached, this falls back to a plain RunAsync(string, AgentExecutionOptions, CancellationToken) call and records the result under resultName on the shared OrchestrationContext.

WithInput(string)

Returns a new NodeContext identical to this one but with the specified input. Used by SequentialNode to pipe one node's output to the next without mutating the prior context.

Share