How to do looping
Any edge pointing back at an earlier node is a loop. The work is in stopping it. This graph reviews an answer, sends rejections to a repair turn, and gives up after five unsuccessful rounds instead of arguing with itself forever.
Prerequisites
Section titled “Prerequisites”An authenticated harness and a local Git project folder.
review passes to done or rejects into repair; repair returns to review. Five unsuccessful repair rounds lead to exhausted.
How the bound works
Section titled “How the bound works”Three edges leave review and all three name the same repair_budget="answer". The retry edge starts a round. The exhausted edge carries the same condition and a lower weight, and runs once after five unsuccessful rounds. The reset edge on the passing verdict clears the budget so a later episode starts from five again.
Every retry edge needs an exhausted partner with the same explicit condition, the same budget and a different weight. Put both after the review that decides, never on a fan-out or inside a parallel branch. Graph and node visit limits stay independent of the budget and remain the outer guard.
Failure routing is separate. A failed stage takes a matching conditioned edge and never the ordinary fallback, so route outcome == 'failed' to a repair prompt that reads {{ context.failure_reason }} when the graph knows how to recover. Read the failure reason first: an authentication failure needs credentials, not another attempt.
Save, validate and run
Section titled “Save, validate and run”Download all files. Create a local Git practice repository. It needs no remote:
mkdir -p ~/orbital-bounded-retries/.orbitalgit init ~/orbital-bounded-retriescd ~/orbital-bounded-retriesExtract the archive into ~/orbital-bounded-retries/.orbital/. Keep every relative path. From ~/orbital-bounded-retries run:
orbital validate .orbital/workflow.dotAdd the project folder in Orbital. On New run select the project and workflow graph, choose your authenticated harness and supply the goal. Use a separate practice project for each example so the workflow name is unambiguous.
Expected behaviour
Section titled “Expected behaviour”The first passing verdict ends successfully. Rejection starts up to five repairs. A sixth rejecting review ends at exhausted with a failed outcome.
Complete source
Section titled “Complete source”Every DOT file below is a complete runnable graph. The archive contains the same files. Prompt files are companions, not separate workflows.
workflow.dot
Section titled “workflow.dot”digraph retries { graph [version="1", entry="review", max_visits="30"] review [prompt="Review the goal and any previous repair. Choose pass or reject.", outputs="verdict:choice"] repair [prompt="Revise the proposed answer to the goal. Do not change files."] done [shape="Msquare"] exhausted [shape="Msquare", outcome="failed"] review -> repair [condition="verdict == 'reject'", weight="3", repair_budget="answer", repair_round="retry"] review -> exhausted [condition="verdict == 'reject'", weight="2", repair_budget="answer", repair_round="exhausted"] review -> done [condition="verdict == 'pass'", weight="1", repair_budget="answer", repair_round="reset"] repair -> review}For a loop that watches something outside the run, add an insulator wait so polling spends no agent turns. See loops and error handling.