Fix sub-workflow tutorial visit limit and run command

This commit is contained in:
Scott Werner 2026-10-28 17:13:34 -04:00
parent 0310a10ff6
commit 27b5885831
2 changed files with 11 additions and 5 deletions

View file

@ -19,7 +19,7 @@ First, create a standalone implement-and-test workflow. This is a normal workflo
```dot title="implement-and-test.fabro"
digraph ImplementAndTest {
graph [goal="Implement the plan and make tests pass"]
graph [goal="Implement the plan and make tests pass", max_node_visits=6]
rankdir=LR
start [shape=Mdiamond, label="Start"]
@ -31,12 +31,14 @@ digraph ImplementAndTest {
start -> implement -> validate -> gate
gate -> exit [label="Pass", condition="outcome=succeeded"]
gate -> implement [label="Fix", max_visits=5]
gate -> implement [label="Fix"]
}
```
This is the same implement-test-fix loop from the [Branch & Loop](/tutorials/branch-loop) tutorial, packaged as its own file.
The child's `max_node_visits=6` allows one initial implementation and up to five repair passes. If another visit is needed after that, the run fails instead of looping indefinitely. Visit limits belong on the graph (`max_node_visits`) or a node (`max_visits`), not on an edge.
## The parent workflow
Now create a parent workflow that delegates to the child:
@ -61,8 +63,12 @@ digraph SubWorkflow {
}
```
Save both files in the same directory, then validate and run the parent:
```bash
fabro run docs/internal/demo/12-sub-workflow.fabro
fabro validate implement-and-test.fabro
fabro validate sub-workflow.fabro
fabro run sub-workflow.fabro
```
## The house node

View file

@ -1,5 +1,5 @@
digraph ImplementAndTest {
graph [goal="Implement the plan and make tests pass"]
graph [goal="Implement the plan and make tests pass", max_node_visits=6]
rankdir=LR
start [shape=Mdiamond, label="Start"]
@ -11,5 +11,5 @@ digraph ImplementAndTest {
start -> implement -> validate -> gate
gate -> exit [label="Pass", condition="outcome=succeeded"]
gate -> implement [label="Fix", max_visits=5]
gate -> implement [label="Fix"]
}