EvaluationResult with a value, a confidence score, and optional reasoning. The real power is using that score in your workflow to control what happens next: retry if quality is low, skip a step if confidence is high, or branch to a different path. This generate-evaluate-retry loop is how you build self-correcting workflows — and it’s a core pattern when building AI agents.
Evaluators can be deterministic (rule-based checks) or use an LLM to judge quality. Deterministic evaluators are great for structured checks like length, format, or required fields. But more often than not, you’ll want LLM-as-a-judge — using an LLM to evaluate things that are hard to check with rules, like whether a summary is accurate, an email sounds natural, or a classification makes sense.
Deterministic Evaluator
A simple evaluator that checks whether a company summary meets basic structural requirements:evaluators.ts
1.0 because there’s no ambiguity. Use them for checks where the rules are clear-cut.
LLM-as-a-Judge Evaluator
For subjective quality — accuracy, tone, relevance — you need an LLM to evaluate. This is the more common pattern:evaluators.ts
await judgeSummaryQuality({ summary, companyName }). The workflow decides what to do with the result.
Evaluator Properties
EvaluationResult Types
Evaluators must return anEvaluationResult. Three types are available depending on what you’re scoring:
EvaluationBooleanResult
EvaluationBooleanResult:
- Pass/fail judgments
value: boolean- Quality gates, compliance checks
EvaluationNumberResult
EvaluationNumberResult:
- Numeric scores
value: number- Ratings (1-10), percentages
EvaluationStringResult
EvaluationStringResult:
- Category assignments
value: string- Classifications, labels
Boolean Evaluator
Pass/fail checks. Use these as quality gates — does this output meet the bar?evaluators.ts
Number Evaluator
Numeric scores for when you need more granularity than pass/fail. In most cases, pass/fail or a three-tier scale (pass/borderline/fail) gives more consistent results — see Evaluator Best Practices. But numeric scores are useful when you need to rank or compare outputs, or when you have well-defined anchors for each score level.
evaluators.ts
String Evaluator
Category assignments — classifying content into labels.evaluators.ts
Feedback and Dimensions
For more detailed evaluations, you can attach feedback (specific issues and suggestions) and dimensions (sub-scores that break down the overall result).evaluators.ts
Using Evaluators in Workflows
Evaluators are called like regular async functions. The typical pattern is: generate something, evaluate it, then decide what to do based on the score.workflow.ts
Options
Evaluators support the same options as steps for configuring retry behavior and timeouts. See Step Options for the full list.evaluators.ts
Shared Evaluators
When multiple workflows need the same evaluator, put it insrc/shared/evaluators/:
src/shared/evaluators/check_factuality.ts
workflow.ts
Evaluation Workflows
The evaluators on this page run inside your workflows — they power generate-evaluate-retry loops in production. For testing workflow quality across datasets without modifying your workflow code, see Evaluation Workflow. It coversverify() for creating typed evaluators, Verdict helpers for deterministic assertions, LLM judge functions, datasets, and running evals from the CLI.
What’s Next
- LLM-as-a-Judge Best Practices — Writing effective judge prompts, choosing grading scales, avoiding common pitfalls, and patterns for production evaluators
- Evaluation Workflow — Test workflow quality across datasets with
verify(),Verdict, and the CLI @outputai/evalsAPI Reference — Complete package reference