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.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