AgentResponse.FinishReason Property

Definition

Gets or sets the reason for the agent response finishing.

public Microsoft.Extensions.AI.ChatFinishReason? FinishReason { get; set; }
member this.FinishReason : Nullable<Microsoft.Extensions.AI.ChatFinishReason> with get, set
Public Property FinishReason As Nullable(Of ChatFinishReason)

Property Value

A ChatFinishReason value indicating why the response finished (e.g., stop, length, content filter, tool calls), or null if the finish reason is not available.

Remarks

This property is particularly useful for detecting non-normal completions, such as content filtering or token limit truncation, which may require special handling by the caller.

Applies to