Evaluation & Optimization

Pattern

Evaluator-Optimizer Pattern

Improve output quality with dual agents. Evaluator analyzes quality while optimizer refines results through iterative feedback.

AdvancedOct 2025View the full pattern on desktop
Evaluator-Optimizer Pattern preview

Problems solved

  • Evaluate draft quality with a dedicated evaluator tool
  • Optimize content iteratively from evaluation feedback
  • Loop evaluator and optimizer tools under one orchestrator agent
  • Stop once quality thresholds or step limits are reached

Use cases

  • Marketing copy optimization loops
  • Technical documentation review agents
  • Translation quality control workflows
  • Creative writing refinement assistants

AI SDK APIs

new Agenttool(stepCountIsExperimental_Agenttools:gateway

Tags

aiagentsorchestratorevaluatoroptimizerquality-assurancecontent-optimizationai-sdk-v5streamingerror-recoverytool-coordination

Requirements

Node.js
24+
Memory
1GB
Other
  • OpenAI API key

Environment variables

External services

openai

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View the pattern on desktop

Related patterns