Module 8 · Lesson 5 · 14 min read
Human in the loop
Human-in-the-Loop
Introduction
A good autonomous agent knows when to stop and ask. In this lesson we get to know the four patterns of human intervention, decide where to place approval points without exhausting reviewers, and build an approval gate that supports accepting, editing and rejecting, with an audit log.
Learning objectives
- Distinguish between the patterns of human intervention: approval, editing, providing information and later review
- Identify the actions that need a prior approval gate
- Write a clear approval request that includes the action, the effect and the reason
- Avoid approval fatigue and use reviewers' decisions to improve the agent
Human in the loop: why and when?
Human in the loop (Human-in-the-Loop or HITL) means that the agent stops at specific points to ask a human to approve, edit or add information before it continues. The goal is not to slow the agent down, but to place human judgment where mistakes are costly or where the human has information the agent does not.
The LangGraph documentation lists human-in-the-loop support among its core capabilities alongside persistence, because stopping to wait for a human requires saving the state and then resuming (according to the official documentation, reviewed 18 November 2026). And Anthropic's article "Building effective agents" (2024) recommends that agents pause at checkpoints to ask for human feedback or when they encounter blockers.
Four patterns of human intervention
- Approve or reject (Approve / Reject): the agent presents the proposed action, and the human accepts or rejects it. Suitable for sending messages, payments and deletion.
- Editing (Edit): the human edits the action's inputs before execution, such as correcting an amount or the wording of a sentence.
- Providing information (Provide Input): the agent does not know something necessary, so it asks, such as "Which semester do you mean?".
- Later review (Review After): the agent executes low-risk actions, and the human reviews a sample of them later.
Where do you place the approval point?
Place the gate before an action that meets one of these conditions:
- It cannot be undone (sending, paying, deleting, publishing).
- It affects a third party (a student, a customer, an external body).
- It exceeds an agreed limit (an amount, a number of records, a permission).
- It relies on low confidence on the agent's part or on incomplete information.
And do not place it at every step. Too many approval requests lead to approval fatigue, where the reviewer presses "Approve" without reading, and the gate loses its value.
Practical example: an approval gate for medical excuse decisions
The scenario: an agent in student affairs reads medical excuse requests, proposes accepting or rejecting them, and prepares a message for the student. The decision directly affects the student, so it passes through an approval gate that supports approving, editing and rejecting, and records every decision in an audit log:
# A human approval gate with editing and an audit log - standard Python
from datetime import datetime, timezone
audit_log = []
def propose(request):
days = request["days"]
decision = "Accept" if request["has_report"] and days <= 14 else "Refer to the committee"
return {"student": request["id"], "action": "send_decision", "decision": decision,
"reason": ("There is" if request["has_report"] else "There is no") + f" medical report, number of days: {days}"}
def approval_gate(proposal, reviewer_choice, edited_decision=None):
entry = dict(proposal, reviewer_choice=reviewer_choice,
at=datetime.now(timezone.utc).isoformat(timespec="seconds"))
if reviewer_choice == "approve":
result = "Executed: " + proposal["decision"]
elif reviewer_choice == "edit" and edited_decision:
entry["decision"] = edited_decision
result = "Executed after editing: " + edited_decision
else:
result = "Not executed: the proposal was rejected"
entry["result"] = result
audit_log.append(entry) # every decision is recorded
return result
p1 = propose({"id": "s201", "has_report": True, "days": 5})
print("Approval request:", p1)
print(approval_gate(p1, "approve"))
p2 = propose({"id": "s202", "has_report": True, "days": 20})
print("Approval request:", p2)
print(approval_gate(p2, "edit", edited_decision="Partial acceptance for ten days"))
print("Number of decisions in the log:", len(audit_log))Notice that the agent gives a reason with every proposal, that the human edit is recorded instead of being lost, and that a rejection executes nothing. In a real system the agent saves its state at the gate and stops, then resumes when the reviewer's decision arrives, as we saw in the long-tasks lesson.
Learning from human decisions
Reviewers' decisions are valuable data. If you notice that reviewers keep editing a certain kind of proposal, that is a signal to improve the agent's instructions or rules. And if the rate of approval without edits has been very high for a low-risk action for a long time, it may be time to move it to later review instead of prior approval.
Summary
Human in the loop places human judgment where a mistake is costly or the information is incomplete. Its four patterns are approve or reject, editing, providing information and later review. The gate is placed before actions that cannot be undone, that affect a third party or that exceed a limit, while avoiding approval fatigue. A good approval request shows the action, the effect and the reason, and every decision is recorded for auditing and improvement.
Terms
| Term | English | Definition |
|---|---|---|
| Human in the loop | Human-in-the-Loop | The agent stopping at specific points to ask for human judgment |
| Approval gate | Approval Gate | A point in the path past which the action proceeds only with approval |
| Approval fatigue | Approval Fatigue | A reviewer approving without scrutiny because of too many requests |
| Audit log | Audit Log | A permanent record of decisions, who made them, when and why |
| Safe default behavior | Safe Default | What happens when the timeout expires without a decision, such as not executing |
Review questions
- What are the four patterns of human intervention, and when does each one fit?
- What conditions call for placing an approval gate before an action?
- Why is approval fatigue a security risk and not just a nuisance?
- What should a good approval request include?
References
- LangGraph overview docs.langchain.com Reviewed on 2026-11-18
- Building effective agents (Anthropic, 2024) www.anthropic.com Reviewed on 2026-11-18
