How do you pause an agent workflow for human approval?
Pause an agent workflow for human approval by adding an explicit approval gate that interrupts execution, saves its state, and permits continuation only after an authorized person responds. Unlike a normal delay, the workflow must prevent the protected action from running while approval is pending.
Example: API test-generation agent
An agent prepares tests for a production payment API. It may draft and validate the tests automatically, but executing them against production requires a reviewer.
Generate tests → Validate → Request approval → Pause → Approve, reject, or revise
- Approve: After verifying the reviewer and scope, execute only the approved test plan.
- Reject: Stop the protected action and record the decision.
- Request changes: Return to test revision; seek fresh approval if the plan changes materially.
- No response: Stay blocked until a defined timeout or escalation policy takes effect. Never interpret silence as approval.
How to implement the approval gate
- Create a review request with a stable workflow ID, action summary, environment, relevant risks, and proposed parameters.
- Checkpoint the workflow state using durable persistence so the running process need not stay active.
- Interrupt before the sensitive action. The node should not make the production API call before approval is granted.
- Authenticate and authorize the reviewer. Approval must be tied to the intended action, tenant, and environment.
- Validate the response against allowed decisions and the exact version of the proposed plan.
- Resume the same workflow with the recorded decision, or terminate/escalate.
- Audit the transition including the reviewer, decision time, approved scope, and execution result.
LangGraph example
LangGraph supports human review with interrupt and Command(resume=...) when a checkpointer and consistent thread identifier are configured.
Conceptually, an approval node can request input:
PYTHONfrom langgraph.types import interrupt def approval_node(state): decision = interrupt({ "action": "execute_api_tests", "environment": "production", "test_plan_id": state["test_plan_id"] }) return {"approval_decision": decision}
The application collects an authenticated human decision and resumes the same thread using Command(resume=decision). The returned decision still requires server-side authorization and scope validation; the presence of an approval-looking string is not sufficient.
When the interrupted node resumes, code before the interrupt can run again. Keep external side effects outside that replay-prone section, or make them safely idempotent.
Production safeguards
- Persist pending approvals so worker restarts do not lose them.
- Prevent duplicate or conflicting approvals with atomic state transitions.
- Expire approvals when the plan, credentials, or target environment changes.
- Enforce a safe timeout and revocation path.
- Never embed secrets in approval notifications or workflow checkpoints.
In short
A safe approval pause is a durable, fail-closed checkpoint with authenticated decisions and controlled resumption. It gives people real authority over sensitive steps without blocking a worker indefinitely.
Learning Sequence
AI Agents Curriculum
Explore Related Questions
Deepen your understanding across related AI Agents topics.