The boundary is a claim about your actions, not a dialog box
Human-in-the-loop usually arrives as a retro item. The agent refunded the wrong order, or emailed the wrong list, or opened forty Jira tickets, and somebody writes "add a confirmation step" under action items. That sentence hides the entire design. An approval boundary is a claim about which of your agent’s actions are irreversible, which are unbounded in cost, and which are merely embarrassing — and that classification has almost nothing to do with your tool list.
There are three problems stacked inside it and they fail independently. What crosses the boundary is a policy question. How the run survives the pause is a state question, and it is the one that produces the subtle bugs. What the human is shown is an interface question, and it is the one that decides whether the gate still does anything by week three. Most teams solve the first, get the second wrong in a way that only appears on resume, and never touch the third.
The interview version is never "how do you add approvals". It is "your agent needs sign-off before issuing a refund — what happens to the run while it waits, and what happens if the approver comes back two days later and the order has changed?" Both halves are answerable. Neither answer is a dialog box.
Classify by blast radius, and the blast radius is in the arguments
Three properties decide whether an action needs a human: reversibility, bounded cost, and visibility. Can you undo it with a compensating action you already have? Is the worst case bounded by something other than the model’s judgement? Would anyone notice if it was wrong? A draft written to a scratch table fails none of those tests. A wire transfer fails all three.
The consequence that matters is that the unit of policy is not the tool. A refund of four dollars and a refund of forty thousand are the same function with different arguments, and a gate keyed on the tool name treats them identically — so you either stop the agent constantly or never. Both major SDKs landed on the same answer. Google’s ADK, which introduced require_confirmation in 1.14.0, accepts either a boolean or a callable that receives the parsed arguments plus the ToolContext and returns whether this particular call needs a human; the documented example is literally amount > 1000. The OpenAI Agents SDK has the same shape: needs_approval is True or a callable policy evaluated per call.
So if your approval policy is a list of tool names, you have a feature flag, not a boundary. And the policy wants a third outcome beyond allow and confirm: deny. Some actions should not be approvable by the person in the loop at all, and the dialog is too late to discover that.
# The policy is a function of the ARGUMENTS. Tool name alone is a feature flag.
from dataclasses import dataclass
from typing import Literal
Effect = Literal["read", "reversible_write", "irreversible", "external_spend"]
@dataclass(frozen=True)
class Decision:
verdict: Literal["allow", "confirm", "deny"]
reason: str = ""
POLICY_VERSION = "2026-11-13.1" # goes in the audit row; see the last section
def gate(tool: str, args: dict, effect: Effect, ctx) -> Decision:
if effect == "read":
return Decision("allow")
# Deny is a real outcome. Not everything should be approvable at this desk.
if tool == "delete_customer" and not ctx.has_role("dpo"):
return Decision("deny", "erasure requests go through the DPO queue")
if effect == "irreversible":
return Decision("confirm", f"{tool} has no compensating action")
if effect == "external_spend":
amount = args.get("amount_cents", 0)
# A bound, not a vibe. Below it the agent is autonomous on purpose.
if amount > ctx.limits.auto_spend_cents:
return Decision("confirm", f"{amount} over limit {ctx.limits.auto_spend_cents}")
return Decision("allow")
if effect == "reversible_write" and args.get("recipient_count", 1) > 500:
return Decision("confirm", "fan-out above 500 recipients")
return Decision("allow")
# Count Decision("confirm") per completed task. If that number climbs past two
# or three, the boundary is wrong -- raise the bound or make the action
# reversible. Do not add another dialog.Pausing is a state problem, and resume is where it bites
LangGraph’s implementation is the clearest to reason about and the mechanics generalise. You call interrupt() inside a node; the first call raises GraphInterrupt, the graph persists its state through a checkpointer — required, not optional — and returns control to the caller with the value surfaced as an Interrupt carrying value, id, and ns. The pending interrupt is stored as a write under a dedicated INTERRUPT channel, and the id is derived from the checkpoint namespace plus a counter so it stays stable across re-execution. You resume by invoking the graph again with Command(resume=value) on the same config.
Now the part that generates bug reports. On resume the node does not continue from the interrupt — it runs again from its first line, and this time interrupt() finds the resume value in the scratchpad and returns it instead of raising. Every statement above that call executes twice. If you charged a card, incremented a counter, or pushed to a queue before asking for approval, you have now done it twice against one approval. The rule is mechanical: nothing with a side effect goes above the interrupt unless it is idempotent on a key you control.
The OpenAI Agents SDK puts the pause one level higher, before the tool executes at all. Calls awaiting a decision appear in result.interruptions; you convert the result into resumable state with result.to_state(), call state.approve(...) or state.reject(...) on each, then resume the run. Two edges worth knowing: hosted shell environments do not support needs_approval or on_approval at all, and if you set the immediate-decision on_approval callback the run never pauses — the gate you think you have is a function call.
# On resume the node re-runs from line 1. This is the whole bug.
from langgraph.types import interrupt, Command
# WRONG -- the charge happens once before the pause and again on resume.
def pay_node_broken(state):
receipt = payments.charge(state["amount"], state["card"]) # runs TWICE
ok = interrupt({"question": "release this payment?", "amount": state["amount"]})
return {"receipt": receipt, "released": ok}
# RIGHT -- the side effect lives BELOW the interrupt, and is idempotent anyway.
def pay_node(state):
decision = interrupt({ # nothing above this line mutates
"kind": "approval",
"effect": f"charge {state['amount_cents'] / 100:.2f} to card {state['card_last4']}",
"irreversible": "settles in 30 min; refund is a separate 3-day flow",
})
if decision["action"] != "accept":
return {"released": False, "reason": decision.get("reason", "")}
# Idempotency key is derived from the approval, not from time or a uuid4().
return {"receipt": payments.charge(
state["amount_cents"], state["card"],
idempotency_key=decision["approval_id"]), "released": True}
# Resume: graph.invoke(Command(resume={"action": "accept", ...}), config)
# The checkpointer is not optional -- without one, interrupt() has nowhere
# to store the pending write and the run cannot be resumed at all.Confirm everything and you have built an alarm, not a gate
The research that settles this is not in machine learning. Hospitals and cockpits have been running the confirm-everything experiment for forty years and the results are unkind. The Joint Commission’s 2013 alert on alarm safety counted 80 alarm-related deaths and 13 serious injuries in its reporting window, and the FDA catalogued 566 deaths tied to ignored alarms between 2005 and 2008. The NTSB found roughly eight thousand track-circuit alerts a week in the run-up to the 2009 Washington Metro collision and concluded the volume would have thoroughly desensitised the dispatchers. None of those systems were usually wrong. They were right too loudly.
The automation-bias literature is more specific about the shape of the failure. In the clinical decision support work reviewed by Goddard et al., correct answers rose from 29% to 50% with the aid — while 7% of answers that had been correct without it were changed to wrong ones. In breast-cancer screening studies, cancers were found in 46% of cases read without an automated aid but only 21% of cases where the aid was present and failed to flag them. And in one aviation study, every pilot who received a false alert to shut down an engine shut it down, having said in interviews that they would not.
Three findings from that body of work are direct design instructions. Automation stops being a net benefit somewhere around 70% reliability, so a gate whose requests are usually unnecessary is below the line. Complacency falls sharply when reliability varies instead of staying constant, which makes the worst possible gate the one that fires on every call — predictable and almost always fine is precisely the shape that trains a reflex. And holding the decider accountable for the decision measurably reduces the bias, which is why the audit row is a control rather than paperwork. The practical form is a budget: count approvals per completed task, and treat more than two or three as a defect in the boundary, not as diligence.
An approval request is a prompt, and its reader is a human
Most approval UIs render the tool call. That is the wrong artifact. Nobody can evaluate send_campaign(template_id=44, segment="all_active") without knowing it resolves to 31,000 recipients and cannot be unsent. The request has to carry the resolved effect, the part that cannot be undone, the bound that was crossed, and enough identity to be auditable afterwards.
MCP’s elicitation spec is a useful model because it is the one place this got standardised. A server returns an elicitation/create request with a message explaining why the interaction is needed, plus a requestedSchema deliberately restricted to a flat object of primitives — strings, numbers, booleans, enums, no nesting, no arrays of objects — so that any client can render it without inventing a UI. Copy the restriction. An approval payload that needs a bespoke renderer gets a bespoke renderer that nobody maintains.
The spec draws one more line worth stealing: servers MUST NOT use form-mode elicitation to request passwords, API keys, access tokens, or payment credentials, and must instead use URL mode, an out-of-band page whose contents the client never sees. The same rule applies to your own approval flow. An approval prompt is a place to confirm an effect, not a place to collect a secret — anything typed into it is now in the agent’s context, your traces, and your logs.
# The payload a human can actually act on. Flat primitives, like MCP requires.
request = {
"approval_id": "apr_01HQ8…", # becomes the idempotency key
"requested_by": "agent:billing-ops@v41",
"policy_version": "2026-11-13.1", # which rule demanded this
"tool": "send_campaign",
# The EFFECT, resolved. Not the arguments.
"effect": "Email 31,042 active users the November price-change notice.",
"irreversible": "Cannot be unsent. Expect ~400 replies to support.",
"bound_crossed": "recipient_count 31042 > auto_send_limit 500",
# What the human is allowed to change, as flat primitives only.
"fields": {
"send_now": {"type": "boolean", "default": False},
"segment": {"type": "string", "enum": ["all_active", "paying_only"]},
"note": {"type": "string", "maxLength": 200},
},
"expires_at": "2026-11-13T18:00:00Z", # after this, cancel -- not accept
"args_digest": "sha256:9f3c…", # binds the grant to THESE arguments
}
# Do NOT ask for credentials here. MCP forbids it in form mode for a reason:
# anything the human types lands in the model context, the trace and the logs.
# Secrets go out of band -- a URL the agent never reads the contents of.Decline is not an error, cancel is not decline, timeout is neither
MCP’s three-action response model is the right taxonomy. Accept means the user explicitly approved and submitted. Decline means they explicitly rejected it. Cancel means they dismissed the request without making a choice — closed the dialog, pressed escape, walked away. Your queue adds a fourth that no protocol gives you: the request expired because nobody looked at it.
All four must reach the model as distinct observations and none of them as an exception. A tool that raises on rejection kills the turn and discards the trajectory; a tool that returns a structured refusal teaches the model what to do next. The highest-value field in the whole mechanism is the reason attached to a decline. "Rejected" makes a competent agent retry the identical call with a politer preamble. "Rejected: refunds over 1000 need the order ID in the note" makes it fix the call. Cancel and timeout mean something else entirely — not no, but no answer — and the correct behaviour there is to stop and report, never to proceed and never to retry.
# Four outcomes, four observations, zero exceptions. The model reads these.
def observe(outcome: dict) -> dict:
action = outcome["action"] # accept | decline | cancel | timeout
if action == "accept":
return {"status": "approved", "approval_id": outcome["approval_id"],
"fields": outcome.get("content", {})}
if action == "decline":
# The reason is the signal. Without it the agent retries verbatim.
return {"status": "declined",
"reason": outcome.get("reason", "no reason given"),
"retry": "only after changing the arguments the reason names",
"next": "propose a revised call or report back to the user"}
if action == "cancel":
return {"status": "no_decision", "detail": "approver dismissed the request",
"retry": "no", "next": "stop and report; do not re-request"}
return {"status": "expired", "waited_s": outcome["waited_s"],
"retry": "no", "next": "stop and report; escalate out of band"}
# Never raise() out of an approval path. An exception ends the turn and throws
# away the context that made the request sensible in the first place.The approval is for these arguments, and it expires
An approval is a grant over a specific tool-plus-canonicalised-arguments pair, not over a tool. If the model replans between the request and the resume and the amount changes, the grant is void and the only safe behaviour is to ask again. Hash the canonicalised arguments into the approval record and compare on resume. It is ten lines, and it closes the gap where the thing approved is not the thing executed.
Both SDKs expose this problem through their APIs, which is a good sign they hit it in practice. ADK requires the resuming FunctionResponse to carry an id matching the function_call_id of the adk_request_confirmation call and the name adk_request_confirmation, with a matching invocation_id or a fresh invocation starts instead — identity all the way down. Note also that confirmation is not supported with DatabaseSessionService or VertexAiSessionService, which rules out session backends plenty of deployments already run. On the OpenAI side, approval decisions can persist across handoffs to a tool of the same type and name and across runs that share a RunContextWrapper. That is convenient, and it is also a standing grant — bound it deliberately rather than inheriting it.
Record who approved, the exact arguments, the policy version that demanded the approval, and the time; then make that record the idempotency key for the action itself, so a double resume cannot double-execute. And be honest about duration. A pause measured in minutes is a checkpoint. A pause measured in days is a workflow — timers, retries, and a process that can be redeployed mid-wait without losing the pending decision. That is a different machine, and it is the subject of the next post in this series.
The default, and the interview answer
Default to this: a policy function over parsed arguments with three outcomes including deny, an interrupt placed above every side effect, an approval payload carrying the resolved effect rather than the call, four distinct outcomes returned as observations, and an approval record keyed to the exact arguments and reused as the idempotency key. Then measure approvals per completed task and treat a rising number as a design defect.
The interview answer is three moves. Classify by blast radius on the arguments rather than by tool name, because a refund of four dollars and a refund of forty thousand are the same function — which is why ADK and the OpenAI SDK both take a callable policy instead of a flag. Make the pause durable and idempotent, because frameworks re-run the node from its first line on resume, so any side effect above the interrupt happens twice against a single approval. And budget the approvals, because the clinical and aviation data say a gate that fires constantly produces a reflex rather than a review: every pilot handed a false engine-shutdown alert shut the engine down, after saying they would not.
The one-line version for a design doc: approve effects, not calls; put the gate above the side effect; and if the human is approving more than a couple of things per task, move the boundary instead of adding another dialog.
Work the same ideas as a full interview case study, with pressure questions and model answers.