An estate agent writes a property listing. The law asks for some sentences, word for word. Some phrases are banned, and the length has a limit.
The first try runs the same agents in a fixed line. A later agent can undo an earlier one. A listing that breaks a rule can then go out.
A controller reads each draft and picks the one agent it needs.
- A writer makes the first draft.
- Code checks every rule on the draft.
- The controller picks the editor, trimmer or legal agent.
- It stops when all rules pass, or holds the listing back.
For example, a draft passes every rule except one required sentence. Only the legal agent runs. Nothing else can then cut or change the text.
sequenceDiagram
participant Code as Controller
participant Agent
participant Site
Code->>Agent: fix this one problem
Agent-->>Code: new draft
alt all rules pass
Code->>Site: publish
else the turns run out
Code->>Code: do not publish
end
- The code that picks is the controller.
- Each fixer is an agent.
uv run lab meta-controller naive
uv run lab meta-controllerAdd --case 2 up to --case 8 for other homes.
There are eight homes, and each one runs three times. Code counts the listings that went out with every rule met. Higher is better. A held listing counts for nothing.
| Version | Listings out with every rule met |
|---|---|
| Fixed line of agents | 16 |
| Controller picks | 24 |
Now break it. Open the pattern file and find choose. Make it always return nothing to do. Then run the test:
uv run pytest tests/promises/test_meta_controller.pyThe test fails, because a draft that breaks a rule now goes out.
- A "no key found" message means the key file is missing. Copy the example file and paste your key.
- No listing in the outcome means it never passed. The code held it on purpose.
Results change from run to run, and a single run can come out level. A held listing still needs a person to finish it. The controller here is plain code, which is enough when rules are clear.
Go to Coordinate through neighbours. It solves a task with many small neighbours instead of one boss.