Share via


TerminationStrategy.ShouldTerminateAsync Method

Definition

Evaluates the input message and determines if the chat has met its completion criteria.

public System.Threading.Tasks.Task<bool> ShouldTerminateAsync(Microsoft.SemanticKernel.Agents.Agent agent, System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> history, System.Threading.CancellationToken cancellationToken = default);
member this.ShouldTerminateAsync : Microsoft.SemanticKernel.Agents.Agent * System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function ShouldTerminateAsync (agent As Agent, history As IReadOnlyList(Of ChatMessageContent), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)

Parameters

agent
Agent

The agent actively interacting with the chat.

history
IReadOnlyList<ChatMessageContent>

The most recent message.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

true if the chat loop should be terminated.

Applies to