05Chapter 5 of 7
Free course9 min read

Human in the loop.

Some actions are too expensive to let an agent take alone. This chapter is about deciding in advance which ones Aria must pause and hand to a person, building the gate that holds them, and keeping an audit trail of every decision so you can always answer who approved what and why.


You have scoped Aria down to the least it needs, and you have taught it to treat the text it reads as data rather than orders. That makes the everyday refund safe to automate. But some actions are just too expensive to ever let an agent take alone, no matter how well-behaved it has been. This chapter is about the last line that keeps those out of reach: deciding in advance which actions Aria must stop and hand to a person, building the gate that holds them, and writing down every decision so you can always say who approved what. We stay with Aria, the support agent at Switchback.

05.0

Some actions are too expensive to automate

Most of what Aria does is small and reversible. Looking up an order is harmless. A refund for a few dollars on a missing pair of socks is the kind of thing the team would have approved without thinking, so letting Aria handle it saves real time and costs almost nothing if it is occasionally wrong. The trouble starts when the same machinery that issues a small refund can also issue a large one. A refund is a refund to the code. The difference between five dollars and five hundred is not in the action, it is in what you are willing to lose if the agent gets it wrong.

So Switchback drew a line. Any refund of fifty dollars or less, Aria can issue on its own. Anything over fifty dollars stops and waits for a person. That number is not magic. It is just the point where the team decided the cost of a mistake outgrows the convenience of automating it. Below the line, the worst case is a small loss they can absorb. Above it, a single bad decision is worth a human glance. The whole pattern in this chapter is that one move: pick the line, then make the agent physically unable to cross it without help.

Aria proposes a $128 refund on order 4815, an approval gate checks it against the $50 cap and holds it, and the on-call human approves or denies before the refund tool runs.

Read that left to right. On the left, Aria has decided a refund is warranted: a hundred and twenty-eight dollars on order 4815 for J. Okafor, because the package never arrived. In the middle sits the gate. It does one thing, which is check the amount against the fifty-dollar cap, and because a hundred and twenty-eight is over the line, it holds the action instead of running it. On the right is the on-call human, who can approve or deny. Notice that Aria still did its job. It read the situation and proposed the right outcome. What changed is that proposing and doing are now two separate steps, and a person stands between them.

Note
The pattern has a name you will hear constantly: human in the loop, often shortened to HITL. It means a person sits inside the decision path for certain actions, not watching from outside. The approval threshold is the rule that decides which actions land in the loop. Everything below the threshold flows straight through, everything above it pauses for a person.
05.1

Pick the threshold, in advance

The most important word in this chapter is in advance. The gate cannot be a judgment Aria makes in the moment, because the whole reason you do not trust the agent with a large refund is that its judgment is exactly the thing under attack. If you ask Aria to decide whether a refund is big enough to need approval, a clever message can talk it out of asking, the same way it could be talked into the refund itself. The threshold has to live in code that runs no matter what Aria thinks, so that the decision to pause is not something the agent can be persuaded to skip.

In practice the rule is dead simple, and that simplicity is the point. When Aria wants to issue a refund, the code that wraps the refund tool checks the amount first. At or under the cap, it lets the call through. Over the cap, it does not call the tool at all. It files the request for a human and returns a held status to Aria. The agent never gets to choose. The diagram below is the entire decision, and it is the kind of thing you want to be boring and unmissable.

The refund gate
OverAt or under
Is the refund over the $50 cap?
Hold for a personpause, queue for approvalAria issues itruns straight through
The gate is a fixed check in code, not a judgment Aria makes. Over the cap, the refund tool is never called until a person approves.

It is worth being precise about where this check lives, because it is easy to put it in the wrong place. The threshold is not a line in Aria's prompt that says please ask for approval over fifty dollars. A prompt is a suggestion, and suggestions are exactly what an attacker rewrites. The check belongs in the deterministic code around the tool, the layer the next chapter calls guardrails. Aria asks to issue a refund, and a plain function decides whether that request runs or waits. The agent proposes, the code disposes.

Watch out
A threshold written into the agent's instructions is not a threshold, it is a hope. The same untrusted text that can talk Aria into a refund can talk it into believing the refund is under the cap, or that this customer is pre-approved, or that the rule does not apply today. Put the comparison in code that the agent cannot see or argue with. The agent should not even know the number, it should only ever receive an allowed or held answer.

One number is the simple version, and it is the right place to start. Real systems usually grow a small set of these. A refund cap, a limit on how many refunds one customer can get in a week, a rule that any change to a shipping address on an order over some value also pauses. Each one is the same shape: a fixed condition, checked in code, that routes an action either straight through or into the approval queue. Start with the single most expensive action and the single clearest line. You can always add the next rule once the first one is earning its keep.

05.2

The on-call human and the handoff

A gate that holds an action is only half the design. The other half is the person it hands to, and the path the request travels to reach them and come back. If a held refund just sits in a queue nobody watches, you have not added a safeguard, you have added a place where customer requests quietly die. The human in the loop is a real role with a real name on a rota. At Switchback, one teammate is on call for approvals at any given time, and the held action has to find its way to whoever that is right now.

Walk the handoff one message at a time. Aria decides a refund is due and calls the refund tool. The gate intercepts it, sees the amount is over the cap, and instead of refunding, posts the request to the approvals queue and tells Aria it is held. The on-call human gets a notification, opens the request, and approves it. The approval flows back through the gate, which now runs the refund it was holding, and Aria can finally tell the customer the money is on its way. Every arrow below is a real step, and the order is the lesson.

A held refund, end to end
AriaThe gateOn-call humanissue refund $128over the $50 cap, so hold itapproval neededapproverefund released
The agent proposes and the gate holds. Only a person's approval lets the held refund actually run, then control returns to Aria to close the loop with the customer.

Notice that the human is approving a specific, fully-formed action, not making the decision from scratch. They are not being asked should this customer get a refund. They are being asked Aria wants to refund a hundred and twenty-eight dollars on order 4815 because the package never arrived, do you agree. That framing is what makes the loop fast enough to live with. A good approval takes a person five seconds because the agent has already done the gathering and the reasoning, and all that is left is a yes or a no on a concrete proposal.

Pro tip
Give the approver everything they need to decide without leaving the screen: what action, how much, which customer, which order, and the reason Aria gave. An approval request that forces the human to go dig through three other systems will get rubber-stamped within a week, and a rubber-stamped gate is no gate at all. The quality of the loop is the quality of what you put in front of the person.
05.3

Watch the gate hold an action

The handoff is easier to trust once you have seen it happen, so here is the screen the on-call human actually sees. A refund for order 4815 has landed in the approval queue because it is over the cap. It is not done. The money has not moved. The card sits there, marked held, with the amount and the customer and the reason already filled in, and two buttons waiting. Watch the cursor approve it, and notice the moment the held banner turns into a released one. That flip is the entire point of the chapter rendered as a single click.

Two things in that little screen are doing all the work. First, nothing happened until the person clicked. Up to that instant the refund was a proposal, fully reasoned by Aria but completely inert. Second, the decision was a yes or a no on a concrete request, not an open-ended question. The human did not have to reconstruct the situation. They read four lines, agreed with Aria, and released the money. That is what a well-built approval gate feels like to use, and it is the experience you are aiming for when you wire one up.

Critical
Held has to mean nothing happened, not the action ran and we logged a note. If the refund actually goes out the instant Aria proposes it and the human is only asked to confirm after the fact, you have built an alarm, not a gate. The whole value of human in the loop is that the expensive action is impossible until a person says yes. Verify in code that a held action genuinely cannot execute on its own, because that is the property the entire pattern rests on.
05.4

Keep the audit trail

The gate stops the wrong action. The audit trail tells you what happened after the fact, and it is not optional. Every action that passes through the loop, approved or denied, leaves a record: what Aria proposed, how much, for which customer and order, why it was held, who decided, and when. The reason you need this is not paperwork. It is that the day something goes wrong, the only question that matters is who approved this and why, and a system that cannot answer it has failed at exactly the moment you built the loop to protect against.

A single entry from Switchback's trail looks like the record below. It captures the held refund from earlier all the way through to the human's decision. Read it as the answer to a question someone will eventually ask: a hundred and twenty-eight dollars left the account on a refund, who said that was alright. The trail says the gate held it because it was over the cap, the on-call human approved it two minutes later, and here is the timestamp on both. That is a question you can now answer in seconds instead of an afternoon of guessing.

An audit log record for a held refund: the timestamp, the action Aria proposed, the amount $128.00 on order 4815, the customer J. Okafor, the reason it was held, who approved it, and when.

A few things make a trail you can actually rely on. It has to be written by the same code that runs the gate, not by Aria, because an agent that can be talked into a refund can be talked into writing a flattering log line. It has to be append-only, so a record cannot be quietly edited later. And it has to capture both the proposal and the decision, because who approved is only half the story without what they approved. Store it somewhere the agent cannot reach with a tool call, ideally the same place your other security logs live, so it survives even a bad day.

✱ Field note
The audit trail is the thing you will be grateful for at the worst possible moment, and never think about otherwise. Nobody reads it on a normal Tuesday. But the first time a customer disputes a refund, or a teammate asks why a five-hundred-dollar credit went out, the trail is the difference between a two-minute answer and a sinking feeling. Build it before you need it, because the entry you forgot to write is the one you will be asked about.

Put the three pieces together and you have the whole chapter. You pick the line in advance, where the cost of a mistake outgrows the convenience of automating it. You build the gate in code so the agent physically cannot cross that line without a person, and you give the on-call human a clean, concrete request to approve. And you write down every decision in a trail the agent cannot touch, so the question who approved what always has an answer. The next chapter widens this idea into guardrails in general, the deterministic code that wraps the agent and refuses obviously bad actions before they ever reach a human at all.

KEY TAKEAWAYS
  1. Some actions are too expensive to automate: decide in advance which ones Aria must pause and hand to a person.
  2. Set the approval threshold where the cost of a mistake outgrows the convenience, like the $50 refund cap.
  3. Put the threshold check in deterministic code, never in the prompt, so the agent cannot be talked into skipping it.
  4. Held must mean nothing ran: the expensive action stays inert until a person clicks approve.
  5. Give the on-call human a concrete, fully-formed request to approve, not an open-ended question.
  6. Log every decision in an append-only audit trail the agent cannot touch, so you can always say who approved what and why.

End · Chapter 5 of 7

Mark it complete and it’s ticked off on your route.

Rivet, the product security agent for software teams, free to start. Human-led pentests and design review when you need them. AI agents are our specialty.

or get a free Rivet scan

BASEDChicago, IL · remote

FIELD NOTES

ONE SHORT EMAIL A MONTH

© 2026 ROUTEWORK — ALL RIGHTS RESERVED

Claude and Mythos are trademarks of Anthropic. RouteWork is not affiliated with Anthropic.