Implement generative AI and agentic solutions 2.2 Build agents by using Foundry

With Microsoft Agent Framework agent looping (experimental), a LoopAgent wraps an agent…

Study guide skill: Build autonomous or semiautonomous workflows with safeguards and approval flow controls

Question B6-023

With Microsoft Agent Framework agent looping (experimental), a LoopAgent wraps an agent whose tool requires human approval. During one iteration, the agent returns a pending tool-approval request. What happens?

Select one answer.

  • A The loop stops before evaluating its completion condition and returns the request to the caller; after the caller supplies the approval response through the normal tool approval flow, the agent can continue ✓ Correct answer
  • B LoopAgent approves the request automatically so that the loop can keep iterating
  • C The completion evaluator decides whether the pending request is approved
  • D The loop hides the request and runs another autonomous iteration until it reaches its maximum

Answer: A

LoopAgent stops before evaluating its completion condition when an iteration returns a pending tool-approval request and returns it to the caller instead of hiding it behind another iteration. LoopAgent doesn't add approval handling itself, so the caller answers through the normal tool approval flow and the agent continues. The completion condition isn't evaluated for that iteration.

Deep dive

How it works

Agent looping in Microsoft Agent Framework is experimental. LoopAgent wraps an agent and re-runs it until a completion condition is met. Agent looping has a specific rule for human-in-the-loop tools:

  • When an iteration returns a pending tool-approval request, LoopAgent stops before evaluating its completion condition.
  • It returns the request to the caller instead of hiding it behind another autonomous iteration.
  • After the caller supplies the approval response through the normal tool approval flow, the agent can continue.
  • LoopAgent doesn't add approval handling itself.

The Harness Agent setup relies on this. It applies the loop outside its approval handling (ToolApprovalAgent in .NET), so pending approval requests escape the loop to the caller. Python's AgentLoopMiddleware behaves the same way.

The other options, and when you'd use them

  • LoopAgent approves automatically: It doesn't add approval handling at all. The caller answers through the normal approval flow.
  • The completion evaluator decides: The loop stops before evaluating its completion condition, so the completion check doesn't run for that iteration.
  • Hide the request and keep iterating: The docs say the opposite: the request is returned instead of being hidden behind another autonomous iteration.

Exam tip

Loop + pending approval = stop, hand the request back to the caller, continue after approval. The loop doesn't approve for you.

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!