
Suppose a model recommends which support tickets need immediate attention. A demo might show it correctly flagging “Production checkout is down.” That tells you it handled one ticket. It does not tell you whether it flags every invoice request as an emergency, or whether a change to the prompt made triage worse.

Support-ticket classification is a common eval example. [Promptfoo's OpenAI example](https://www.promptfoo.dev/docs/providers/openai/) labels billing and technical tickets and checks the model's answer against those labels. Vary's [support-triage example](/articles/jev-ai-with-vary/) uses the same idea for priority: give the workflow a ticket, state the expected recommendation, and score the result.

## The behavior under test

The application returns a typed report. Its priority is `Immediate`, `Normal`, or `HumanReview`; it also recommends a team. The eval below asks only whether the priority is right. Team routing deserves its own cases and scorer, rather than being hidden in a single “good response” judgment.

The runnable example lives at `examples/ai-triage/src/evals.vary` in the Vary repository. Here is its core:

```vary-snippet
from domain import Priority
from scoring import priority_matches
from workflow import triage_issue
from ai.evals import EvalCase

let triage_cases: List[EvalCase[Str, Priority]] = [
    EvalCase("outage", "Production checkout is down", Priority.Immediate),
    EvalCase("invoice", "Please resend my invoice", Priority.Normal)
]

eval "support triage priority" {
    cases triage_cases
    run triage_issue
    score priority_matches
    require {
        pass_rate >= 50%
        error_rate == 0%
    }
}
```

Each case has a stable ID, an input, and an expected value. `run` calls the existing application workflow, so the eval measures the same path the app uses. `score` names a pure function:

```vary-snippet
from domain import TriageReport

pure def priority_matches(actual: TriageReport, expected: Priority) -> Bool {
    return actual.priority == expected
}
```

The scorer is deliberately plain. A matching priority passes; a different one fails. The project also [tests the scorer](/docs/test-dsl/) with a report it should accept and one it should reject. That test protects the measuring instrument before a model enters the picture.

## What the gate means

The checked-in example uses a 50% pass-rate gate to demonstrate how the runner records passing and failing cases. That is too permissive for an actual two-ticket release gate: one wrong recommendation could still pass. If both examples are requirements, change the gate to `pass_rate == 100%`, then add enough cases to cover the decisions you care about. Keep `error_rate == 0%` so provider or workflow errors cannot be mistaken for acceptable answers.

Start with cases that could catch a plausible mistake: an outage, a routine invoice request, an ambiguous message that should go to a person, and wording that mentions urgency without describing an actual outage. Review the labels with the people who own support policy. An eval can faithfully measure the wrong rule if its expected answers are wrong.

## Run it without a provider account

The example has a checked-in response fixture. From the repository root:

```bash
vary test examples/ai-triage
vary eval examples/ai-triage --fixture --json
```

`vary test` checks deterministic behavior, including the scorer. `vary eval` runs the cases through the managed AI context and writes the trial and gate results. The fixture pins the provider responses, so this run checks that the workflow and eval harness are connected correctly. It says nothing about a live model's accuracy.

To measure a model, configure a named live profile with its adapter, endpoint, model, and credential environment variable, then run a bounded eval:

```bash
vary eval examples/ai-triage --profile production --live \
  --max-attempts 20 --deadline-ms 30000 --report-file triage-eval.json
```

The live profile must be configured first; the command will not silently fall back to the fixture. Attempt and time limits cover the whole run. Keep the report with the model and prompt change it evaluated, and compare the failed case IDs before changing a gate. The [native eval guide](/docs/ai-evals/) covers profiles, repeated runs, report fields, and exit codes.

An eval is useful when a failure can change what you ship. A pair of labeled tickets is enough to show the mechanics. A decision about production triage needs a larger, reviewed set of cases and a gate that matches the cost of getting them wrong.
