Cruxly › AI engineering › Agentic Systems
Human-in-the-Loop Design: When the Agent Should Ask
ask when a wrong action costs more than a person's ten seconds, and make those ten seconds enough
Open the interactive lessonPrompt: "Our operations agent can send customer emails, update orders, issue refunds and change shipping addresses. We do not want a human on every action, and we do not want a bad email or a wrong refund going out unchecked. Where do the humans go, and what do they see?"
25 minutes first. The weak answer is "approve anything risky". The strong answer picks a mode per action using reversibility and the cost of being wrong, designs the approval message so a person can decide quickly and correctly, plans for the human not answering, and keeps the corrections people make because they are the best data you will ever get.
Three modes: approve, notify, review after
"Human in the loop" is not one design, it is three, and they differ in when the person acts.
| Mode | The agent | The human | Use when |
|---|---|---|---|
| Approve before | Prepares the action and waits; it does not run until approved | Decides before anything happens | Irreversible or expensive if wrong |
| Notify with undo | Acts, tells the person immediately, offers a quick undo | Can reverse within a window | Reversible, moderate cost, and speed matters |
| Review after | Acts and logs; a sample or a digest is reviewed later | Audits patterns, not each action | Cheap and reversible, high volume |
Pick the mode with two questions: can it be undone, and how much does a wrong one cost?
| Cheap if wrong | Expensive if wrong | |
|---|---|---|
| Reversible | Review after (change an internal tag, fetch a record) | Notify with undo (change a shipping address before dispatch) |
| Irreversible | Notify, or approve if the volume is low (send a short status email) | Approve before (large refund, delete data, message to an external partner) |
Reversibility is a property of the world, not of the tool. A refund is "reversible" in principle (claw it back) but in practice the money has moved and the customer has been told. Ask whether the undo is cheap, fast and certain, not whether it exists.
A rough way to check the call is to compare expected loss with the cost of asking. If the agent is wrong on, for example, 2% of cases and a wrong action costs Rs 5,000, the expected loss per unattended action is 0.02 x 5,000 = Rs 100. A person reviewing it costs, for example, Rs 15 of attention. Ask before. For an action that costs Rs 200 when wrong, the expected loss is 0.02 x 200 = Rs 4, less than the Rs 15 of asking, so automate it and sample for review. The numbers are placeholders; the shape of the argument, expected loss against the price of a decision, is what the interviewer wants. The calculation assumes the human actually catches errors, which brings in the next sections.
:::key Enforce the mode in the tool, not the prompt As in the guardrails lesson, "ask before big refunds" written in a prompt is a suggestion. The tool for an approve-before action should return "pending approval" and create the request itself, so the model cannot talk its way past the gate. :::
The approval message: decide in ten seconds
An approval is only as good as the decision it enables. If the message is "Agent wants to proceed. Approve?", the person either rubber-stamps it or opens three other tabs to find out what it means, and the gate has failed in both cases. Design the request so the right decision takes about ten seconds. Four things, in this order.
@@ 1 | What will happen One plain sentence naming the action and its target. "Refund Rs 1,499 to the card used on order ORD-8812."
@@ 2 | Why The evidence, not the model's prose: the ticket line, the delivery record, the policy clause. A model's stated reasoning can be fluent and wrong, and it nudges a busy reader towards yes, so show the evidence first and label any rationale as model-written.
@@ 3 | What changes A diff. Before and after for each field the action touches, including side effects: "order status delivered to refunded; customer receives an email".
@@ 4 | How to undo it State whether it can be undone, how, and by when. "Cannot be undone after settlement (about 2 days)." Irreversible actions should look different from reversible ones.
A request for the example refund could look like this.
APPROVE? Refund Rs 1,499 to card ending 4421 [Irreversible after settlement]
Why: Ticket: "box arrived crushed". Delivered 12 Nov. Policy 4.2: damaged goods refundable within 7 days.
Changes: order ORD-8812 delivered -> refunded
customer gets "refund issued" email
Risk note: customer has 2 refunds in the last 90 days (limit 3)
[Approve] [Edit amount] [Reject + reason]
Design choices worth saying aloud. Offer "edit" as a first-class button, because the agent is often 90% right and a person fixing the amount is cheaper than a reject and a retry. Require a reason on reject, which becomes data later. Bind the approval to the exact action: store a hash of the proposed call, and execute only that call. If the agent changes the amount after approval, the approval does not apply. Put the risky cues in the message, such as an amount near the limit or a first-time customer, instead of making the person go and find them.
Approval fatigue, timeouts, and what the agent does while it waits
If people approve 99.5% of requests, the gate is not protecting you. Either almost nothing it catches is real, or people have learned to click through. Both are bad, and you can see it in numbers you should be tracking from the first week.
| Signal | What it suggests |
|---|---|
| Approval rate near 100% and a median decision time of 2 seconds | Rubber-stamping, or the gate is on the wrong actions |
| High edit rate on one action type | The agent is systematically a little wrong there; fix the agent or the tool |
| Rejects with the same reason | A rule that should become a hard limit or a prompt and tool change |
| Requests piling up unanswered | Too many gates, or the wrong person is being asked |
Ways to cut fatigue without removing safety.
- Raise the threshold with evidence. If every refund under Rs 500 was approved for a month, move the line to Rs 500 and sample 1 in 20 for review after the fact.
- Tier by risk. Auto-run low risk, notify for medium, approve for high; do not use one gate for all.
- Batch similar requests into one card with a table, when the person is making the same judgment on each row.
- Add a friction canary. Insert, for example, one known-bad request in a few hundred. If it gets approved, you have a measurement of how much attention the approvers are paying.
Waiting is a state the agent must be designed for. A person may answer in 20 seconds or 20 hours.
- Park the run. Checkpoint the state and release the worker; do not hold a process, a database lock or a model connection open while waiting. When the decision arrives, resume from the checkpoint.
- Keep working on what does not depend on the answer. The agent can finish other steps, draft the reply, or handle other tickets. It must not run any step that assumes the approval.
- Revalidate on resume. The world may have changed while it waited (the order shipped, the customer replied). Before executing an approved action, check that its preconditions still hold; otherwise re-ask.
- Timeouts need a safe default. For anything irreversible, no answer means the action does not happen. Escalate first: remind after, for example, 15 minutes, route to a backup approver after an hour, and expire the request after a day with a clear message to the customer ("this is pending a review, we will update you by tomorrow").
- Tell the end user the truth. "I have sent this for approval" is better than silence or a promise the system may not keep.
Human edits as training signal, and the follow-ups
Every approval card produces a labelled example if you keep it. Store the proposed action, the final action the human allowed, the decision (approve, edit, reject), the reason, the decision time, and the evidence that was shown. Then:
- An edit is the most valuable label. The agent proposed Rs 1,499, the human changed it to Rs 1,200 because one item was not damaged. That pair is a ready-made eval case with an expected value, and it points to a specific gap.
- A reject with a reason becomes a negative case for the golden set from the evals lesson: a task where the right outcome is "do not do this".
- Cluster the edits by action type and field. If 30% of address changes are edited on the postcode, fix the tool or the extraction, then measure whether the edit rate falls.
- Treat plain approvals as weak evidence. A fast click with no edit may be agreement or may be fatigue, so do not count it as proof the agent was right unless the decision time and the canary results back it.
Handle the data with care: the cards contain customer information, so apply the same redaction and retention rules as traces, and be sure that using human decisions for evaluation or training is covered by your policies and by what the approvers have been told.
Follow-ups they will ask.
"Why not just have the model decide whether it needs approval?" A model's confidence is not a reliable signal of whether it is right, and it can be pushed by the input. Use rules on the action (type, amount, target, irreversibility), and treat model confidence at most as an extra reason to ask, never as a reason to skip a rule.
"What if the only approver is on holiday?" Name an escalation chain and a default that fails toward blocked, and tell the customer the status. An approval queue with one person behind it is a single point of failure that you have designed in.
"How do we know the gates are working?" Track approval rate, edit rate, decision time and the canary catch rate, and read a sample of the approved ones. Compare incidents that slipped through against the gate settings at the time.
"Can we remove the human eventually?" Yes, per action type, and only on evidence: pass^k on the golden set, a low edit rate over a long period, and a cheap undo. Move one rung at a time (approve, then notify with undo, then review after) and keep the sample review running.
How to say it in the interview
"I would not use one rule for every action. There are three modes: ask first, tell after, and review later. I choose by two questions: can the action be undone, and what does it cost if it is wrong. Irreversible and expensive means approve before; reversible and cheap means just do it and log; in between, notify with an undo. The approval message has to let a person decide in about ten seconds: what will happen, why, what changes, and how to undo. If the approval rate is near 100 percent, the gate is either useless or being rubber-stamped, so I would measure that. And every edit a human makes is a labelled example I feed back into the eval set."
Checklist
- Chose approve-before, notify-with-undo or review-after per action, not one gate for everything
- Decided by reversibility and cost of a wrong action, using a quick expected-loss comparison
- Enforced the mode in the tool code, returning pending approval, not in the prompt
- Designed the approval card to answer what, why (evidence first), what changes, and how to undo
- Bound each approval to a hash of the exact call, with edit and reject-with-reason actions
- Tracked approval rate, edit rate and decision time, and tested the approvers with a canary
- Parked the run while waiting, revalidated preconditions on resume, and failed toward blocked on timeout
- Kept every human edit and reject as a labelled eval case, with redaction and retention applied
Related lessons
- The Agent Loop in Depth: ReAct, Plan-and-Execute, Reflection and Stop Conditions
- Designing Tools an Agent Can Actually Use
- Agent Memory: Working, Episodic, Semantic and Procedural, Without the Rot
- Context Engineering for Long-Horizon Agents
- Frameworks, Protocols and Durable Execution: MCP, A2A and Long-Running Agents
- Reliable Agents: Retries, Idempotency, Checkpoints and Sagas