Survive a restart, wait for a person
Build a claim flow that saves its place after every step, pauses for a human on large amounts, and pays exactly once.
-
Write the four steps as a graph and run one small claim end to end
Run this to check
uv run --with langgraph --with langgraph-checkpoint-postgres --with "psycopg[binary]" --with openai claim_flow.py start --thread t0 --amount 20You pass when
The claim is paid in one run, and a payments table has one row for t0.
Files you write
- claim_flow.py
-
Stop and wait for approval when the amount is over 100
Run this to check
uv run --with langgraph --with langgraph-checkpoint-postgres --with "psycopg[binary]" --with openai claim_flow.py start --thread t1 --amount 250You pass when
The process prints that it is waiting for approval and exits. Nothing is paid.
Files you write
- claim_flow.py
-
Approve it from a new process
The second run is the real test. Any step that moves money must be safe to repeat.
Run this to check
uv run --with langgraph --with langgraph-checkpoint-postgres --with "psycopg[binary]" --with openai claim_flow.py resume --thread t1 --approveYou pass when
It carries on from the saved step and pays. Run the same command again: there is still exactly one payment row for t1.
Files you write
- claim_flow.py
-
See the same contract in a ready-made stack
Optional. Flisk's agent resource keeps sessions in a checkpoint store in the same way your flow keeps threads in Postgres.
Run this to check
flisk project agent-stack && flisk upYou pass when
A local stack starts with an agent, tools and a database. flisk status --json shows the resources; flisk agent sessions
lists stored sessions, and they are still listed after flisk restart .