lesson
60 min

Human-in-the-Loop Approval Gates

Design approval gates, step budgets, and audit logs so agents propose and people decide on every action that matters.

Objective

By the end of this lesson, you can classify agent actions by risk, design approval gates and step budgets, and write what a reviewer must see before approving.

Agents propose, people decide

A human-in-the-loop design puts a person at the points where a mistake would matter. The agent does the reading, searching, and drafting. A person approves the action.

Sort every tool by what it can do:

TierExamplesGate
ReadSearch FAQ, look up hoursNone; log it
DraftWrite a reply, fill a form without submittingNone; a person sees it before use
WriteUpdate a case record, schedule an appointmentApprove each action
Contact or spendSend a message, submit an application, make a paymentApprove each action, show full content
DestroyDelete records, close accountsDo not give this to an agent

What a good gate shows

A gate is only as good as what the reviewer sees. "Approve action? Yes / No" teaches people to click yes. Show:

  • The exact action: the full message, the exact field changes, every recipient.
  • Why: the agent's stated reason and the sources it used.
  • Blast radius: how many people or records are affected.
  • Undo: whether it can be reversed, and how.

Watch for approval fatigue. If people approve hundreds of trivial actions, they stop reading. Keep gates for actions that matter, and batch the low-risk ones into a summary.

Budgets and stop rules

Agents can loop: searching the same thing again and again, or retrying a failing step forever. Set hard limits in code:

  • Step budget: a maximum number of actions per task.
  • Time and usage budget: stop after a set time or amount of model usage.
  • Repeat detection: stop if the same action and input repeat.
  • Handoff: when a limit hits, stop and hand the task, with its log, to a person.
Run it. The agent is blocked at step 3 because it tried to email all volunteers. Change human_approves to always return True, then run again. What stops it now? Lower max_steps to 3 and run once more.
Python 3
Ctrl+Enter to run | Tab to indent | Python runs in your browser via Pyodide

The first run downloads Python into your browser (several MB).

A national example

Design your gates

Agent safety design

0 of 8 done

Go deeper: Automated Workflows: The Playbook for Cutting Busywork, Protecting Revenue, and Scaling Without Burning Out

Ask. Answer. Build together.