notScorable()
Declares that the current run has nothing for this scorer to evaluate. Return it from a scorer function step, typically preprocess. Remaining steps are skipped, so the judge is never called and averages, gates, and thresholds only include runs this scorer actually evaluated.
Use notScorable() when whether a run qualifies depends on the run's own input or output, such as whether a specific tool was called. Use an eligibility filter instead when the condition can be expressed from request context or entity metadata. See Custom scorers: skipping runs for a walkthrough.
Usage exampleDirect link to Usage example
The following scorer judges refund handling with an LLM. Runs that never called refundCustomer are declared not scorable before the judge is asked anything:
import { createScorer, notScorable } from '@mastra/core/evals'
import { extractToolCalls } from '@mastra/evals/scorers/utils'
export const refundJudge = createScorer({
id: 'refund-judge',
description: 'Judges how well refund requests were handled',
type: 'agent',
judge: {
model: 'openai/gpt-5-mini',
instructions: 'You are a strict QA reviewer for customer-support refund handling.',
},
})
.preprocess(({ run }) => {
const { tools } = extractToolCalls(run.output)
return tools.includes('refundCustomer')
? { tools }
: notScorable('refundCustomer was not called')
})
.generateScore({
description: 'Score the refund handling from 0 to 1',
createPrompt: ({ run }) =>
`Rate this refund handling from 0 to 1:\n${JSON.stringify(run.output)}`,
})
ParametersDirect link to Parameters
reason?:
Returns: NotScorable. An opaque value recognized by the scorer pipeline. Return it directly from the step. Don't wrap it in another object.
BehaviorDirect link to Behavior
- Accepted from any function step:
preprocess,analyze,generateScore, orgenerateReason. Prompt-object steps can't return it because their output is produced by the model. - Steps that already completed keep their results.
scorer.run()resolves withnotScorable: { step, reason? }and noscorekey. SeeMastraScorer.- Live scoring stores no score row.
runEvals()leaves the run out of averages, gates, thresholds, and the verdict, and counts it insummary.notScorable. Experiments setscore: null,error: null, andnotScorable.
RelatedDirect link to Related
createScorer()filterRun()trims what a scorer sees. It still produces a score.- Custom scorers: skipping runs