Implement generative AI and agentic solutions 2.3 Optimize and operationalize generative AI systems

With Microsoft Agent Framework agent looping (experimental), you want a separate model to…

Study guide skill: Implement model reflection, chain-of-thought evaluations, and self-critique loops

Question B4-027

With Microsoft Agent Framework agent looping (experimental), you want a separate model to check each draft answer against criteria such as 'Answer every part of the request', and to send any gaps back to the agent for another attempt. Which setup matches the documentation?

Select one answer.

  • A Use a completion-marker loop evaluator so that the agent itself decides when its answer is done
  • B Use an AI judge loop with max_iterations set to None so that the judge can keep going until it's satisfied
  • C Use an AI judge loop that receives only the agent's latest response, not the original request
  • D Wrap the agent in an AI judge loop (AIJudgeLoopEvaluator in .NET, AgentLoopMiddleware.with_judge in Python), pass the criteria, and set a maximum number of iterations ✓ Correct answer

Answer: D

An AI judge loop uses a separate judge client that receives the original request and the latest response; when it finds a gap, its analysis becomes feedback for the next iteration. Autonomous loops should always be bounded, and max_iterations=None is only for predicates that are guaranteed to terminate. A completion-marker evaluator just checks the agent's own output for a marker, so no separate model reviews the answer.

Deep dive

How it works

Agent looping (experimental) in Microsoft Agent Framework reruns an agent until a completion condition is met. You choose the condition with an evaluator:

  • CompletionMarkerLoopEvaluator: continue while the latest response doesn't contain a configured marker.
  • TodoCompletionLoopEvaluator and BackgroundTaskCompletionLoopEvaluator: continue while to-do items or background tasks remain.
  • AIJudgeLoopEvaluator: continue while a separate judge client says the original request isn't fully answered.
  • DelegateLoopEvaluator: your own callback decides.

The AI judge is the one that matches "a separate model checks each draft against criteria". The judge receives the original request and the latest agent response. If it finds a gap, its analysis becomes feedback for the next iteration. In .NET you build an AIJudgeLoopEvaluator with Criteria and wrap the agent in a LoopAgent. In Python you use AgentLoopMiddleware.with_judge with criteria. In both, you set a maximum (the samples use 4; Python judge loops default to five).

The page is firm on bounds: always bound autonomous loops, and pass max_iterations=None only when the completion predicate is guaranteed to terminate. A judge's opinion isn't guaranteed to terminate. Also, only use a judge endpoint you trust with the original request and the generated response.

The other options, and when you'd use them

  • Completion-marker evaluator: It only checks the agent's own output for a marker. No separate model reviews the answer.
  • max_iterations=None: Autonomous loops should always be bounded, and None is only for predicates guaranteed to terminate.
  • Judge sees only the latest response: The judge receives the original request too. It needs it to tell whether every part was answered.

Exam tip

Separate model grades drafts against criteria = AI judge loop (AIJudgeLoopEvaluator / with_judge) with a max iteration count.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Generative AI & agents questions · AI-103 study guide

Thanks for your feedback!