Share via


DurableAgentsOptionsExtensions.AddAIAgent Method

Definition

Overloads

Name Description
AddAIAgent(DurableAgentsOptions, AIAgent, Action<FunctionsAgentOptions>)

Adds an AI agent to the specified DurableAgentsOptions instance and optionally configures agent-specific options.

AddAIAgent(DurableAgentsOptions, AIAgent, Boolean, Boolean)

Adds an AI agent to the specified options and configures trigger support for HTTP and MCP tool invocations.

AddAIAgent(DurableAgentsOptions, AIAgent, Action<FunctionsAgentOptions>)

Adds an AI agent to the specified DurableAgentsOptions instance and optionally configures agent-specific options.

public static Microsoft.Agents.AI.DurableTask.DurableAgentsOptions AddAIAgent(this Microsoft.Agents.AI.DurableTask.DurableAgentsOptions options, Microsoft.Agents.AI.AIAgent agent, Action<Microsoft.Agents.AI.Hosting.AzureFunctions.FunctionsAgentOptions>? configure);
static member AddAIAgent : Microsoft.Agents.AI.DurableTask.DurableAgentsOptions * Microsoft.Agents.AI.AIAgent * Action<Microsoft.Agents.AI.Hosting.AzureFunctions.FunctionsAgentOptions> -> Microsoft.Agents.AI.DurableTask.DurableAgentsOptions
<Extension()>
Public Function AddAIAgent (options As DurableAgentsOptions, agent As AIAgent, configure As Action(Of FunctionsAgentOptions)) As DurableAgentsOptions

Parameters

options
DurableAgentsOptions

The DurableAgentsOptions instance to which the AI agent will be added.

agent
AIAgent

The AI agent to add. The agent's Name property must not be null or empty.

configure
Action<FunctionsAgentOptions>

An optional delegate to configure agent-specific options. If null, default options are used.

Returns

The updated DurableAgentsOptions instance containing the added AI agent.

Applies to

AddAIAgent(DurableAgentsOptions, AIAgent, Boolean, Boolean)

Adds an AI agent to the specified options and configures trigger support for HTTP and MCP tool invocations.

public static Microsoft.Agents.AI.DurableTask.DurableAgentsOptions AddAIAgent(this Microsoft.Agents.AI.DurableTask.DurableAgentsOptions options, Microsoft.Agents.AI.AIAgent agent, bool enableHttpTrigger, bool enableMcpToolTrigger);
static member AddAIAgent : Microsoft.Agents.AI.DurableTask.DurableAgentsOptions * Microsoft.Agents.AI.AIAgent * bool * bool -> Microsoft.Agents.AI.DurableTask.DurableAgentsOptions
<Extension()>
Public Function AddAIAgent (options As DurableAgentsOptions, agent As AIAgent, enableHttpTrigger As Boolean, enableMcpToolTrigger As Boolean) As DurableAgentsOptions

Parameters

options
DurableAgentsOptions

The options collection to which the AI agent will be added. Cannot be null.

agent
AIAgent

The AI agent to add. The agent's Name property must not be null or empty.

enableHttpTrigger
Boolean

true to enable an HTTP trigger for the agent; otherwise, false.

enableMcpToolTrigger
Boolean

true to enable an MCP tool trigger for the agent; otherwise, false.

Returns

The updated DurableAgentsOptions instance with the specified AI agent and trigger configuration applied.

Remarks

If an agent with the same name already exists in the options, its configuration will be updated. Both triggers can be enabled independently. This method supports method chaining by returning the provided options instance.

Applies to