CompletionMarkerLoopEvaluator Class

Definition

A LoopEvaluator that stops the loop once a configured marker string appears in the agent's latest response, and otherwise continues with feedback asking the agent to keep working and to emit the marker when done.

public sealed class CompletionMarkerLoopEvaluator : Microsoft.Agents.AI.LoopEvaluator
type CompletionMarkerLoopEvaluator = class
    inherit LoopEvaluator
Public NotInheritable Class CompletionMarkerLoopEvaluator
Inherits LoopEvaluator
Inheritance
CompletionMarkerLoopEvaluator

Remarks

The feedback produced while the marker is absent is built from a template (see FeedbackMessageTemplate) with the configured marker substituted for CompletionMarkerPlaceholder, and the agent's latest response text substituted for LastResponsePlaceholder. How that feedback is delivered to the agent (and whether the session is reset) is decided by the LoopAgent that consumes this evaluator.

Constructors

Name Description
CompletionMarkerLoopEvaluator(String, CompletionMarkerLoopEvaluatorOptions)

Initializes a new instance of the CompletionMarkerLoopEvaluator class.

Fields

Name Description
CompletionMarkerPlaceholder

The placeholder token within DefaultFeedbackMessageTemplate (or a custom FeedbackMessageTemplate) that is replaced with the configured completion marker.

DefaultFeedbackMessageTemplate

The default template used to build the feedback produced while the completion marker is absent.

LastResponsePlaceholder

The placeholder token within a custom FeedbackMessageTemplate that is replaced with the text of the agent's latest response. This is substituted on each evaluation, so it lets the feedback echo back what the agent previously produced — useful when the consuming LoopAgent uses FreshContextPerIteration, where the agent would otherwise have no record of its prior output.

Methods

Name Description
EvaluateAsync(LoopContext, CancellationToken)

Evaluates the loop state after an iteration and decides whether to re-invoke the wrapped agent and what feedback to provide.

Applies to