Share via


AgentRunMode Class

Definition

Specifies how the A2A hosting layer determines whether to run AIAgent in background or not.

public sealed class AgentRunMode : IEquatable<Microsoft.Agents.AI.Hosting.A2A.AgentRunMode>
type AgentRunMode = class
    interface IEquatable<AgentRunMode>
Public NotInheritable Class AgentRunMode
Implements IEquatable(Of AgentRunMode)
Inheritance
AgentRunMode
Implements

Properties

Name Description
AllowBackgroundIfSupported

Allows the background responses from the agent. Is equivalent to configuring AllowBackgroundResponses as true. In the A2A protocol terminology will make responses be returned as AgentTask if the agent supports background responses, and as AgentMessage otherwise.

DisallowBackground

Dissallows the background responses from the agent. Is equivalent to configuring AllowBackgroundResponses as false. In the A2A protocol terminology will make responses be returned as AgentMessage.

Methods

Name Description
AllowBackgroundWhen(Func<A2ARunDecisionContext,CancellationToken,ValueTask<Boolean>>)

The agent run mode is decided by the supplied runInBackground delegate. The delegate receives an A2ARunDecisionContext with the incoming message and returns a boolean specifying whether to run the agent in background mode. true indicates that the agent should run in background mode and return an AgentTask if the agent supports background mode; otherwise, it returns an AgentMessage if the mode is not supported. false indicates that the agent should run in non-background mode and return an AgentMessage.

Equals(AgentRunMode)

Indicates whether the current object is equal to another object of the same type.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

ToString()

Returns a string that represents the current object.

Operators

Name Description
Equality(AgentRunMode, AgentRunMode)

Determines whether two AgentRunMode instances are equal.

Inequality(AgentRunMode, AgentRunMode)

Determines whether two AgentRunMode instances are not equal.

Applies to