Blocks
Loop until
The loop-until step: repeat a body until a condition over its output becomes true — retry, poll, and refine loops.
The cycle primitive: repeatedly run the steps wired to its loop port, feeding each pass's output back in, until the stop condition over that output becomes true — then the final payload leaves the done port. This is retry-until-success, poll-until-ready, generate-and-refine.
Config
The stop condition plus the safety cap.
- Stop when — an expression over the body's output (same
dialect as if):
payload["status"] == "done". Checked after each pass — the body always runs at least once (do-until). - Max iterations — safety cap, default 50, ceiling 1000. If
the condition never turns true, the loop stops and the payload
carries
"_loop_exhausted": true.
Output
The final body output, on done. Branch on
payload["_loop_exhausted"] when hitting the cap means something
different than finishing.
Patterns
- Poll until ready — call a job-status API →
wait → loop until
status == "complete". - Refine — generate with an AI step → validate → loop until the check passes.
Gotchas
- The condition reads the body's output, not the original input — make sure the last body step actually emits the field you're checking.
- Put a wait inside polling bodies; a tight loop against an API burns the iteration cap in seconds.