TodoCompletionLoopEvaluator Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A LoopEvaluator that keeps re-invoking the wrapped agent until a TodoProvider has no remaining (incomplete) todo items, optionally only while the agent is operating in one of a configured set of modes tracked by an AgentModeProvider.
public sealed class TodoCompletionLoopEvaluator : Microsoft.Agents.AI.LoopEvaluator
type TodoCompletionLoopEvaluator = class
inherit LoopEvaluator
Public NotInheritable Class TodoCompletionLoopEvaluator
Inherits LoopEvaluator
- Inheritance
Remarks
The required TodoProvider — and, when modes are configured, the AgentModeProvider — are not supplied directly. They are resolved at evaluation time from the looped agent via GetService<TService>(Object). This works because an agent surfaces its registered AIContextProvider instances through GetService, so a single TodoProvider (and AgentModeProvider) attached to the agent's session is discovered automatically. It also means this evaluator can be added directly to a harness agent's loop without any additional wiring.
When one or more modes are configured, the evaluator only requests re-invocation while the session's current mode is one of those modes; in any other mode it returns Stop() (which, per LoopAgent semantics, declines to drive continuation rather than vetoing other evaluators). When no modes are configured the evaluator applies in every mode and no AgentModeProvider is required.
While incomplete todos remain the evaluator continues with feedback built from a template (see FeedbackMessageTemplate) with the remaining todo list substituted for RemainingTodosPlaceholder. 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 |
|---|---|
| TodoCompletionLoopEvaluator(TodoCompletionLoopEvaluatorOptions) |
Initializes a new instance of the TodoCompletionLoopEvaluator class. |
Fields
| Name | Description |
|---|---|
| DefaultFeedbackMessageTemplate |
The default template used to build the feedback produced while incomplete todo items remain. |
| RemainingTodosPlaceholder |
The placeholder token within DefaultFeedbackMessageTemplate (or a custom FeedbackMessageTemplate) that is replaced, on each evaluation, with a formatted list of the remaining (incomplete) todo items. |
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. |