# 7.6 Planner-generator-evaluator

A planner writes the spec; generator and evaluator agree on a sprint contract, then iterate against it.

1. The planner expands a short prompt into a product spec.
2. Generator and evaluator negotiate a sprint contract before any code.
3. The generator builds; the evaluator drives the live app with Playwright.
4. One failed criterion fails the sprint; bugs feed the next build.

- **Use when:** Long builds where self-evaluation is too lenient to trust.
- **Avoid:** Tasks inside the model’s solo capability: the overhead is large.

```
spec = planner(prompt)

for sprint in spec:
    contract = negotiate(generator, evaluator, sprint)
    while True:
        generator.build(contract)
        bugs = evaluator.run(contract, playwright)
        if not bugs: break      # every criterion clears its threshold
        generator.receive(bugs)
```

## References

- [Harness design for long-running apps](https://www.anthropic.com/engineering/harness-design-long-running-apps) (Anthropic)
- [Demystifying evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) (Anthropic)
- [Building effective agents](https://www.anthropic.com/engineering/building-effective-agents) (Anthropic)
