The workflow
branch-loop.fabro
Command nodes
Thevalidate node has shape=parallelogram, making it a command node. It runs a shell script and captures the output:
|| true ensures the command always exits successfully — this way the node itself doesn’t fail even when tests fail. The test output is captured as command.output in the run context for downstream nodes to use.
Conditional branching
Thegate node has shape=diamond, making it a conditional node. It evaluates outgoing edge conditions against the current run context:
- If the previous stage (
validate) succeeded → take the “Pass” edge toexit - Otherwise → take the unconditional “Fix” edge back to
implement
condition="outcome=success" checks the status of the most recently completed stage. An edge without a condition acts as the default fallback.
Condition expressions
Conditions support more than just equality checks:The fix loop
When tests fail, execution loops back toimplement. The agent receives context about what happened — the test output and failure details — so it can fix the issues:
implement runs, it sees the previous test output in its preamble, guiding the fix.
Preventing infinite loops
This workflow has no explicit loop limit, but in production you should add one. Usemax_visits to cap how many times a node can execute:
Fixed-count loops
Sometimes you want a node to execute exactly N times before moving on — for example, running an improvement pass 5 times. Useinternal.node_visit_count in an edge condition:
gate has been visited 5 times, the condition matches and execution advances to exit. The unconditional edge back to improve serves as the default fallback for earlier visits.
Node type summary
This workflow uses four node types:| Node | Shape | What it does |
|---|---|---|
plan | tab | Single LLM call, no tools |
implement | box (default) | Agent with tool access |
validate | parallelogram | Runs a shell script |
gate | diamond | Routes based on conditions |
What you’ve learned
- Command nodes (
shape=parallelogram) run shell scripts and capture output - Conditional nodes (
shape=diamond) route execution based on edge conditions - Loops are just edges that point backward — the agent receives prior context on each visit
max_visitsprevents infinite loopsinternal.node_visit_countin edge conditions enables fixed-count loops- Unconditional edges act as default fallbacks
Next
Parallel Review
Fan out to concurrent branches and merge the results.