Every prior 15.1 idea—autonomy, plans, tools, the loop, workflows, and multi-agent—eventually meets a human. Human-in-the-loop (HITL) is how you pause, edit, approve, or reject before irreversible effects. It is not a failure of agency; it is how agency ships.
LangGraph interrupts/resume are the orchestration primitive. AutoGen user-proxy patterns preview conversational HITL. After this capstone, Module 15.2 starts with episodic memory—including storing human decisions as episodes the agent can learn from. Module 15.3 then standardizes tools via MCP.
Learning Objectives
By the end of this lesson, students should be able to:
- Define HITL as interruptible control with resume, not as “the model is weak.”
- Choose review modes: approve, edit, reject, escalate, or sample.
- Place gates on risk (money, PII, prod writes), not on every token.
- Implement a pause/resume sketch around a write tool.
- Relate HITL to LangGraph interrupts and AutoGen human proxies.
- Explain how human decisions become episodic memory in Module 15.2.
Human-in-the-loop is a control design where the agent must yield to a person at specified decision points—typically before side effects—and then resume with the human’s approve, edit, or reject as a new observation. HITL is part of the agent system, not an external afterthought.
HITL Modes
| Mode | Human does | Agent then | Typical use |
|---|---|---|---|
| Approve / deny | Binary gate | Execute or abort | Refunds, deploys |
| Edit | Rewrites draft/args | Uses edited artifact | Customer email, plan steps |
| Escalate | Takes the case | Stops; logs handoff | Abuse, legal, ambiguity |
| Sampled review | Audits a % | Continues; metrics feed eval | Mature low-risk flows |
| Always-on copilot | Drives; agent suggests | No unsupervised writes | IDE assistants |
Pause / Resume Sketch
In production, persist this state (LangGraph checkpointer). Here, a queue stands in for the human inbox.
Where to Put Gates
Always gate
- Money movement
- Prod deploy / delete
- External customer send
- PII export
Often auto
- Read-only search / RAG
- Sandbox code
- Internal drafts
- Tiny refunds under cap
After maturity
- Sampled audit
- Tighten via eval metrics
- Keep emergency stop
Strengths
- Makes autonomy shippable
- Captures expert edits as data
- Fits LangGraph interrupts
- Reduces catastrophic writes
Tradeoffs
- Latency (humans are slow)
- Reviewer fatigue if over-gated
- Need durable pause state
- Ambiguous UI → rubber-stamping
“If it needs a human, it is not a real agent.” Copilots and approval-gated agents are the dominant production form. Unattended loops without HITL on irreversible actions are usually unfinished products. Store the human’s decision as an episode so the next run can avoid the same bad write.
Knowledge Check
- Short Answer: What does HITL add to an agent loop? Answer: A pause for human approve/edit/reject/escalate, then resume with that observation.
- True/False: HITL means the system is not an agent. Answer: False.
- Multiple Choice: LangGraph supports HITL mainly via: (a) pooling, (b) interrupts + resume/checkpoints, (c) WordPiece. Answer: (b).
- Short Answer: Name three HITL modes. Answer: Approve/deny, edit, escalate (also sampled review / copilot).
- True/False: Every RAG retrieval should wait for a human. Answer: False—gate irreversible/high-risk actions.
- Multiple Choice: Over-gating mainly causes: (a) reviewer fatigue / latency, (b) better CNNs, (c) free tokens. Answer: (a).
- Short Answer: How does Module 15.2 connect? Answer: Human decisions become episodic (and later long-term) memory.
- Short Answer: Why persist pause state? Answer: Processes crash; humans are slow—you must resume later.
- Multiple Choice: AutoGen’s user-proxy idea is closest to: (a) conversational HITL, (b) FAISS training, (c) CSS grids. Answer: (a).
- True/False: Sampled audit is a valid HITL mode for mature low-risk flows. Answer: True.
Key Takeaways
- HITL is interrupt–decide–resume, aimed at irreversible or ambiguous steps.
- Choose approve, edit, escalate, or sample—do not rubber-stamp everything.
- LangGraph interrupts and durable state make HITL operational, not theatrical.
- Human decisions are gold for episodic memory (Module 15.2).
- Module 15.1 complete: continue to 15.2 Episodic Memory, then MCP in 15.3.
Whiteboard: For your support agent, mark every tool as auto / HITL / forbidden. Revisit after a week of sampled audits.
Lab: Wire HitlRuntime into the agent loop: when issue_refund is proposed, return the pause JSON to the user UI; on approve, resume with a role: tool observation.
Recap: HITL bounds agency so it can ship. Continue with Module 15.2 Episodic Memory.