Skip to content

IChatClientAccessor

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Iterative

IChatClientAccessor Interface

Provides access to the configured Microsoft.Extensions.AI.IChatClient from the agent framework pipeline, including any middleware (diagnostics, token budget) that was wired via UsingDiagnostics(), UsingTokenBudget(), etc.

public interface IChatClientAccessor

Remarks

This is the same Microsoft.Extensions.AI.IChatClient instance that IAgentFactory uses internally when creating agents. Exposing it separately allows components like IIterativeAgentLoop to make raw LLM calls without going through the FunctionInvokingChatClient that AIAgent wraps around the client.

The client is lazily created on first access and cached for the lifetime of the service provider.

Properties

IChatClientAccessor.ChatClient Property

Gets the configured Microsoft.Extensions.AI.IChatClient with all middleware applied.

Microsoft.Extensions.AI.IChatClient ChatClient { get; }

Property Value

Microsoft.Extensions.AI.IChatClient