Human-in-the-loop & approvals

In one sentence

Put a human approval gate in front of consequential or irreversible agent actions, tiered by risk, and escalate low-confidence cases — while keeping prompts rare enough that reviewers still read them.

Analogy: A bank lets a teller hand out $200 alone, needs a supervisor's signature above $10,000, and requires two keys for the vault. Same staff, different gates by risk.

Engineers assign the tier in code; a rejection reason goes back to the agent as feedback, and every decision is logged.

How it works

  • Which actions need approval is a policy in code, never the model's call.
  • Read-only actions auto-execute; external writes get approval, ideally edit-before-send; money and deletes need explicit confirmation.
  • The agent pauses: state is checkpointed, a review queue gets the request, and the run resumes later.
  • Keep an audit trail of who approved what; the EU AI Act (Art. 14) requires oversight for high-risk systems.
  • Watch for approval fatigue: if >95% of an action's approvals pass unchanged, auto-approve it with sampling.

Check yourself

Answer to mark it learned; your answers aren't scored.

Refund approvals often take a day. After every Friday deploy, all pending approvals vanish and those agent runs never resume. What's the root cause?

Go deeper

Full explanation

Human-in-the-loop (HITL) means the agent proposes and a person approves, edits or rejects before certain actions execute. Which actions need approval is a policy in code, never the model's call.

A practical risk-tier policy:

  • Tier 0 — read-only or reversible (search, draft, compute): auto-execute and log.
  • Tier 1 — external writes (send an email, update a record): approval, ideally edit-before-send so the reviewer fixes instead of rejecting.
  • Tier 2 — money, deletes, permissions, irreversible: explicit confirmation showing the exact effect (amount, recipient, diff), sometimes two people.

Other triggers: confidence-based escalation (low classifier score, policy edge cases, the user asks for a human) and sampling a few percent of auto-executed actions for QA.

Mechanically the agent pauses: state is checkpointed, the request lands in a review queue (Slack, ticketing, an admin UI) with context and the model's rationale, and the run resumes when the decision arrives, possibly days later (Durable execution for agents). LangGraph's interrupt() and Step Functions task tokens do exactly this.

The failure mode is approval fatigue: if reviewers approve 99% of prompts unread, the gate is theater. Gate fewer things, show diffs instead of JSON, track approve-unchanged rate and time-to-decision, and keep an audit trail of who approved what — the EU AI Act (Art. 14) requires human oversight for high-risk systems.

Code Risk-tiered approval gate with LangGraph interrupt()
pythonRisk-tiered approval gate with LangGraph interrupt()
from langgraph.types import Command, interrupt
from langgraph.checkpoint.postgres import PostgresSaver

# Tier per tool is decided by engineers in code, never by the model
TIER = {"search_orders": 0, "draft_reply": 0,    # read-only / reversible: auto
        "send_reply": 1, "update_address": 1,    # external writes: approve
        "issue_refund": 2, "close_account": 2}   # money / irreversible: confirm

def act(state: dict) -> dict:
    call, decision = state["proposed_call"], None  # proposed by the LLM
    tier = TIER.get(call["name"], 2)               # unknown tool => strictest tier
    if tier >= 1:
        # Checkpoints and pauses the graph. On resume the node re-runs from the
        # top, so nothing with side effects may happen before this line.
        decision = interrupt({"call": call, "tier": tier, "why": state["rationale"],
                              "preview": render_effect(call)})  # amount, recipient, diff
        if decision["action"] == "reject":           # reason goes back to the agent
            return {"messages": [tool_result(call, "Rejected: " + decision["note"])]}
        if decision["action"] == "edit":             # edit-before-send
            call = {**call, "args": decision["args"]}
    audit.write(call=call, tier=tier, decision=decision, user=state["user_id"])
    return {"messages": [tool_result(call, TOOLS[call["name"]](**call["args"]))]}

graph = builder.compile(checkpointer=PostgresSaver(conn))  # pauses survive restarts
cfg = {"configurable": {"thread_id": "ticket-4812"}}
graph.invoke({"messages": [user_msg]}, cfg)                # runs until interrupt()
# ...hours or days later, from the review UI:
graph.invoke(Command(resume={"action": "approve"}), cfg)
Real example

A support agent handles 2,000 tickets a day. Lookups and drafted replies run automatically. Refunds under $50 auto-execute with 5% sampled for review; larger refunds and any account closure go to a queue that shows the order, the amount and the agent's rationale, where reviewers can edit the amount before approving. Only ~60 items a day reach humans, decided in a median 4 minutes. In month one, reviewers approved 97% unchanged — so the team raised the auto threshold to $100 and spent the saved attention on closures.

Trade-offs +3 · −3

+ You gain

  • Stops the costly, irreversible mistakes an agent will eventually make.
  • Edit-before-send turns rejections into corrections and yields labelled eval data.
  • Named approvers and an audit trail satisfy compliance (EU AI Act Art. 14, SOX-style controls).

− You pay

  • Adds minutes to days of latency; the agent stops being real-time.
  • Approval fatigue: frequent prompts get rubber-stamped and protect nothing.
  • Reviewer time becomes the new cost and bottleneck; queues need staffing and SLAs.

Use it when

Any action that moves money, deletes data, changes permissions, contacts customers or is otherwise hard to undo — and early in a rollout, before data shows the agent is reliable.

Avoid it when

Read-only or easily reversible actions, or high-volume steps where reviewers would see hundreds a day: use guardrails, sampling and monitoring instead of a gate.

Numbers to know 4
  • Rule of thumb: tier by blast radius — read-only auto, writes approve, money/deletes/permissions explicit confirm.
  • Alert-fatigue precedent: clinicians override 49–96% of drug-safety alerts (van der Sijs et al., 2006).
  • Anthropic: sandboxing cut Claude Code permission prompts by 84% internally — fewer prompts, more attention per prompt.
  • Rule of thumb: if >95% of an action's approvals pass unchanged, auto-approve it with sampling.
Common pitfalls 4
  • Letting the model decide whether an action needs approval: a confused or injected model will say no.
  • Showing reviewers raw JSON tool arguments: they can't judge it, so they click approve.
  • Approving a plan, then executing different arguments: bind the approval to the exact call.
  • Holding a thread open while waiting: a deploy kills every pending approval. Checkpoint and resume.
Interview questions 2

Answer out loud first, then reveal.

How do you decide which agent actions need human approval?Show answer

By blast radius and reversibility, decided in code, never by the model. Read-only and reversible actions run automatically with logging. External writes like sending an email need approval, ideally edit-before-send. Money, deletes and permission changes need explicit confirmation that shows the exact effect. Unknown tools default to the strictest tier. Then I tune with data: if an action is approved unchanged 98% of the time, I auto-approve it below a threshold and sample, so reviewer attention goes where it actually catches things.

Reviewers approve everything in two seconds. What do you do?Show answer

That's approval fatigue, and the gate is now theater. First I measure: approve-unchanged rate, time-to-decision and which actions dominate the queue. Then I cut volume: auto-approve low-risk actions with sampling, batch similar ones, and add guardrails so fewer items need a human. For what remains, I make each prompt decidable — the diff, amount, recipient and the agent's reason, not JSON. I may also seed known-bad items to check reviewers catch them. Fewer, better prompts beat more prompts.