AssayAssay
05 / 08

Lesson 05 · Structure · 12 min

Human in the loop

Some actions should not happen without a person. The weak way to arrange this is to instruct the agent to ask first. The strong way is to make the pause part of the structure: execution reaches a node, stops, and does not continue until a decision arrives.

The difference is not about how often it works. It is about what is possible. An instruction can be misread, argued around, or lost in a long context. A node has no such surface — nothing downstream of it runs until a decision is supplied.

A human in the loop, as a noderecommendllmapprove?interruptactside effectendapproveda person decides hereput it immediately before the irreversible step, not at the start
Execution reaches the interrupt and stops. Nothing downstream runs until a decision is supplied — a node cannot be argued around the way a prompt instruction can.
InterruptA node that halts execution and returns the state so far, waiting for external input before resuming.

Interrupts change what the runtime must do: it has to be resumable. Run until the interrupt, hand back the state, and later continue from that node with the decision added. This is why graph frameworks talk about checkpointing — resuming is the feature, and persistence is what makes it survive a restart.

Design the pause for the person, not the machine. They need the recommendation, the evidence behind it, and an obvious way to say no. The guarded graph here recommends an action first, so the human approves a specific proposal rather than an abstraction.

Put the interrupt immediately before the irreversible step, not at the start. Approving a plan is not the same as approving the action it ends in, because everything in between can still change what actually happens.

Checkpoint

Produce one approved run and one refused run, and note where execution paused in each.

Identical to the routed graph until money is involved. Refunds pause at an interrupt node and wait for a person. Because the pause is a node rather than a prompt instruction, it cannot be talked around.

“My order 88213 arrived with a cracked base. I'd like a refund please.”

Run the damaged-item message through the guarded graph. It stops at the approval node — try both Approve and Refuse and compare the replies.

Graph structure

ClassifyRouteExtract order numberLook up orderRead refunds policyRecommendHuman approvalReply about a refundReply generallySend

Pick a graph and a message, then press Run — the nodes it visits light up.