Share via


AIAgentExtensions.AsBuilder(AIAgent) Method

Definition

Creates a new AIAgentBuilder using the specified agent as the foundation for the builder pipeline.

public static Microsoft.Agents.AI.AIAgentBuilder AsBuilder(this Microsoft.Agents.AI.AIAgent innerAgent);
static member AsBuilder : Microsoft.Agents.AI.AIAgent -> Microsoft.Agents.AI.AIAgentBuilder
<Extension()>
Public Function AsBuilder (innerAgent As AIAgent) As AIAgentBuilder

Parameters

innerAgent
AIAgent

The AIAgent instance to use as the inner agent.

Returns

A new AIAgentBuilder instance configured with the specified inner agent.

Exceptions

innerAgent is null.

Remarks

This method provides a convenient way to convert an existing AIAgent instance into a builder pattern, enabling easily wrapping the agent in layers of additional functionality. It is functionally equivalent to using the AIAgentBuilder(AIAgent) constructor directly, but provides a more fluent API when working with existing agent instances.

Applies to