Human approval gates: what happens while approval is pending
In this article (5 sections)
Approval can take minutes or days. A workflow should not hold a worker, lock or open transaction while it waits, and it must not execute the proposal prematurely.
Persist a resumable state
The agent controls lab creates an authored pending record.
from agent_cases import pending_approval_case
result = pending_approval_case()
assert result["state"]["status"] == "approval_pending"
assert result["side_effects_while_pending"] == 0
assert result["resumable"] is True
assert result["approval_bound_to_digest"] is TrueThe state stores a proposal digest and expiry. No external write occurs.
Define allowed transitions
While pending, allow an authorized reviewer to view, approve or reject. Release compute resources and persist the checkpoint. Notify according to policy with bounded reminders; do not create a retry storm.
Approval records authenticated reviewer, role, timestamp, decision and exact proposal digest. If inputs, content or target change, invalidate it. On expiry, move to expired and require fresh review.
Resume defensively
Recheck authorization and preconditions at execution time. Use an idempotency key, save the receipt and show final status to the reviewer. Handle cancellation while pending and prevent approval/cancellation races with transactional transitions.
The Generative & Agentic AI course makes approval a durable state with tests, not a chat message.
Exercise
Simulate approve, reject, expire and cancel races. Verify no held locks, one terminal state and zero writes until a valid matching approval.
Continue learning
This article is part of the Agent workflows and state sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Set retry and timeout budgets across agent steps.
- Continue with Cancel a long-running agent without leaving orphan work.
Reference: LangGraph interrupts.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our Generative & Agentic AI programme — 3 months. Add practical GenAI, retrieval and agent-building skills to your existing toolkit.
Explore Generative & Agentic AI