Skip to content

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.

public interface IPipelineRunResult

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.

NexusLabs.Needlr.AgentFramework.Diagnostics.TokenUsage? AggregateTokenUsage { get; }

Property Value

TokenUsage

IPipelineRunResult.ErrorMessage Property

Gets the error message if any stage failed.

string? ErrorMessage { get; }

Property Value

System.String

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.

System.Exception? Exception { get; }

Property Value

System.Exception

IPipelineRunResult.Responses Property

Gets the responses as a dictionary (agent name → response text).

System.Collections.Generic.IReadOnlyDictionary<string,string> Responses { get; }

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.

bool Succeeded { get; }

Property Value

System.Boolean

IPipelineRunResult.TotalDuration Property

Gets the total wall-clock duration of the pipeline.

System.TimeSpan TotalDuration { get; }

Property Value

System.TimeSpan