Why it matters
Agents reach points where a human must decide: spend above a limit, send an external message, delete data. The naive implementation keeps the run in memory and waits, which loses the task on deploy and pins a worker for minutes. The engineering problem is to represent the pause as durable state plus a resume token, so waiting costs nothing and the decision is recorded.
Mental model
An interrupt is a save point in a game: the console can be switched off and the level resumes where it stopped. The metaphor breaks because a save point restores a private world, while resuming an agent re-enters a world that changed, so the state must be revalidated rather than trusted.
How it works
Event · step 1 of 6
Running
Step 4 is about to dispatch a 1,240 refund. The run holds the proposal in memory and has not called the tool.
In state
- Running
Next: Interrupt requested
- Pending
- —
- Step
- 4
Figure. An interrupt moves the run from Running to a persisted Paused state, and only a matching approval moves it back. The red exits are the two ways a pause ends without resuming: rejection and timeout.
What to notice. Pausing before the call is what makes the decision matter. The worker is released while paused, so the wait costs no process; on resume the harness rechecks version, price and permission and re-executes the stored proposal under one idempotency key. The refund amount and wait times are illustrative.
Text version
A state machine with six states. Running goes to Interrupt requested on boundary. The request goes to Paused on persist. Paused goes to Resumed on approved, to Cancelled on rejected, and to Expired on timeout. Expired goes to Cancelled as the default outcome. Resumed has a dotted loop back to Running labelled continue. The trace walks Running, Interrupt requested, Paused, a second Paused step after 41 minutes of waiting, Resumed, and Running again. The pending-age counter reads zero, six minutes, 41 minutes and then a dash once approval arrives; the step index moves from four to five when the run continues.
- Persist the run state and the pending question before returning control to the caller.
- Give the interrupt an id, the exact decision required, the options and the consequence of each.
- Pause before the consequential step and store the intended action as a proposal.
- On resume, re-check preconditions such as data version, permissions and price before executing the proposal.
- Make the resume handler idempotent, keyed by the interrupt id.
- Expire unanswered interrupts into a default: cancel, escalate or a safe fallback.
Trade-offs
| Choice | Good for | Cost | Fails when |
|---|---|---|---|
| Blocking wait in process | Simplest to code | Loses state on restart, holds resources | Runs are long or the service redeploys often |
| Durable pause and resume | Survives restarts, cheap while waiting | State schema and revalidation work | The world changes fast and preconditions rarely hold |
| Auto-approve after timeout | No stalled tasks | Consequential actions proceed unreviewed | The action is irreversible |
| Cancel on timeout | Safe default | Work is lost and users retry | Approvals commonly arrive late |
Good for
Simplest to code
Cost
Loses state on restart, holds resources
Fails when
Runs are long or the service redeploys often
- Runs are long or the service redeploys often
- The world changes fast and preconditions rarely hold
- The action is irreversible
- Approvals commonly arrive late
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: Blocking wait in process is good for Simplest to code, costs Loses state on restart, holds resources, and fails when Runs are long or the service redeploys often. Durable pause and resume is good for Survives restarts, cheap while waiting, costs State schema and revalidation work, and fails when The world changes fast and preconditions rarely hold. Auto-approve after timeout is good for No stalled tasks, costs Consequential actions proceed unreviewed, and fails when The action is irreversible. Cancel on timeout is good for Safe default, costs Work is lost and users retry, and fails when Approvals commonly arrive late
Failure modes
- Resume replays the step. The action executes twice because the pre-pause attempt also committed. Debug: look for two records sharing one idempotency key.
- Stale approval. The run resumes and approves a price or permission that changed during the wait. Debug: store the version seen at pause time and reject a resume whose version differs.
- Interrupt lost on deploy. The in-memory wait disappears and the task hangs forever. Debug: query for runs in a waiting state older than the timeout.
In production
Track interrupts by age, approval latency and expiry rate. Cap how long a run may wait and alert when the pending queue grows faster than it drains.
Common misconceptions
People think: An interrupt is the same as a chat message asking for confirmation.
Actually: A message continues a conversation; an interrupt suspends a durable run and must survive a restart.
People think: Resuming is just calling the function again.
Actually: Calling again repeats work and side effects; resuming restores state and continues from the stored position.
Interview angle
Strong answers describe the pause as persisted state with a resume token, explain revalidation on resume, and give a timeout policy. They mention the duplicate-execution window. Weak answers describe an approval prompt in the UI and never say what happens if the process dies while it is open.
Sources
- LangGraph documentation — graph state, checkpoints and interrupts for human-in-the-loop runs.
- Temporal documentation — durable execution, signals and long waits across restarts.