Templates / AI agent patterns / ai-evaluator-optimizer

AI Evaluator–Optimizer

One model call writes, a second grades the result against the brief and explains what to fix, and the feedback goes into the next attempt. The loop ends when the grade reaches 8 of 10; a FEEL counter caps it at three attempts, after which a human editor takes over, so a hard brief cannot burn tokens forever.

aievaluator-optimizerloopai agent taskquality gate
Open in editor Download .bpmn
casen template use ai-evaluator-optimizer
accept retry again human Firstattempt Generate Evaluate Next attempt Human editortakes over Deliver text Brief received Score ≥ 8? Attempts left? Delivered

Scenarios · 2

  • The first draft scores 9 and is delivered generate → evaluate → good-enough → deliver → delivered
  • Three low scores hand the text to a human editor evaluate → next-attempt → evaluate → next-attempt → evaluate → human-editor → delivered

Job types · 2

  • io.camunda.agenticai:aiagent:1 Generate, Evaluate
  • pim-description-update Deliver text

Files · 2

Every scenario passes on @bpmnkit/engine's runScenario in the package's tests. casen template use ai-evaluator-optimizer [dir] writes the files above into your project — see the templates guide for running the scenarios and deploying.