New Tool Radar

AI Agents & Automation

How to Set an Expiry for a Pending Agent Approval

Set an expiry on a pending agent approval so a request nobody answers ends safely instead of waiting forever.

Schematic with three steps: Write the expiry and the expiry outcome; Check pending approvals against the expiry on; Test with a short expiry.

LangGraph interrupts wait indefinitely until a person resumes the run, and the docs are explicit that a time limit is yours to build. That is the gap this guide closes: a pending approval needs an expiry, or a request sent on Friday waits until Monday with the run still open. Decide the expiry before the approval is requested, such as four working hours, and decide what happens at expiry: the run ends without the risky step, and the requester is told. Never let expiry mean approval; an unanswered request must end as a no.

What you need

  • An agent run that already pauses for human approval
  • An expiry length agreed with the approver, for example four working hours
  • A named outcome for expiry: end the run without the risky step

Step 1: Write the expiry and the expiry outcome down

Record the expiry length and what happens when it passes: the run ends, the risky step does not run, and the requester is told why. Expiry must never mean approval.

Step 2: Check pending approvals against the expiry on a schedule

Add a scheduled check that lists approvals older than the expiry and ends those runs without the risky step. The check must run even when nobody is watching the queue.

Step 3: Test with a short expiry

Set a five-minute expiry on a test run, leave it unanswered, and confirm the run ends safely after five minutes with no risky action and a message to the requester.

Worked example: synthetic approval expiry

The table below is a synthetic example. It shows the expected result of the expiry; no run was left waiting.

Check Expected Result
Approval unanswered for 5 minutes Expires Pass
Risky step runs on expiry No Pass
Requester is told Yes Pass
Run ends cleanly Yes Pass

Expected result (UNTESTED). the unanswered approval expires after five minutes, the risky step does not run, and the requester is told the run ended. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • LangGraph itself waits indefinitely, so the expiry is your code, not the framework’s.
  • Expiry must end as a rejection, never as an approval by silence.
  • A scheduled expiry check that never runs is the same as no expiry, so confirm it runs.
  • A short expiry can kill legitimate approvals, so match the length to how fast approvers actually answer.

Sources

See all