Skip to content

IDiagnosticsSink

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Diagnostics

IDiagnosticsSink Interface

Accepts diagnostic records produced during an agent run. Writers (middleware, orchestration loops) call these methods to record individual chat completions and tool calls. The sink is responsible for storage and aggregation.

public interface IDiagnosticsSink

Derived
AgentRunDiagnosticsBuilder
TeeDiagnosticsSink

Remarks

Each event class (chat completion, tool call) should have exactly one writer. Two writers recording the same logical event is a bug — the sink does not deduplicate. Use the single-writer middleware pattern to prevent this.

Today's concrete implementation is AgentRunDiagnosticsBuilder. Future implementations may fan out to multiple storage backends (in-memory, file, progress reporter).

Properties

IDiagnosticsSink.AgentName Property

Gets the name of the agent associated with this sink, or null if unknown. Writers use this to attribute diagnostic records to the correct agent.

string? AgentName { get; }

Property Value

System.String

Methods

IDiagnosticsSink.AddChatCompletion(ChatCompletionDiagnostics) Method

Records a completed chat completion call.

void AddChatCompletion(NexusLabs.Needlr.AgentFramework.Diagnostics.ChatCompletionDiagnostics diagnostics);

Parameters

diagnostics ChatCompletionDiagnostics

IDiagnosticsSink.AddToolCall(ToolCallDiagnostics) Method

Records a completed tool call.

void AddToolCall(NexusLabs.Needlr.AgentFramework.Diagnostics.ToolCallDiagnostics diagnostics);

Parameters

diagnostics ToolCallDiagnostics

IDiagnosticsSink.NextChatCompletionSequence() Method

Reserves a sequence number for a chat completion (thread-safe).

int NextChatCompletionSequence();

Returns

System.Int32

IDiagnosticsSink.NextToolCallSequence() Method

Reserves a sequence number for a tool call (thread-safe).

int NextToolCallSequence();

Returns

System.Int32