Mastra adds classifiers for fast, predictable decisions with evaluation models

Mastra has introduced classifiers, a feature that lets developers use evaluation models to answer structured questions and make fast, predictable decisions in their code. According to Mastra, the feature shipped after the "dramatic rise of Jev" a couple of weeks before the announcement.
- Mastra added classifiers that use evaluation models to answer choice, score or boolean questions.
- Each answer includes a probability per option, so code can decide what happens next.
- One classifier can hold several questions of mixed types, and criteria accept any JSON-compatible value.
- The feature requires @mastra/[email protected] or later.
- Mastra's example routes marketing requests to one of three agents using the jev-latest model.
How classifiers work
With a classifier, a developer provides instructions that describe what to decide, plus criteria that outline what can be answered. Mastra supports three question types: choice, score and boolean.
- A choice returns one of the criteria keys.
- A score returns a position from an ordered list.
- A boolean returns the probability that the answer is true.
A single classifier can hold several questions of mixed types, all evaluated against the same input. Each answer is keyed by the question name the developer chose. Both instructions and criteria accept any JSON-compatible value, so a criteria description can be an object or an array rather than only a string.
Mastra also ran a workshop on the topic, titled Building a Classifier in Mastra with Jev.
What changes compared with prompting an LLM
Mastra describes the previous approach as laborious. Picking from a fixed set of options meant prompting an LLM, describing the options, defining the output shape, and then parsing and validating whatever came back.
With a classifier, the options are the criteria. The answer shows why the decision was made by including a probability for each option, so application code can decide what happens next. For a choice question, each criteria key gets a probability and the highest one becomes the choice.
Getting started and the routing example
Mastra says the feature requires @mastra/[email protected] or later, added in PR #24458. Developers install @mastra/core and the @ai-sdk/typesafe-ai evaluation model provider with npm.
A classifier is defined with an id, a model and one or more questions. In Mastra's example, a classifier named marketing-classifier uses the jev-latest evaluation model and a question called route of type choice. The criteria map three keys to descriptions: pmmLaunchAgent for what has and hasn't launched, releaseNotesAgent for writing release notes, and newsletterAgent for drafting the weekly newsletter.
Classifiers are registered on the main Mastra instance, in the same way as agents, tools and workflows. In the example output, the pmmLaunchAgent key receives a probability of 1 while the other two receive 0, so it becomes the choice.
A workflow can then use that result. In Mastra's sample, a marketing router workflow calls the classifier, maps the chosen key together with the user's message, and branches to the matching agent step: the PMM launch agent, the release notes agent or the newsletter agent.
What it means for developers
For teams building agent systems on Mastra, classifiers offer a built-in way to route requests or gate steps without hand-written output parsing and validation. Because every option comes with a probability, the code can act on the result directly. Mastra points to its Classifier, Workflow.classifier, ClassifierProcessor and createClassifierScorer references for full configuration options.
Mastra: Introducing Classifiers with Jev | Mastra Blog


