Catalog / Single agent
Evaluator–optimizer
One model writes, another judges the result against explicit criteria. The draft goes round the loop until the evaluator passes it.
Reference task used across all patterns: "My order arrived damaged. Can I get a refund?"
Topology
Run
09 steps
Ready to run
Play runs the whole scenario. Step advances one event at a time so you can read what happens.
Metrics
| Wall-clock time | 0.0 s |
|---|---|
| Tokens processed | 0 |
| Estimated cost | $0.000 |
| Iterations | 0 |
All steps
Normal run
- Request arrives. The facts are already settled. Order 4417 qualifies for a refund; what remains is writing a reply that meets the support team's standard.
- First draft. The writer produces a correct reply. It approves the refund and names the order, but it reads like a form letter.
- Submit the draft. The draft goes to a second model with a different prompt. Judging is easier than writing, so the judge catches what the writer missed.
- Evaluate. The evaluator scores the draft against a written rubric: correct decision, states when the money arrives, apologises. Two of three pass.
- Critique. The feedback is specific and actionable. A bare “try again” would give the writer nothing to work with.
- Revise. The writer keeps what passed and fixes what failed. Its context now holds the first draft and the critique.
- Resubmit. The second draft goes back for the same evaluation.
- Pass. All three criteria are met on the second round. The loop has a reachable exit, and it took it.
- Respond. Refund approved, in a reply the team would sign. Two rounds cost about twice the tokens and time of one.
Outcome: correct answer, better written. The loop paid off because the criteria were explicit and the second draft was measurably better than the first. Without both, the extra round is wasted cost.
Failure mode
- Request arrives. Identical start to the normal run.
- First draft. The same acceptable first draft.
- Submit the draft. Nothing has gone wrong yet.
- An impossible rubric. Two teams each added a rule to the rubric. “Under 50 words” and “quote the refund policy in full” cannot both be satisfied by any draft.
- First critique. The draft quotes the policy, so it is too long.
- Revise. The writer obeys. It cuts the policy quote and comes in under 50 words.
- Opposite critique. The shorter draft now fails the other rule. Each critique is reasonable on its own; together they point in opposite directions.
- The loop oscillates. Drafts three, four and five swing between the two demands. Every round re-sends the full history, so each one costs more than the last.
- Budget exhausted. The run hits its token budget on the fifth iteration. The customer has no reply, and the first draft would have been acceptable.
Failure: the loop never converges. An evaluator loop needs an exit it can always reach. Mitigation: cap the iterations, return the best draft so far at the cap, and test the rubric for criteria that contradict each other.
Execution trace
Reference
- Problem
- First drafts are often close but not good enough, and the quality bar can be written down as explicit criteria.
- Analogy
- A writer and an editor. The editor marks up the draft and the writer revises, until the editor signs off.
- Use when
- Clear evaluation criteria exist and iteration measurably improves the output: tone-sensitive replies, translation, code checked against tests.
- Avoid when
- The criteria are vague, or the evaluator is no better at judging than the writer is at writing. Every round multiplies latency and cost.
- Typical failure
- Non-convergence: unreachable or contradictory criteria combined with no iteration cap.
- Also known as
- Evaluator-optimizer (Anthropic)Reflection (LangGraph, related)LoopAgent (Google ADK, related)
- Related patterns
- Reflection (alternative)
- Pipeline (composes with)
Space play or pause → next step ← previous step R reset F failure mode