This example demonstrates static interrupts (debug breakpoints) in the
graph executor.
Unlike Human-in-the-Loop (HITL) interrupts where you call graph.Interrupt(...)
inside a node, static interrupts require no code inside the node.
You only attach options when declaring nodes:
graph.WithInterruptBefore()pauses before a node executes.graph.WithInterruptAfter()pauses after a node executes.
This workflow has three nodes:
startruns normallymiddlehas bothWithInterruptBefore()andWithInterruptAfter()endfinishes the workflow
So the program runs three times:
- Interrupts before
middle - Resumes, runs
middle, then interrupts aftermiddle - Resumes again and completes at
end
go run .Notes:
- This example uses the official in-memory checkpoint saver, so resume happens within the same process run.
- For a persistent resume workflow (restart the program later), use a real saver such as SQLite or Redis.