Interrupts and Resume
Interrupts let a node pause execution and wait for user input.
Node side
Or use useReason({ interrupt: ... }) when you want model-generated interrupt requests constrained by schema.
Stream side
During interrupt, runtime/orchestrator emits:
Resume payload
@kortyx/agent resume metadata shape (from parseResumeMeta):
Accepted selected shapes:
- string
- string[]
{ choice: { id } }{ choices: [{ id }, ...] }
Good to know: On resume, node code starts again from the top.
useReasoncontinues from its internal checkpoint, but code beforeuseReasoncan run again unless you guard it. Prefer puttinguseReasonfirst in the node and useuseNodeStatefor pre-events that should emit once.
Persistence requirements
Resume only works if the framework adapter persists pending requests + checkpoints.
- in-memory adapter: good for local dev, not restart-safe
- redis adapter: recommended for production resume
- hook state (
useNodeState/useWorkflowState) follows the same checkpoint lifetime and limits