Graders
Built-in graders for evaluating AI test outputs.
Graders define success criteria for evaluating test output. Each grader receives the execution outcome and returns a score (0 to 1) with a pass/fail judgment.
Shared Configuration
Every grader supports these options in addition to its type-specific configuration:
Negate
bool
false
Inverts the result (pass becomes fail)
Severity
string
Error
Info, Warning, or Error
Weight
double
1.0
Weight for aggregate scoring (0 to 1)
Severity determines how the grader affects the overall test result:
Info - Informational. Does not affect pass/fail.
Warning - Logs a failure but does not block the test.
Error - Fails the test and blocks (default).

Code-Based Graders
Code-based graders are deterministic and fast. They return a binary score of 1.0 (pass) or 0.0 (fail).
exact-match
Validates exact string equality between the output and an expected value.
ExpectedValue
string
(empty)
The exact value to match
IgnoreCase
bool
true
Case-insensitive comparison
contains
Validates that the output contains a specific substring.
SearchPattern
string
(empty)
The substring to find
IgnoreCase
bool
true
Case-insensitive search
regex
Validates that the output matches a regular expression pattern.
Pattern
string
(empty)
The regex pattern to match
IgnoreCase
bool
true
Case-insensitive matching
Multiline
bool
false
Enable multiline mode (^ and $ match line boundaries)
The grader includes match details in the result metadata when the pattern matches (match value, index, length, and named groups).
json-schema
Validates that the output is valid JSON containing expected keys. Uses dot-notation for nested property paths.
ExpectedKeys
string
(empty)
Required JSON keys (comma-separated, dot-notation for nested)
RequireAllKeys
bool
true
All keys must be present
When RequireAllKeys is false, the grader passes if at least one expected key is present.
tool-call
Validates that specific tools were called during execution. This grader inspects the transcript's tool calls rather than the output text.
ExpectedTools
string
(empty)
Tool names (comma-separated)
ValidationMode
string
Any
Any, All, Exact, or None
ValidateOrder
bool
false
Whether tool calls must appear in order
Validation modes:
Any
At least one expected tool was called
All
All expected tools were called (in any order)
Exact
The expected tools match the actual calls (same set)
None
None of the expected tools were called
When ValidateOrder is true (with All or Exact mode), the expected tools must appear in the specified sequence.
guardrail
Runs a guardrail evaluator against the test output. The grader passes when the evaluator flags the content.
EvaluatorId
string
(empty)
The guardrail evaluator to run
EvaluatorConfig
JSON (optional)
null
Evaluator-specific configuration
Model-Based Graders
Model-based graders use an AI model to evaluate outputs. They return continuous scores between 0 and 1.
llm-judge
Uses an LLM to evaluate the test output against custom evaluation criteria. The judge returns a score with reasoning.
ProfileId
guid
null
AI profile for the judge (optional)
EvaluationCriteria
string
(default)
What aspects to evaluate
PassThreshold
double
0.7
Minimum score to pass (0 to 1)
The default evaluation criteria is: "Evaluate the quality, accuracy, and relevance of the response."
The result metadata includes the judge's reasoning, strengths, and weaknesses.
decision-judge
Asks a Decision profile a yes/no question: does the test output meet your criteria? The answer comes back as a probability between 0 and 1. The grader uses the probability as its score, and passes when the score is at or above PassThreshold.
ProfileId
GUID
null
Decision profile to use. Only Decision profiles are listed. Leave empty to use the default Decision profile.
EvaluationCriteria
string
(default)
What aspects to evaluate
PassThreshold
double
0.7
Minimum score to pass (0 to 1)
The default evaluation criteria is: "Evaluate the quality, accuracy, and relevance of the response."
The result metadata includes the probability, the yes/no answer, the threshold, and the model ID.
The grader does not fall back to the llm-judge grader. Instead, it fails with a reason in these cases:
The Decision feature flag is turned off.
No profile is set and no default Decision profile is configured.
The call to the Decision profile fails.
Combining Graders
You can add multiple graders to a test. Each grader evaluates independently. A test run passes when all Error-severity graders pass.
In this example, the test fails if the length check or quality score grader fails. The keyword check is a warning and does not block.
Related
Concepts - Core testing concepts
Variations - A/B testing across configurations
Guardrails - Guardrail evaluators
Last updated
Was this helpful?