IPipelineRunResult
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework.Diagnostics¶
IPipelineRunResult Interface¶
Aggregated result of a multi-agent pipeline run, providing per-stage diagnostics alongside the response text from each agent.
Example¶
var result = await workflow.RunWithDiagnosticsAsync(
"Write an article about roses.",
diagnosticsAccessor,
cancellationToken: ct);
Console.WriteLine($"Pipeline {(result.Succeeded ? "succeeded" : "failed")} " +
$"in {result.TotalDuration.TotalSeconds:F1}s");
Console.WriteLine($"Total tokens: {result.AggregateTokenUsage?.TotalTokens ?? 0}");
Console.WriteLine($"Stages: {result.Stages.Count}");
Remarks¶
Returned by RunWithDiagnosticsAsync extension methods on
Microsoft.Agents.AI.Workflows.Workflow. Contains the full execution
timeline: each agent's response text, token usage, duration, and success/failure
state.
Properties¶
IPipelineRunResult.AggregateTokenUsage Property¶
Gets the aggregate token usage across all stages. null if diagnostics were not enabled.
Property Value¶
IPipelineRunResult.ErrorMessage Property¶
Gets the error message if any stage failed.
Property Value¶
IPipelineRunResult.Exception Property¶
Gets the exception that caused the pipeline to fail, or null on success. Preserves the full exception including inner exceptions and stack trace for diagnostic purposes.
Property Value¶
IPipelineRunResult.Responses Property¶
Gets the responses as a dictionary (agent name → response text).
Property Value¶
System.Collections.Generic.IReadOnlyDictionary<System.String,System.String>
IPipelineRunResult.Stages Property¶
Gets the per-stage results in execution order.
System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentStageResult> Stages { get; }
Property Value¶
System.Collections.Generic.IReadOnlyList<IAgentStageResult>
IPipelineRunResult.Succeeded Property¶
Gets whether all stages completed successfully.
Property Value¶
IPipelineRunResult.TotalDuration Property¶
Gets the total wall-clock duration of the pipeline.