Loop or graph: how should agents be coordinated?
Use a loop to improve one task until it passes. Use a graph when several specialists need to branch, rejoin and share state.
There are three shapes. A sequence is steps that depend on each other and run once. A loop repeats one task, checking it each time, until it meets an exit condition. A graph coordinates several tasks, with connections that decide what runs, retries, pauses or stops.
A graph needs shared state so every agent stays aligned. In mine that is scope, diff, evidence, status and budget.
Graphs cost coordination. Start with the simplest shape that fits. A common mistake is building a complicated system for work a checklist could finish.
Lessons that use it
- 09Loop or graphA loop improves one task. A graph coordinates several.
The ruleReach for the simple shape first.
- 10What the graph holdsBuilder, tester, security reviewer, checks, an evidence pack and a gate only I can open.
The ruleIf several agents share a task, write down the state they all read from.
- 12Sequence, loop or graph?Choose the simplest shape that matches the work.
The ruleUse a checklist when a checklist does the job.