ChatClientAgent Constructors

Definition

Overloads

ChatClientAgent(IChatClient, ChatClientAgentOptions, ILoggerFactory, IServiceProvider)

Initializes a new instance of the ChatClientAgent class.

public ChatClientAgent(Microsoft.Extensions.AI.IChatClient chatClient, Microsoft.Agents.AI.ChatClientAgentOptions? options, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, IServiceProvider? services = default);
new Microsoft.Agents.AI.ChatClientAgent : Microsoft.Extensions.AI.IChatClient * Microsoft.Agents.AI.ChatClientAgentOptions * Microsoft.Extensions.Logging.ILoggerFactory * IServiceProvider -> Microsoft.Agents.AI.ChatClientAgent
Public Sub New (chatClient As IChatClient, options As ChatClientAgentOptions, Optional loggerFactory As ILoggerFactory = Nothing, Optional services As IServiceProvider = Nothing)

Parameters

chatClient
IChatClient

The chat client to use when running the agent.

options
ChatClientAgentOptions

Configuration options that control all aspects of the agent's behavior, including chat settings, chat history provider factories, context provider factories, and other advanced configurations.

loggerFactory
ILoggerFactory

Optional logger factory for creating loggers used by the agent and its components.

services
IServiceProvider

Optional service provider for resolving dependencies required by AI functions and other agent components. This is particularly important when using custom tools that require dependency injection. This is only relevant when the IChatClient doesn't already contain a FunctionInvokingChatClient and the ChatClientAgent needs to insert one.

Exceptions

chatClient is null.

Applies to

ChatClientAgent(IChatClient, String, String, String, IList<AITool>, ILoggerFactory, IServiceProvider)

Initializes a new instance of the ChatClientAgent class.

public ChatClientAgent(Microsoft.Extensions.AI.IChatClient chatClient, string? instructions = default, string? name = default, string? description = default, System.Collections.Generic.IList<Microsoft.Extensions.AI.AITool>? tools = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, IServiceProvider? services = default);
new Microsoft.Agents.AI.ChatClientAgent : Microsoft.Extensions.AI.IChatClient * string * string * string * System.Collections.Generic.IList<Microsoft.Extensions.AI.AITool> * Microsoft.Extensions.Logging.ILoggerFactory * IServiceProvider -> Microsoft.Agents.AI.ChatClientAgent
Public Sub New (chatClient As IChatClient, Optional instructions As String = Nothing, Optional name As String = Nothing, Optional description As String = Nothing, Optional tools As IList(Of AITool) = Nothing, Optional loggerFactory As ILoggerFactory = Nothing, Optional services As IServiceProvider = Nothing)

Parameters

chatClient
IChatClient

The chat client to use when running the agent.

instructions
String

Optional system instructions that guide the agent's behavior. These instructions are provided to the IChatClient with each invocation to establish the agent's role and behavior.

name
String

Optional name for the agent. This name is used for identification and logging purposes.

description
String

Optional human-readable description of the agent's purpose and capabilities. This description can be useful for documentation and agent discovery scenarios.

tools
IList<AITool>

Optional collection of tools that the agent can invoke during conversations. These tools augment any tools that may be provided to the agent via Tools when the agent is run.

loggerFactory
ILoggerFactory

Optional logger factory for creating loggers used by the agent and its components.

services
IServiceProvider

Optional service provider for resolving dependencies required by AI functions and other agent components. This is particularly important when using custom tools that require dependency injection. This is only relevant when the IChatClient doesn't already contain a FunctionInvokingChatClient and the ChatClientAgent needs to insert one.

Exceptions

chatClient is null.

Applies to