---
title: "Classifier Evaluations"
description: "Learn how Sentry traces Mastra Classifier evaluations, such as calls to TypeSafe's Jev, as gen_ai.evaluate spans."
url: https://docs.sentry.io/platforms/javascript/guides/mastra/agent-tracing/classifier-evaluations/
---

# Mastra Classifier Evaluations

Available since: `v11.6.0`

Mastra's [`Classifier`](https://mastra.ai/reference/classifier/classifier) asks a decision model, such as TypeSafe's Jev, typed questions about your application state. These calls don't go through the Vercel AI SDK, so the Mastra integration traces them for you. This includes classifiers that your processors and scorers call. If you've followed the [Mastra Quick Start](https://docs.sentry.io/platforms/javascript/guides/mastra.md), no additional integration or setup is needed.

```javascript
import { Classifier } from "@mastra/core/classifier";
import { typeSafeAi } from "@ai-sdk/typesafe-ai";

const classifier = new Classifier({
  id: "ticket-classifier",
  model: typeSafeAi.evaluationModel("jev-latest"),
  questions: {
    department: {
      type: "choice",
      instructions: "Which team should handle this?",
      criteria: {
        billing: "Charges and refunds",
        technical: "Bugs and outages",
      },
    },
  },
});

const result = await classifier.evaluate({
  state: {
    message: "I was charged twice. Please refund the extra charge.",
  },
});

console.log(result.answers.department.choice);
```

## [What Gets Captured](https://docs.sentry.io/platforms/javascript/guides/mastra/agent-tracing/classifier-evaluations.md#what-gets-captured)

Each `evaluate()` call creates a `gen_ai.evaluate` span named `evaluate <model>`, with the model, provider, latency, and token usage. If the evaluation fails, the span is marked as failed. When recording is enabled, Sentry captures `state` and `questions` as input messages and `answers` as output messages, including probabilities returned by the model.

## [Control Recorded Data](https://docs.sentry.io/platforms/javascript/guides/mastra/agent-tracing/classifier-evaluations.md#control-recorded-data)

Sentry runs this data through your Mastra span output processors before recording it, so Mastra's default `SensitiveDataFilter` redacts sensitive keys such as `apiKey`. Evaluation state and answers can still contain sensitive data. To stop recording them, set `genAI: { inputs: false, outputs: false }` in the [`dataCollection` option](https://docs.sentry.io/platforms/javascript/guides/mastra/configuration/options.md#dataCollection).

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/mastra/agent-tracing/classifier-evaluations.md#supported-versions)

* `@sentry/node`: `>=11.6.0`
* `@mastra/core`: `>=1.69.0`

## [Related Integrations](https://docs.sentry.io/platforms/javascript/guides/mastra/agent-tracing/classifier-evaluations.md#related-integrations)

If you call Jev through `TypeSafeClient.systemOne()` or Vercel AI SDK's `experimental_evaluate()` instead, see the [TypeSafe](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/typesafe.md) or [Vercel AI](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/vercelai.md#trace-jev-evaluations) integration.
