Human-in-the-Loop Agent Flows
Design approval workflows, live agent transfers, and confidence-based escalation patterns that keep humans in control.
Why Humans Stay in the Loop
Imagine a self-checkout machine at a supermarket. It handles 90% of transactions on its own. But when you try to buy alcohol, it flashes a light and waits for a human to verify your age. That pause-and-wait is human-in-the-loop.
Your agent works the same way. It handles routine requests automatically, but when something is high-stakes, ambiguous, or outside its authority, it pauses and brings in a human β an approver, a live agent, or a subject-matter expert.
Four HITL Patterns Compared
| Feature | Approval Flow | Live Agent Transfer | Confidence Escalation | Human Review Queue |
|---|---|---|---|---|
| What happens | Agent pauses, sends an approval request, resumes when approved or rejected | Agent hands the entire conversation to a human agent in a contact centre | Agent checks its confidence score and escalates if below threshold | Agent creates a review task for a human to validate before the result is finalised |
| Conversation state | Paused β agent waits, then resumes with the decision | Replaced β human takes over completely, AI does not resume | Paused or replaced depending on confidence level | Continues β user may get a preliminary response pending review |
| Technical mechanism | Power Automate approval actions inside an agent flow | Transfer to agent node in topic, or Omnichannel/Direct Line handoff | Condition node checking system confidence variable, then branch | Agent flow creates a Dataverse record or Planner task for review |
| Best for | Financial approvals, access requests, exception handling | Complex issues the agent cannot resolve, frustrated customers | Low-confidence AI responses where wrong answers carry risk | Regulated processes requiring audit trail of human validation |
| User experience | Told to wait β may take minutes to hours | Seamless handoff β user continues chatting with a human | User may not notice if escalation is fast | Gets preliminary answer with a pending-review disclaimer |
Building an Approval Flow
An approval flow follows these steps:
- Agent topic collects the request β the user says βI need to process a claim for $15,000β and the topic gathers claim details into variables.
- Topic calls an agent flow β the flow receives claim details as input parameters.
- Flow sends an approval request β using the βStart and wait for an approvalβ action. The approver receives a notification in Teams, Outlook, or the Approvals app.
- Flow waits β the conversation is paused. The agent optionally tells the user βYour request has been submitted for approval.β
- Approver responds β Approve or Reject, with optional comments.
- Flow returns the decision β output parameters include the approval outcome, approver comments, and timestamp.
- Topic resumes β branches on the outcome. Approved: proceed with processing. Rejected: inform the user with the reason.
The critical point: the entire conversation is paused during the approval wait. For approvals that take hours or days, consider an async notification pattern β submit the request, end the conversation gracefully, and notify the user via email or Teams when the decision arrives.
Transfer Methods: Omnichannel vs Direct Line
When the agent needs to hand off to a live human, two transfer mechanisms are available:
| Aspect | Omnichannel for Customer Service | Direct Line or Custom |
|---|---|---|
| Setup | Requires D365 Customer Service with Omnichannel enabled | Custom web app or Bot Framework integration |
| Routing | Uses Omnichannel unified routing β skills, queues, presence | Developer manages routing logic |
| Context transfer | Full conversation transcript and variables passed automatically | Developer must serialise and pass context |
| Agent desktop | Customer Service workspace in D365 | Custom UI or third-party tool |
| Best for | Enterprise contact centres already on D365 | ISVs embedding agents in custom apps |
Exam tip: Transfer replaces, Approval pauses and resumes
This distinction is tested directly. When an agent transfers to a live agent, the AI agent is replaced β the human takes over the conversation completely and the AI does not resume. When an agent sends an approval request, the conversation is paused β the AI waits for the approval decision and then resumes exactly where it left off.
If a question describes a scenario where the agent should βcontinue the conversation after a human decision,β the answer is an approval flow, not a transfer.
π¦ Kai Sets Up Claims Approval at Pacific Mutual
Kai is configuring the insurance claims agent at Pacific Mutual (15,000 employees). Company policy requires manager approval for any claim above $10,000.
The requirement: When a customer submits a claim over $10,000, the agent must pause, request manager approval, and only proceed after approval is granted.
Step 1: Kai creates a topic with trigger phrases like βsubmit a claimβ and βfile a claim.β The topic collects claim type, amount, policy number, and description.
Step 2: He adds a Condition node: Topic.ClaimAmount > 10000. Claims at or below $10,000 process automatically via a standard agent flow.
Step 3: For claims above the threshold, the topic calls an approval flow. The flow uses βStart and wait for an approvalβ with the approver set to the claimantβs manager (looked up from Dataverse). The approval request includes claim amount, type, and policy number.
Step 4: The flow returns approvalOutcome (Approved or Rejected), approverComments, and approvalTimestamp. The topic branches: Approved leads to claim processing; Rejected sends the user a message with the rejection reason.
Step 5: Kai adds a timeout β if no approval arrives within 48 hours, the flow returns success = false with errorMessage = "Approval timed out β please contact your manager directly." This prevents conversations from hanging indefinitely.
π₯ Lena Designs Pharmacist Review for Medication Queries
Lena is building a healthcare AI agent that helps patients understand their medications. When a patient asks about drug interactions, the agent provides general information from approved medical databases. However, hospital policy requires that any specific dosage recommendation must be reviewed by a pharmacist before being shared with the patient.
The pattern: Human review queue. The agent generates a preliminary answer, creates a review task in Dataverse assigned to the on-duty pharmacist, and tells the patient: βIβve prepared some information about your medication. A pharmacist will review and confirm it shortly.β
Why not a live transfer? The pharmacist is not a contact centre agent β they review clinical content asynchronously. The conversation does not need real-time back-and-forth.
Why not an approval flow? The pharmacist is not simply approving or rejecting β they may modify the content. A Dataverse record with the draft response, patient context, and a status field (Pending Review, Approved, Modified) gives the pharmacist the right workflow.
Key Terms
Knowledge Check
Kai's insurance agent at Pacific Mutual needs to pause when a claim exceeds $10,000, wait for manager approval, and resume processing afterward. Which HITL pattern should he use?
Lena's healthcare agent generates medication information that a pharmacist must review and may modify before sharing with the patient. Which pattern fits best?
π¬ Video coming soon
Human-in-the-Loop Agent Flows
Next up: Topics, Tools and Variables β the building blocks of agent conversations: triggers, tool integration, and variable management.