// Feedback loops · ~2 min read
HITL (Human-in-the-loop)
Reach for it when: irreversible or high-stakes actions need a human gate.
After this lesson you can: Make a risky action wait until a person approves, edits or rejects it.
// 60-second mental model
How to hold it in your head
The agent may prepare everything — draft, plan, tool args — but an irreversible or high-stakes step waits for an explicit human approve (or reject). No silent auto-ship.
HITL inserts an approval gate before side effects (changes in the outside world, such as moving money): the runtime pauses with a structured proposal; a human returns approve|reject|edit; only then does the irreversible action run. Preparation is automatic; commitment is not.
// Mini architecture
Prepare → pause for human → commit or abort
An agent prepares a proposal (a draft, plan or tool arguments). A HITL gate waits for a person to approve, reject or edit. Approve runs the side effect; edit sends it back to the agent to revise and then through the gate again; reject aborts with no side effect.
If the side effect can run without the gate firing, you do not have HITL — you have a log.
// Mini-project
Refund proposal with approve gate (stub)
Agent stub + HITL gate stub (no real money)
Goal: Draft a refund proposal; block until a stub human returns approve|reject|edit; only then call `execute_refund` stub.
- Agent builds `{ amount, reason, customerId }` from a canned ticket.
- Call `request_approval(proposal)` — gate holds; do not execute yet.
- Stub human returns edit once (lower amount), then approve.
- On approve only, call `execute_refund` stub; log the approval id.
- On reject, abort with no execute call.
- Assert execute never runs without a recorded approval.
Stubs only — no real refunds. The contract is the gate. A real example from this site’s code: agent-written essay drafts wait in a review queue, and publishing is an owner-only action that runs only when Mir clicks Approve.
// Common failure
What goes wrong
Symptom
Rubber-stamp HITL — the UI shows Approve but a timer or default auto-continues anyway.
Fix
Fail closed: no approval token, no side effect. Timeouts escalate to humans, they do not auto-approve.
// Self-reflection
Sit with this
Which irreversible step in your stack still has no human gate — only a hopeful prompt?
Sources
Session only. Nothing is saved.