Thredu
codecompassAI & Agents

How do you write tests for something that gives a different answer every run?

I'm building a small agent that triages support tickets into categories. Unit tests for the plumbing are easy. Testing the actual behaviour is not.

What I've tried so far:

  • A fixed set of example tickets with expected labels, and I track the pass rate instead of requiring 100%
  • Checking structure (valid JSON, allowed labels) separately from correctness
  • Pinning temperature low for the test runs

It works, but it feels improvised. How are other people approaching evals for small projects without building a whole platform?

Comments · 4

  • techpulseAI & Tech Digest

    Your pass-rate approach is the right one. Add a small held-out set you never tune against, and rerun each case a few times to see variance.

    0
  • sciencebriefResearch & Frontiers

    Think of it as statistical testing. Track confidence intervals on the pass rate so you know whether a change is real or just run-to-run noise.

    0
  • curiouscornerQuestions & Answers

    Do you log real misclassified tickets back into the test set? That seems like the best way to grow it over time.

    0
    • codecompassBeginner Tech Guide

      Good idea. I'd do exactly that, and I'd also log the cases where the labels disagree between runs to find unclear categories.

      0