Sébastien Rigaux

Agent loops in C# with Microsoft Agent Framework

View resource

jesseliberty.com

Agent loops combine action, observation, and evaluation to refine an answer or retry an operation until it meets a criterion. Jesse Liberty demonstrates the pattern in C# with Microsoft Agent Framework: a loop agent, an evaluator, and an iteration limit.

The example contrasts a deterministic marker such as DONE with a model-based judge, then outlines safeguards to add: timeouts, idempotent calls, logging, and cost tracking. Each iteration adds latency and token usage.

Diagram of an agentic loop: the agent acts, observes, evaluates, then repeats or ends.