HandoffWorkflowBuilder Class

Definition

Provides a builder for specifying the handoff relationships between agents and building the resulting workflow.

public sealed class HandoffWorkflowBuilder : Microsoft.Agents.AI.Workflows.HandoffWorkflowBuilderCore<Microsoft.Agents.AI.Workflows.HandoffWorkflowBuilder>
type HandoffWorkflowBuilder = class
    inherit HandoffWorkflowBuilderCore<HandoffWorkflowBuilder>
Public NotInheritable Class HandoffWorkflowBuilder
Inherits HandoffWorkflowBuilderCore(Of HandoffWorkflowBuilder)
Inheritance

Constructors

Name Description
HandoffWorkflowBuilder(AIAgent)

Fields

Name Description
FunctionPrefix

The prefix for function calls that trigger handoffs to other agents; the full name is then {FunctionPrefix}&lt;agent_id&gt;, where &lt;agent_id&gt; is the ID of the target agent to hand off to.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)

Properties

Name Description
Description

Optional workflow description; applied to the inner WorkflowBuilder at Build().

(Inherited from OrchestrationBuilderBase<TBuilder>)
HandoffInstructions

Gets or sets additional instructions to provide to an agent that has handoffs about how and when to perform them.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
Name

Optional workflow name; applied to the inner WorkflowBuilder at Build().

(Inherited from OrchestrationBuilderBase<TBuilder>)
OutputDesignations

Memoized output designations. null means the user has not made any explicit designation, and the orchestration-specific defaults will be applied at Build() time. A non-null (possibly empty) map means the user took control and only these designations will be replayed onto the inner WorkflowBuilder. An entry's value is the set of tags requested for the agent — an empty set encodes a terminal-only designation.

(Inherited from OrchestrationBuilderBase<TBuilder>)

Methods

Name Description
AddParticipants(IEnumerable<AIAgent>)

Adds the specified agents as participants in the handoff workflow without defining handoff relationships for them.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
ApplyMetadata(WorkflowBuilder)

Applies the optional Name and Description to builder. Subclasses should call this from their Build() implementation.

(Inherited from OrchestrationBuilderBase<TBuilder>)
ApplyOutputDesignations(WorkflowBuilder, IReadOnlyDictionary<AIAgent,ExecutorBinding>, String, Action)

Applies the user's memoized output designations to builder, or invokes applyDefaults if the user made no explicit designation.

(Inherited from OrchestrationBuilderBase<TBuilder>)
Build()

Builds a Workflow composed of agents that operate via handoffs, with the next agent to process messages selected by the current agent.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
EmitAgentResponseEvents(Boolean)

Sets a value indicating whether aggregated agent response events should be emitted during execution.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
EmitAgentResponseUpdateEvents(Boolean)

Sets a value indicating whether agent streaming update events should be emitted during execution. If null, the value will be taken from the TurnToken

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
EnableReturnToPrevious()

Configures the workflow so that subsequent user turns route directly back to the specialist agent that handled the previous turn, rather than always routing through the initial (coordinator) agent.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithAutonomousMode(Nullable<Int32>, String, IEnumerable<AIAgent>, IReadOnlyDictionary<AIAgent,Int32>, IReadOnlyDictionary<AIAgent,String>)

Enables autonomous mode for the handoff workflow.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithDescription(String)

Sets the description for the workflow.

(Inherited from OrchestrationBuilderBase<TBuilder>)
WithHandoff(AIAgent, AIAgent, String)

Adds a handoff relationship from a source agent to a target agent with a custom handoff reason.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithHandoffInstructions(String)

Sets instructions to provide to each agent that has handoffs about how and when to perform them.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithHandoffs(AIAgent, IEnumerable<AIAgent>)

Adds handoff relationships from a source agent to one or more target agents.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithHandoffs(IEnumerable<AIAgent>, AIAgent, String)

Adds handoff relationships from one or more sources agent to a target agent.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithIntermediateOutputFrom(IEnumerable<AIAgent>)

Designates the given agents as sources of intermediate workflow output. See WithOutputFrom(IEnumerable<AIAgent>) for the defaults-suppression semantics.

(Inherited from OrchestrationBuilderBase<TBuilder>)
WithName(String)

Sets the human-readable name for the workflow.

(Inherited from OrchestrationBuilderBase<TBuilder>)
WithOutputFrom(IEnumerable<AIAgent>)

Designates the given agents as sources of terminal workflow output. Calling any output-designation method (this or WithIntermediateOutputFrom(IEnumerable<AIAgent>)) suppresses the orchestration-specific defaults: only the user-specified designations reach the inner WorkflowBuilder.

(Inherited from OrchestrationBuilderBase<TBuilder>)
WithTerminationCondition(Func<IReadOnlyList<ChatMessage>,Boolean>)

Sets a synchronous termination condition for the handoff workflow.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithTerminationCondition(Func<IReadOnlyList<ChatMessage>,ValueTask<Boolean>>)

Sets an asynchronous termination condition for the handoff workflow.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)
WithToolCallFilteringBehavior(HandoffToolCallFilteringBehavior)

Sets the behavior for filtering FunctionCallContent and Tool contents from ChatMessages flowing through the handoff workflow. Defaults to HandoffOnly.

(Inherited from HandoffWorkflowBuilderCore<TBuilder>)

Applies to