पाठ 10 / 26
Human Approval Steps
Pause for a person before risky actions.
Approve, reject, or time out
A user approval step pauses the workflow and asks a person to approve or reject before continuing, for example before issuing a large refund, sending an external email or changing account data. Show the approver exactly what will happen (action, amount, recipient), record who decided and when, and design the reject and timeout paths, not just the happy path. Model approvals as an explicit state machine so illegal transitions (approving an already rejected request) are impossible.
Approval as a state machine, run
I ran this with plain Python 3. It is a small model of the workflow idea, not Agent Builder itself, and no model is called. A pending request can move to approved, rejected or escalated (on timeout). Trying to reject an already approved request raises an error instead of silently changing it.
# Human approval as an explicit state machine with a timeout path.
TRANSITIONS = {("pending", "approve"): "approved", ("pending", "reject"): "rejected",
("pending", "timeout"): "escalated"}
def step(status, event):
nxt = TRANSITIONS.get((status, event))
if nxt is None:
raise ValueError(f"illegal transition {status} --{event}-->")
return nxt
for event in ["approve", "reject", "timeout"]:
print("pending --", event, "->", step("pending", event))
try:
step("approved", "reject")
except ValueError as e:
print("blocked:", e)
Output:
pending -- approve -> approved pending -- reject -> rejected pending -- timeout -> escalated blocked: illegal transition approved --reject-->
Approve the action, not the chat
Show the approver the concrete tool call and parameters, not a summary written by the model.
त्वरित जाँच: Which path is most often forgotten in approval steps?
- What happens on rejection or timeout
- The approve path
- The start node
- The model choice
Answer
What happens on rejection or timeout — Design every outcome.