DiagnosticsFunctionInvokingChatClient
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework.Diagnostics¶
DiagnosticsFunctionInvokingChatClient Class¶
A Microsoft.Extensions.AI.FunctionInvokingChatClient that records per-tool-call diagnostics,
OTel metrics, and Activity spans for every function invocation. This is the MEAI-native
equivalent of the MAF DiagnosticsFunctionCallingMiddleware in Workflows.
public sealed class DiagnosticsFunctionInvokingChatClient : Microsoft.Extensions.AI.FunctionInvokingChatClient
Inheritance System.Object 🡒 Microsoft.Extensions.AI.DelegatingChatClient 🡒 Microsoft.Extensions.AI.FunctionInvokingChatClient 🡒 DiagnosticsFunctionInvokingChatClient
Remarks¶
Use this when the chat pipeline includes FunctionInvokingChatClient (auto
tool calling) rather than the IterativeAgentLoop. The loop does its own
tool-call recording; using both would produce duplicates.
Records are written to the AsyncLocal AgentRunDiagnosticsBuilder and OTel metrics via IAgentMetrics. Progress events are emitted to IProgressReporterAccessor when available.
Constructors¶
DiagnosticsFunctionInvokingChatClient(IChatClient, IAgentMetrics, IProgressReporterAccessor) Constructor¶
Creates a new diagnostics-enabled Microsoft.Extensions.AI.FunctionInvokingChatClient.
public DiagnosticsFunctionInvokingChatClient(Microsoft.Extensions.AI.IChatClient innerClient, NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentMetrics? metrics=null, NexusLabs.Needlr.AgentFramework.Progress.IProgressReporterAccessor? progressAccessor=null);
Parameters¶
innerClient Microsoft.Extensions.AI.IChatClient
The inner chat client to delegate to.
metrics IAgentMetrics
Optional OTel metrics recorder.
progressAccessor IProgressReporterAccessor
Optional progress reporter for real-time events.