Constructor NodeContext
- Namespace
- LMKit.Agents.Orchestration.Nodes
- Assembly
- LM-Kit.NET.dll
NodeContext(string, OrchestrationContext, OrchestrationOptions)
Initializes a new NodeContext.
public NodeContext(string input, OrchestrationContext orchestration, OrchestrationOptions options)
Parameters
inputstringorchestrationOrchestrationContextoptionsOrchestrationOptions
Examples
Implementing a custom IOrchestrationNode that consumes NodeContext:
using LMKit.Agents.Orchestration;
using LMKit.Agents.Orchestration.Nodes;
public sealed class UpperCaseNode : IOrchestrationNode
{
public string Name => "uppercase";
public Task<NodeResult> InvokeAsync(NodeContext context, CancellationToken ct)
{
// Read this node's input from the flowing context.
string output = context.Input?.ToUpperInvariant() ?? string.Empty;
// Record a trace into the shared OrchestrationContext for observability.
context.Orchestration.AddTrace($"upper-cased {context.Input?.Length ?? 0} chars");
return Task.FromResult(NodeResult.Success(output));
}
}
NodeContext(string, OrchestrationContext, OrchestrationOptions, OrchestratorBase)
Initializes a new NodeContext with an explicit host orchestrator.
public NodeContext(string input, OrchestrationContext orchestration, OrchestrationOptions options, OrchestratorBase host)
Parameters
inputstringorchestrationOrchestrationContextoptionsOrchestrationOptionshostOrchestratorBase