Skip to content

AgentRunDiagnosticsContext

NexusLabs.Needlr.AgentFramework.Evaluation

AgentRunDiagnosticsContext Class

Carries an NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics snapshot through the Microsoft.Extensions.AI.Evaluation evaluator pipeline so that Needlr-native deterministic evaluators can score execution-mode, tool-call trajectory, and termination behaviour without being re-invoked against the LLM.

public sealed class AgentRunDiagnosticsContext : Microsoft.Extensions.AI.Evaluation.EvaluationContext

Inheritance System.Object 🡒 Microsoft.Extensions.AI.Evaluation.EvaluationContext 🡒 AgentRunDiagnosticsContext

Remarks

Evaluators that require the raw diagnostics snapshot (for example, ToolCallTrajectoryEvaluator) look up the single instance of this context in the additionalContext collection passed to Microsoft.Extensions.AI.Evaluation.IEvaluator.EvaluateAsync(System.Collections.Generic.IEnumerable{Microsoft.Extensions.AI.ChatMessage},Microsoft.Extensions.AI.ChatResponse,Microsoft.Extensions.AI.Evaluation.ChatConfiguration,System.Collections.Generic.IEnumerable{Microsoft.Extensions.AI.Evaluation.EvaluationContext},System.Threading.CancellationToken).

Microsoft.Extensions.AI.Evaluation.EvaluationContext.Contents contains a single Microsoft.Extensions.AI.TextContent summarising the diagnostics so that reporting pipelines which only serialise Microsoft.Extensions.AI.Evaluation.EvaluationContext.Contents still record meaningful information. Consumers that need the full snapshot read Diagnostics directly.

Constructors

AgentRunDiagnosticsContext(IAgentRunDiagnostics) Constructor

Initializes a new instance of the AgentRunDiagnosticsContext class.

public AgentRunDiagnosticsContext(NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics diagnostics);

Parameters

diagnostics NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics

The captured agent-run diagnostics to expose to evaluators.

Exceptions

System.ArgumentNullException
diagnostics is null.

Fields

AgentRunDiagnosticsContext.ContextName Field

The stable name used for this context. Evaluators can locate the context by matching Microsoft.Extensions.AI.Evaluation.EvaluationContext.Name against this value.

public const string ContextName = "Needlr Agent Run Diagnostics";

Field Value

System.String

Properties

AgentRunDiagnosticsContext.Diagnostics Property

Gets the captured diagnostics snapshot.

public NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics Diagnostics { get; }

Property Value

NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics