Human-in-the-Loop and Approval Gates
Put people where their judgment changes outcomes, and make sure the system cannot skip them.
Human-in-the-loop design lets an agent prepare work while a person decides selected actions. A gate must be enforced by code outside the model, show the exact action and its evidence, record the decision, expire, and recheck facts before executing. Send only cases that need judgment to people, size the review team for the volume and watch whether reviews actually catch problems.
What you will learn: kinds of human involvement, policy and approval gates, a request lifecycle, building the step, a workflow template, a reference architecture and reviewer capacity.
Prerequisites: Tool Permissions, Approvals and Abuse Risks and Stateful and Long-Running Agent Architecture.
Four kinds of involvement
| Mode | The person | Suits |
|---|---|---|
| Approve before action | Decides each flagged action | Consequential or irreversible steps |
| Review after action | Checks samples or all results | Reversible, lower-risk work |
| Handle exceptions | Takes cases the agent cannot finish | Mostly routine processes |
| Supervise | Watches, pauses and changes limits | High-volume operation |
Choose per action, not per agent. One assistant may read freely, create drafts with later sampling and require approval to send.
Say what the person is for
"A human reviews it" is not a design. Name the judgment you need and check that the reviewer can make it with what is on screen.
| Purpose | The reviewer needs |
|---|---|
| Catch factual errors | Sources next to claims and time to compare |
| Apply business discretion | Customer history, limits and policy |
| Accept legal responsibility | Authority, full content and a clear record |
| Stop harmful actions | Target, effect, reversibility and unusual features |
| Teach the system | Reason codes that feed evaluation |
If a rule in code can make the judgment reliably, use the rule and keep people for the rest.
The core architecture
An instruction such as "ask before paying" is not a control. The payment tool itself must refuse to run without a valid approval for that exact payment.
Request states
Add states for "executing" and "outcome unknown" when the action calls an outside service. An approval should not become executable again merely because a reply was lost. Cancellation by the requester should be possible until execution starts, and the record should show who canceled and why.
Policy decides who needs to look
| Rule input | Example rule |
|---|---|
| Action type | All deletions require approval |
| Amount | Refunds above a set value need a lead |
| Recipient | New external recipients require review |
| Data class | Restricted data may not leave, approved or not |
| Context | Untrusted content in the task raises the level |
| Uncertainty | Conflicting evidence goes to a person |
| History | Too many actions in a period pauses the agent |
Do not rely on the model's own confidence statement as the main trigger. Prefer facts that code can check. Keep rules in one reviewed, versioned place, deny when a rule cannot be evaluated and log which rule decided.
Allow, deny or ask
Give the policy gate exactly three answers. Deny is for actions no approval may unlock, such as sending restricted data to an unknown address. Require review names the approver role, the information required and the deadline. Allow still passes through validation, permission checks and logging. Test the rules as ordinary code with a table of examples, including boundary amounts, missing fields and combined conditions. Watch for splitting: ten small refunds can evade a rule meant for one large refund, so add limits per customer and period.
Build the approval step
This example models the request lifecycle: pending, approved or rejected, expired, stale or executed.
"""An approval gate that rechecks the world before acting."""
class Request:
def __init__(self, action, snapshot, requester, now, ttl=100):
self.action, self.snapshot = action, dict(snapshot)
self.requester, self.expires = requester, now + ttl
self.state, self.log = "pending", []
def move(self, new, who, now, note=""):
self.log.append((now, who, self.state, new, note))
self.state = new
return f"{new}: {note}" if note else new
def decide(self, who, approve, now):
if self.state != "pending":
return f"ignored: already {self.state}"
if now > self.expires:
return self.move("expired", "system", now)
if who == self.requester:
return "ignored: cannot decide own request"
return self.move("approved" if approve else "rejected", who, now)
def execute(self, world, now):
if self.state != "approved":
return f"not executed: {self.state}"
if now > self.expires:
return self.move("expired", "system", now)
changed = [k for k, v in self.snapshot.items() if world.get(k) != v]
if changed:
return self.move("stale", "system", now,
f"{changed[0]} changed, ask again")
return self.move("executed", "system", now, self.action)
world = {"price": 120, "stock": 5}
first = Request("order 5 units", world, "bot", now=0)
print(first.decide("bot", True, now=1))
print(first.decide("sam", True, now=20))
world["price"] = 180
print(first.execute(world, now=30))
print(first.execute(world, now=31))
second = Request("order 5 units", world, "bot", now=40)
print(second.decide("sam", True, now=50))
print(second.execute(world, now=60))
late = Request("order 1 unit", world, "bot", now=100)
print(late.decide("sam", True, now=500))
Output:
ignored: cannot decide own request
approved
stale: price changed, ask again
not executed: stale
approved
executed: order 5 units
expired
The agent cannot approve its own request. A price change after approval blocks execution and demands a new decision, a second attempt does nothing, a fresh approval succeeds and a late decision expires. A production version also needs to check that the approver has authority, save state durably, update it atomically so that two workers cannot execute, and call the real tool with an idempotency key.
What the reviewer sees
- The exact action, with target and amounts.
- Why it is proposed, with links to evidence.
- What will change, ideally as a before and after view.
- Which rule asked for review.
- Whether it can be undone.
- Options to approve, edit, reject with a reason, ask a question or reassign.
Show facts from systems of record separately from the agent's explanation, which may be persuasive and wrong. An edit creates a new action that must pass policy again.
Batches and standing approvals
Grouping similar items saves time but hides outliers. Show totals, highlight unusual rows, let the reviewer open and remove any item and bind approval to the exact final list. A standing approval, such as permission to reorder a named item within a limit, should state its scope, ceiling, expiry and owner, and be revocable at once. Record each use against it. Avoid open-ended choices like "always allow" on powerful tools; users click them to remove friction and rarely return to undo them.
Workflow template
| Item | Decide and record |
|---|---|
| Trigger | Which rule creates a request |
| Payload | Fields, evidence, snapshot of facts |
| Approver | Role, authority limit, separation from requester |
| Deadline | Reminder, escalation and expiry |
| Absence | Delegate or queue, never auto-approve by silence |
| Outcomes | Next step for approve, edit, reject and expire |
| Recheck | Facts and permissions verified before execution |
| Failure | What happens if execution fails or is unknown |
| Record | Who, what, when, why and which versions |
| Review | Measures and the owner of the rule |
Frameworks can pause a run for input, for example with interrupts in LangGraph, which needs a checkpointer and re-runs the interrupted node from its start on resume. Place side effects after the pause or make them safe to repeat. The business rules of the template remain your responsibility.
After the decision
Feed the outcome back to the agent in a structured form: the decision, the reason code, any edited values and what it may do next. A rejected action should not simply be proposed again with different wording. Allow one revision if the reason is fixable, and count proposals per task. Tell the user what happened in plain language, including when nothing was changed. If execution fails after approval, show the approver and requester, keep the evidence and decide whether a retry is covered by the same approval. Usually it is only when the action and the facts are identical and the failure certainly had no effect.
Reference architecture for automation with oversight
Bind each approval to a digest of the exact action so that anything changed afterward fails verification. Protect notification links, require sign-in for decisions and treat replies by email or chat as untrusted until the person's identity is confirmed.
Reviewer capacity
A gate that creates more work than people can do becomes either a bottleneck or a rubber stamp. Estimate before building.
"""Can the reviewers keep up with the approvals a design creates?"""
from math import ceil
def plan(tasks_per_day, review_share, minutes_each,
reviewer_minutes=240, headroom=0.8):
reviews = tasks_per_day * review_share
minutes = reviews * minutes_each
people = ceil(minutes / (reviewer_minutes * headroom))
return reviews, minutes, people
def backlog(days, reviews, minutes_each, people, reviewer_minutes=240):
can_do = people * reviewer_minutes / minutes_each
return max(0, round((reviews - can_do) * days))
print("share reviewed reviews/day people backlog after 5 days (2 people)")
for share in (1.00, 0.30, 0.05):
reviews, minutes, people = plan(800, share, minutes_each=3)
waiting = backlog(5, reviews, 3, people=2)
print(f"{share:>12.0%} {reviews:>12.0f} {people:>7} {waiting:>12}")
Output:
share reviewed reviews/day people backlog after 5 days (2 people)
100% 800 13 3200
30% 240 4 400
5% 40 1 0
Reviewing all 800 daily tasks would need 13 people under these assumptions, and two people would fall 3,200 behind in a week of five days. Reviewing 30 percent still overwhelms two reviewers; 5 percent fits. Real arrivals are uneven, so peaks, absence and difficult cases need extra room. Reducing review share is legitimate only when evidence shows that the unreviewed cases are safe enough.
Route and prioritize the queue
- Send each request to a role, with a named backup, instead of one individual.
- Order by deadline and consequence, not only arrival time.
- Remind once or twice, then escalate; endless notifications are ignored.
- Withdraw requests that are no longer relevant.
- Show the requester where the request is and who has it.
- Provide a way to pause the agent when the queue grows beyond a limit.
Measure waiting time and expiry by rule. A rule that mostly produces expired requests is not protecting anything and may push users toward unofficial routes.
Is the review working?
| Signal | May mean |
|---|---|
| Almost everything approved in seconds | Rubber stamping or needless gates |
| Many edits of one field | A fixable agent or data problem |
| Long waits and expiry | Too few reviewers or poor routing |
| Errors found after approval | Missing evidence or attention |
| Different reviewers disagree | Unclear policy |
Occasionally audit approved cases independently. People tend to trust automated suggestions, especially under time pressure, so design screens that invite checking and give reviewers time and permission to say no.
Introducing a gate to a team
Start with the agent proposing while people continue to act in their usual tools, and compare. Next, let approval in the new screen trigger execution for one action type and a few users. Keep a manual route open. Agree in advance what would pause the rollout, such as an unapproved effect, a wrong target or waiting times beyond the old process. Ask reviewers each week what was missing. Expand only when the figures and their comments both support it, and note who made that call.
Look after reviewers
Reviewing a long stream of mostly correct proposals is tiring, and attention drops. Limit session length, mix in other work, and give reviewers a direct way to report a rule that wastes their time or a screen that hides what they need. Train them on typical failure patterns with real examples. Some teams insert known faulty cases to learn whether review still detects them; if you do, tell reviewers the practice exists, mark the cases so they can never execute, and use the results to improve the screen and workload more than to blame individuals.
Changing the level of oversight
Loosen a gate one action type at a time, using measured results over enough varied cases, with sampling afterward and an automatic return to review if quality drops. Keep gates required by law or policy regardless of measurements. In the European Union, human oversight is among the requirements for high-risk AI systems under the AI Act, whose application dates were changed in 2026; check the current text and obtain legal advice for your case. See Risk Tiers, Approvals and Human Oversight.
An agent matches invoices and proposes payments. Matched low-value invoices from known suppliers are paid with sampled review. New bank details, mismatches and large amounts require a finance approver who sees the documents and the change. Bank-detail changes also need confirmation through a separate channel, outside the agent.
Test the gate like a security control
Try to execute without approval, with another request's approval, with a changed amount, after expiry, twice at once and as the requester. Remove the approver's role between decision and execution. Make the notification service and the policy service unavailable. Every attempt should fail safely and appear in the record. Include text in documents that claims approval was already given; the gate must ignore it because it reads decisions only from its own protected store.
What to record
Keep the request, the evidence shown, the policy rule and version, who was asked, who decided, when, any edits, the execution result and the model, instruction and tool versions. Store it where the agent cannot alter it. Apply a retention period and access controls, since approval records often contain personal and financial details. A good record answers a later question without reconstructing screens from memory.
Common mistakes
- Asking the model to enforce the gate.
- Approving vague summaries.
- Treating silence as approval.
- Not rechecking facts after waiting.
- Letting requesters approve themselves.
- Gating everything and exhausting reviewers.
- Never measuring what review catches.
Checklist
- Every consequential action passes a coded gate.
- Requests show the exact action and evidence.
- Approver authority is verified.
- Approvals bind to one action and expire.
- Facts are rechecked before execution.
- Execution happens at most once per approval.
- Review capacity covers peaks.
- Quality of review is audited.
Frequently asked questions
Does a human approval make an action safe?
No. It helps when the reviewer has authority, evidence, time and willingness to reject. Hard limits are still needed.
What if nobody answers?
Remind, escalate and then expire or park the task. Do not execute by default.
Can another model act as the reviewer?
It can screen and prioritize, but it is not human oversight and can share the same blind spots. Keep people for decisions that require them.
How is this different from a handover?
Approval returns control to the agent or executor after a decision. A handover transfers the whole case to a person.
References and further reading
- LangGraph: interrupts
- Regulation (EU) 2024/1689, the AI Act
- Regulation (EU) 2026/1744 amending the AI Act
- NIST AI Risk Management Framework
Next steps
Progress, Approval, Undo and Handoff UX
Design controls people can use.
Human Approval, Thresholds and Secure Logging
Secure the records.
Enterprise Agent and Platform Reference Architectures
See the wider platform.