Recipe: Human-in-the-Loop Approval
This recipe pauses a workflow for a human decision before it does something consequential. An automation runs up to a gate, a hitl step collects a real person’s approval, and only on approval does the following action element run. It is the safety interlock for anything you do not want fully autonomous.
The problem it solves
Some steps should never run without a human saying yes — issuing a refund, sending a contract, deleting records, deploying. A fully automated flow either does them blindly or stops being automated at all. This recipe gives you the middle path: everything around the decision is automated, and the decision itself is a clean, audited checkpoint with a real reviewer.
Elements
| Element | Role |
|---|---|
automation | Orchestrates the flow and routes on the approval outcome. |
hitl | Collects structured human input — the approve/reject gate. |
python (or any action) | The consequential step that runs only after approval. |
Flow
- Build your
automationup to the point where a decision is needed. - Add a
hitlstep. Submit the request for review with itsinvokeoperation (the protocol alias ofsubmit); it requires anaudience(set onspec.audienceor passed in the input — submitting without one returns a 400HITL_NO_AUDIENCE). The run now waits on a human. - The reviewer acts:
approve(the run transitions to completed with approval status, with an optional reason for the audit trail) orreject. You can list everything currently waiting withpending, which returns audience, quorum progress, and per-respondent link URLs. - Branch on the outcome in the automation. Use a
conditionchild to run the next step on approve and skip (or escalate) on reject. - Run the consequential work only on the approved branch — a
python(or any action) step that performs the refund, the send, the delete.
What this shows
The human checkpoint is a first-class element, not a hardcoded pause: hitl carries an audience, a quorum, per-respondent links, and an approve/reject audit trail with reasons. The automation treats the decision like any other step — it references hitl, waits on its outcome, and routes with a condition — so the approval logic is visible in the flow graph rather than buried in code. You get autonomy everywhere it is safe and a real signature exactly where it matters.