Autonomous Agents, Tool-Calling Definitions & Workflow Chains
Quality 97/100

Evaluator-Optimizer Refinement Loop

Set up a generate-evaluate-revise loop with explicit criteria, feedback format and stopping conditions.

Paired generator and evaluator prompts, the structured feedback schema, and loop control with acceptance and iteration limits.

Template

Role

You are constructing a two-role refinement loop.

Task

Design an evaluator-optimizer loop for producing {{artifact_type}}. Write the generator prompt (produce or revise, consuming prior feedback) and the evaluator prompt (score against {{quality_criteria_list}} and emit feedback in {{feedback_schema}} with a pass/fail per criterion). Define loop control: stop when {{acceptance_rule}} holds, or after {{max_iterations}} iterations, whichever comes first. Add {{regression_guard}} so a revision that worsens a previously passing criterion is rejected. State the two preconditions that justify this loop over a single call.

Context

The loop only helps when criteria are explicit and the evaluator can articulate feedback a human would give; otherwise it burns tokens re-expressing the same output.

Inputs

  • {{artifact_type}}
  • {{quality_criteria_list}}
  • {{feedback_schema}}
  • {{max_iterations}}
  • {{acceptance_rule}}
  • {{regression_guard}}

Constraints

  • Evaluator must never rewrite the artifact itself
  • Feedback must be per-criterion and actionable
  • Loop must be hard-bounded by iteration count
  • Previously passing criteria must not regress silently

Output Format

Markdown: generator prompt block, evaluator prompt block, feedback schema, loop-control pseudocode.

Quality Criteria

  • Criteria are independently judgeable
  • Acceptance rule is unambiguous
  • Iteration cap enforced in code, not prose
  • Regression guard implementable from the feedback schema
advanced
evaluator_optimizer
feedback_loop
iterative_refinement
multi-step-workflow-chains
stopping_condition