Human in the Loop
Approval gates and review steps before irreversible or high-risk agent actions.
In plain words
For risky steps, the AI stops and asks a person to say yes, no or change it before it continues.
Think of it like…
A junior employee with spending authority: small purchases they make alone, larger ones need a manager's signature, and anything unusual gets escalated. The signature request must show what's being bought and why, or the manager just signs without reading.
Where you’ve seen it
A finance-operations agent can read invoices and draft payments freely, but payments over ₹50,000 or to a new vendor are held. The reviewer sees a card showing the vendor, amount, invoice image, the agent's reasoning and a diff against the last payment to that vendor, with Approve, Edit amount and Reject buttons. Over a quarter, 6 percent of actions need review; reviewers reject 4 percent of those and edit 9 percent, which the team uses to improve prompts. Auto-approved low-risk payments stay under a ₹5,000 daily cap with after-the-fact audit sampling.
Words you’ll hear
- Approval gate
- A mandatory pause before an action until a human approves.
- Risk tier
- A classification (low, medium, high) that decides whether an action runs automatically, needs review or is blocked.
- Escalation
- Routing a case to a human when confidence is low, rules are hit or the agent is stuck.
- Interrupt / resume
- Pausing a run with persisted state and continuing with the human's decision.
Visual diagram
Theory & deep dive
Where to put humans
Classify actions by reversibility and impact. Read-only and easily undone actions can run automatically; actions with limited, reversible effects may run with logging and after-the-fact sampling; irreversible, costly, external-facing or regulated actions (money movement, deleting data, production deploys, sending customer messages, legal or medical content) need approval. Thresholds can depend on amount, novelty (first time seeing this vendor), confidence, data sensitivity and the user's role. Start conservative and relax as evidence accumulates.
Patterns: pre-action approval (the agent proposes, the human approves), draft review (the agent writes, a human edits and sends), plan approval (approve the approach for a long job, then run autonomously), exception handling (the agent works alone until it hits uncertainty or a rule), and spot-check audits (sample completed autonomous actions). Where possible, let the reviewer edit the proposal rather than only accept or reject, and capture the edit as feedback.
Refunds ≤ ₹1,000: auto + log. ₹1,000–5,000: auto if customer history is clean, else review. > ₹5,000: always review. Any refund to a different payment method: review. Account deletion: review by two people.
Designing the review experience and the plumbing
A good approval request is self-contained: the action and its exact parameters, the reason, key evidence (documents, query results, retrieved policy), the risk it was flagged for, what will change if approved and what the alternatives are. Show diffs for edits, preselect safe defaults, and make rejection reasons easy to give. Avoid dumping the full transcript; reviewers decide from a concise summary with links to details. Measure review time, approval rates, edit rates and downstream errors, since a 100 percent approval rate may mean the gate is unnecessary or reviewers are rubber-stamping.
Technically, HITL needs durable state and interrupts: the run pauses (LangGraph interrupts, SDK approval hooks or your own workflow engine), the request is stored and delivered (queue, Slack, ticketing, in-app inbox), and the decision resumes the run, possibly hours later, with the same state. Handle timeouts (escalate, expire or fail safe), duplicate or conflicting decisions, authorisation of reviewers, audit logs (who approved what and when) and idempotent execution after approval. Also guard against approval bypass: the pause must be enforced in code (the tool refuses to run without a valid approval token), not just requested in the prompt.
def pay_vendor(invoice_id, approval_token=None): if risk(invoice_id) == "high" and not verify_approval(approval_token, invoice_id): raise ApprovalRequired(invoice_id) The model cannot talk its way past a check that lives in the tool.
How it works, step by step
Step 1 of 41. Tier the actions by risk
Classify each tool or action by reversibility, cost, external impact and regulation, and set thresholds.
- Start
- conservative
When to use it & trade-offs
What it is
Human in the loop (HITL) places people at decision points in an agent's workflow: approval gates before irreversible or high-risk actions (refunds, emails to customers, production changes), review of drafts or plans, escalation when the agent is unsure or stuck, and correction that feeds back into the system. Mechanically the agent pauses with a clear request (what it wants to do and why), waits for a decision (approve, reject, edit) and resumes, which requires persisted state. The skill is deciding where a human adds value without turning every step into a click.
Why it matters: Models make confident mistakes, tools have real consequences and some actions can't be undone. A well-placed approval turns a catastrophic failure into a rejected request, and review loops build trust to expand autonomy over time. Too many approvals cause fatigue, rubber-stamping and no real benefit, so designing risk tiers and good review interfaces matters as much as the agent itself.
When to reach for it
- Payments, deletions, deployments and customer-facing messages
- Long jobs where approving the plan once is enough
- Cases where the agent's confidence is low
When to avoid or be careful
- Approval prompts for trivial, reversible actions
- Approvals enforced only by prompt instructions
- Review cards without the evidence needed to decide
Levels of autonomy
Strengths: Maximum control.
Watch out: Slow; reviewer fatigue; little value from the agent.
Strengths: Humans focus on risky cases; agent handles routine ones.
Watch out: Requires a good risk policy and monitoring.
Strengths: Fast and cheap.
Watch out: Errors found only after the fact.
Interview signals & numbers to know
When this topic comes up
- “How do we keep a human in control of the agent?”
- “Reviewers just click approve”
- “What actions need approval?”
- Interrupt and resume
- Escalation policies
Benchmarks & rules of thumb
- 6%
- actions needing review in the example
- 4% / 9%
- review rejections / edits in the example
- ₹5,000 / ₹50,000
- auto and review thresholds in the example
Common mistakes & follow-ups
Common interview mistakes
- Asking for approval on every step until reviewers approve blindly.
- Relying on "ask the user first" in the prompt instead of a gate in code.
- Showing reviewers only "Approve payment?" without amount, vendor or evidence.
Likely interviewer follow-ups
- How would you decide which actions need human approval?
- How do you avoid approval fatigue?
- How do you implement a pause-and-resume approval flow?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Human in the Loop with generative AI interview Q&A and hands-on practice.