Skip to content
PERMISSION/PROTOCOL

Agent Approval Patterns for LangGraph and the OpenAI Agents SDK

Permission Protocol | | Edition 1

Both SDKs paused for approval and resumed after a process restart in our synthetic refund workflow. Replaying an old paused state produced a second mock refund in both examples. Check which state your application resumes and how it prevents the same approved operation from running twice.

Eight scenario results

Each trial started with the same synthetic $125 refund and a fresh local store. LangGraph paused with interrupt() and saved a SQLite checkpoint. The OpenAI Agents JavaScript SDK paused a tool configured with needsApproval and saved its RunState. The refund tool wrote a row to a mock SQLite ledger. We counted ledger rows rather than worker status messages.

ScenarioLangGraph nativeOpenAI SDK nativeExample application on both SDKs
ApprovalOne mock effect after resume.One mock effect after approval and resume.Consume the stored approval and record one effect.
RejectionResumed with zero effects.Resumed with zero effects.Persist the rejection and deny dispatch before resume.
Changed actionUntested.Untested.Approve $125, then attempt $250. Dispatch denies the change and records zero effects.
Expired approvalUntested.Untested.Dispatch at the expiry boundary is denied, with zero effects.
Duplicate resume or retryLatest completed-state retry added no effect. Replaying the retained pause added a second effect.The SDK rejected the serialized terminal state. Replaying the retained pause added a second effect.The consumed approval cannot be used again. One effect remains.
Process restartA fresh process loaded the saved checkpoint and recorded one effect.A fresh process restored the serialized run and recorded one effect.A fresh dispatch process restored the ledger and SDK state and recorded one effect.
Concurrent approvalsOne or two effects across recorded runs. See the trial counts below.Two effects in every November 17 native trial.One dispatch recorded one effect. The other process received an already-decided result.
Wrong approverUntested.Untested.The simulated wrong reviewer was denied. Dispatch recorded zero effects.

Each November 17 platform matrix recorded 24 assertion passes, two observations of native concurrency, and six native cases left untested. The three untested scenarios per SDK were changing arguments after approval, approval expiry and approver identity. We tested all three in the example application.

Concurrency and replay

In the November 17 Windows and Ubuntu runs, each SDK was tested ten times per mode on each platform. The native mode resumed two copies of a retained pause and recorded two effects in every trial. The application mode produced one effect in every trial. One contender won the transaction and the other was denied as already decided.

An earlier November 16 LangGraph probe on Windows recorded one native effect twice and two effects eight times. The guarded version recorded one effect in all ten trials. A November 12 Linux lab run also recorded one native effect, which failed the original fixed-count assertion. The process barrier coordinates when the contenders start. Their SDK checkpoint reads can still happen at different times. We did not isolate the cause of the variation. Keep both outcomes when testing a similar workflow.

An ordinary retry against the latest completed state behaved differently from an explicit replay of old paused state. Preserve terminal state and reconcile any uncertain execution outcome before dispatching again.

Production checklist

  1. Bind approval to the action. Store the parameters the reviewer saw and compare them with the parameters about to execute. Send a changed action back for review.
  2. Authenticate the reviewer. Check whether that person has authority for this action, account and environment. Recheck policy and expiry before dispatch.
  3. Claim once and reconcile. Store the winning claim durably, use the same operation ID for backend retries, and check the provider outcome if the worker stops between claim and execution.
  4. Record the decision and the result. Keep the approval record and the evidence of what actually ran. The lab ledger is an unsigned local record. See the approval evidence checklist for independent verification.

Apply this to one consequential action with the agent authorization guide and the approval design checklist.

Reproduce and download

Extract the ZIP above and open its README for the exact setup commands. The pinned runs used Python 3.13.7, Node 22.18.0, LangGraph 1.2.16, langgraph-checkpoint-sqlite 3.1.2, and OpenAI Agents JavaScript SDK 0.21.0. After setup, run from examples/agent-approval-lab using the isolated Python interpreter:

python test_research.py
python run_research.py --concurrency-trials 10 --output results/local.json

The ZIP includes pinned sources, platform matrices, per-trial CSVs, the November 16 probe and a SHA-256 manifest.

Scope and sources

The test used synthetic identities, a fixed clock, a deterministic OpenAI SDK model stub and local SQLite state. It exercised neither a live refund provider nor distributed failover, authentication, revocation, streaming or independent signing. The results are specific to the tested versions and setup. Production crash recovery and provider idempotency need their own tests.

Sources checked . The LangGraph interrupt documentation covers checkpointing and resumption. The OpenAI Agents SDK approval documentation covers resolving interruptions and continuing from run state. Try the LangGraph tutorial or the OpenAI SDK tutorial to build a minimal workflow.

n8n documentation comparison. Native tool review pauses a selected tool for an approve or deny decision in a configured channel. Our n8n coverage comes from its tool-review documentation and the setup walkthrough and unexecuted worksheet. The lab did not run n8n.

Plan an approval check for your workflow

Choose the exact action, who can approve it, and what to test before it runs.