How do I prevent an agent from changing an action after a human approved it?
By Thrive AI Editorial · Created 2026-10-07 · Updated 2026-10-08
Thrive AI Editorial · AI-assisted worked example, not a member conversation.
A LangGraph workflow pauses with interrupt() to let a human review a work-item action. While it is paused, the stored proposal changes from project-alpha to project-beta. The reviewer still submits approval for the original proposal.
Will Command(resume=...) continue after the pause with the originally reviewed values, or rerun the node against updated state? How can the execution boundary reject a changed proposal?
This AI-assisted editorial reproduction runs real interrupts and graph.update_state. Its side effect is an append to a local list; it creates no external work items.
0 score
Sign in to vote or contribute. Scores count actual member votes, not editorial endorsements.
1 published answer
A selected solution is chosen by the question author or moderator, not an independent certification. Check assumptions before using any code in production.
Thrive AI Editorial
AI-assisted editorial answer · not member testimony
2026-10-07
Executed framework reproduction
Approve an exact proposal, not a boolean. Revalidate the reviewed payload when the interrupted node restarts.
Failure → corrected execution path
Failure
01Approve project-alpha
↓
02Proposal changes to project-beta
↓
03Boolean approval executes beta
Correction
01Record reviewed proposal digest
↓
02Resume and compare current proposal
↓
03Changed payload rejected
Execution record · LangGraph 1.2.14 · Python 3.13.2
Assertions and captured output cover the shown local example only. This record appears only while the published question and answer bodies exactly match the tested editorial version.
Jump to a section 8 section links
Short answer
An interrupted node restarts from its beginning on resume. A boolean approval can therefore authorize code that has just reread different state. Bind the review to a specific proposal, compare it again after the interrupt returns, and refuse execution if a material field changed.
The digest below is a change detector, not proof of identity. In a service, retrieve the approved proposal and reviewer decision from trusted server-side storage. A digest supplied freely by a client is not an authorization token.
The failure sequence
Step
State or decision
Unsafe behavior
First invoke
Target is project-alpha
interrupt exposes alpha for review
While paused
update_state changes target to project-beta
Stored graph state now contains beta
Resume
Approved=true for the original review
Node starts over and rereads beta
Execution
Boolean still true
Wrong target is appended to effects
The corrected branch compares a digest of the current proposal with the digest saved at review time. A changed target returns rejected without appending an effect.
Why the placement matters
The example calls interrupt before appending anything. An assertion proves that the initial pause has no effect. Moving the append above interrupt would allow it to execute before review and again when the node restarts.
Each scenario builds its own graph and checkpointer. We run four cases: unsafe mutation, guarded mutation, unchanged approval, and explicit rejection. That makes the negative paths visible instead of showing only a happy-path approval.
Run the reproduction
Save the Python block as approval_binding.py. It makes no model calls and requires no API key. Use an isolated environment; these commands are for macOS/Linux shells.
The recorded run used Python 3.13.2 on macOS. The two direct dependencies above are pinned; our full transitive dependency lock is maintained in scripts/community-examples/requirements.lock. Other runtime combinations are not claimed as tested.
The runner executed this exact source with assertions enabled. The following is captured standard output, not an invented transcript. Error descriptions are deliberately normalized by the example; they are not full exception tracebacks.
The first branch is intentionally unsafe within this local demonstration. It must not become a production fallback if validation fails.
The production boundary this does not implement
A production approval record needs the reviewed action, proposal version, authenticated reviewer, expiry and execution status. Recheck current permissions at execution. Material changes require a new review, not a silent update to the stored digest.
The local digest comparison does not atomically consume a durable approval. It does not prevent two workers from executing the same unchanged approval. A single append after one resume proves neither exactly-once delivery nor safe retries.
For an external side effect, add an operation identifier, atomic admission/consumption and a provider idempotency boundary where supported. If execution times out with an unknown outcome, reconcile it; do not reset the approval and blindly retry.
Normalization is application-specific. This example uses sorted, compact JSON and forbids NaN. Define stable representations for money, timestamps and semantically equivalent arguments before a human reviews them.
When to use this diagnosis
Use it when a paused workflow can be edited, regenerated or resumed against mutable state. If the reviewed action is already immutable, still test restart behavior and repeated execution separately.
Source checked 2026-10-08: LangGraph interrupts and persistence/state updates. Original AI-assisted reproduction; the proposal-binding policy is application logic, not a security guarantee supplied by LangGraph.
0 score
Sign in to vote or contribute. Scores count actual member votes, not editorial endorsements.