Share via


AIAgentExtensions.RunAIAgentAsync Method

Definition

Overloads

Name Description
RunAIAgentAsync(AIAgent, ILoggerFactory, String)

Runs an AI agent asynchronously with an optional logger factory.

RunAIAgentAsync(AIAgent, IServiceProvider, String)

Runs an AI agent asynchronously using the provided service provider.

RunAIAgentAsync(IServiceProvider, AIAgent, String)

Runs an AI agent asynchronously using the service provider's dependencies.

RunAIAgentAsync(AIAgent, ILoggerFactory, String)

Source:
AIAgentExtensions.cs

Runs an AI agent asynchronously with an optional logger factory.

public static System.Threading.Tasks.Task RunAIAgentAsync(this Microsoft.Agents.AI.AIAgent agent, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, string telemetrySourceName = "Agents");
static member RunAIAgentAsync : Microsoft.Agents.AI.AIAgent * Microsoft.Extensions.Logging.ILoggerFactory * string -> System.Threading.Tasks.Task
<Extension()>
Public Function RunAIAgentAsync (agent As AIAgent, Optional loggerFactory As ILoggerFactory = Nothing, Optional telemetrySourceName As String = "Agents") As Task

Parameters

agent
AIAgent

The AI agent to run.

loggerFactory
ILoggerFactory

Optional logger factory for creating loggers.

telemetrySourceName
String

The name of the telemetry source. Defaults to "Agents".

Returns

A task that represents the asynchronous operation.

Applies to

RunAIAgentAsync(AIAgent, IServiceProvider, String)

Source:
AIAgentExtensions.cs

Runs an AI agent asynchronously using the provided service provider.

public static System.Threading.Tasks.Task RunAIAgentAsync(this Microsoft.Agents.AI.AIAgent agent, IServiceProvider sp, string telemetrySourceName = "Agents");
static member RunAIAgentAsync : Microsoft.Agents.AI.AIAgent * IServiceProvider * string -> System.Threading.Tasks.Task
<Extension()>
Public Function RunAIAgentAsync (agent As AIAgent, sp As IServiceProvider, Optional telemetrySourceName As String = "Agents") As Task

Parameters

agent
AIAgent

The AI agent to run.

sp
IServiceProvider

The service provider for dependency injection.

telemetrySourceName
String

The name of the telemetry source. Defaults to "Agents".

Returns

A task that represents the asynchronous operation.

Applies to

RunAIAgentAsync(IServiceProvider, AIAgent, String)

Source:
AIAgentExtensions.cs

Runs an AI agent asynchronously using the service provider's dependencies.

public static System.Threading.Tasks.Task RunAIAgentAsync(this IServiceProvider sp, Microsoft.Agents.AI.AIAgent? agent = default, string telemetrySourceName = "Agents");
static member RunAIAgentAsync : IServiceProvider * Microsoft.Agents.AI.AIAgent * string -> System.Threading.Tasks.Task
<Extension()>
Public Function RunAIAgentAsync (sp As IServiceProvider, Optional agent As AIAgent = Nothing, Optional telemetrySourceName As String = "Agents") As Task

Parameters

sp
IServiceProvider

The service provider for dependency injection.

agent
AIAgent

Optional AI agent to run. If null, retrieves from service provider.

telemetrySourceName
String

The name of the telemetry source. Defaults to "Agents".

Returns

A task that represents the asynchronous operation.

Applies to