Method Failed
- Namespace
- LMKit.Agents.Orchestration.Nodes
- Assembly
- LM-Kit.NET.dll
Failed(Exception, AgentExecutionResult)
Creates a failed node result.
public static NodeResult Failed(Exception error, AgentExecutionResult agentResult = null)
Parameters
errorExceptionagentResultAgentExecutionResult
Returns
Examples
Surfacing a thrown exception as a graph-level failure:
using LMKit.Agents.Orchestration.Nodes;
public sealed class HttpFetchNode : IOrchestrationNode
{
public string Name => "fetch";
public async Task<NodeResult> InvokeAsync(NodeContext context, CancellationToken ct)
{
try
{
string body = await new HttpClient().GetStringAsync(context.Input, ct);
return NodeResult.Success(body);
}
catch (Exception ex) { return NodeResult.Failed(ex); }
}
}