Back to Mise
Week 2 · Evaluation Guide

How We Built Evals for a Restaurant AI Agent

A practical guide to testing AI systems that don't return the same output twice — from logic checks to LLM-as-judge grading, with real numbers from a live pizza store deployment.

"A prompt change dropped our quality score from 2.4 to 1.8. We caught it in five seconds. Without evals, we'd have shipped degraded output and never known why recommendations started feeling off."

The Problem With Shipping AI Without Evals

Every AI system eventually hits the same moment: you change something — a prompt, a model version, a data pipeline — and you have no idea whether the output got better or worse. With a traditional software function, you run your unit tests. With an LLM, the output is different every time, the quality is subjective, and failure is silent.[1]

For Mise, the stakes are concrete. The system generates business recommendations for a real restaurant owner — pricing changes, promotional timing, staffing adjustments. A vague recommendation ("consider running a promotion") wastes the owner's time. A confidently wrong recommendation damages trust. Without a systematic way to measure quality, we'd be shipping blind.

Evals are how you answer "is this working?" for AI systems. Not unit tests — unit tests verify that code does what you wrote. Evals verify that AI outputs meet a quality standard that you define. The difference matters: you can't assert that recommendation.text == expected_text. You can assert that recommendation.confidence is a float between 0 and 1, that the evidence cites at least one number, and that a judge model rates the specificity above 2.0 out of 3.0.

Related reading: [1] Anthropic's evals blog · [2] HELM (Holistic Evaluation of Language Models)

What Is an Eval?

An eval has three components. Understanding each one makes it easier to build all three.

A task is a test case: inputs, context, and a definition of what "correct" looks like. For Mise, a task might be: "Given this fixture data for Tony's Pizza — Tuesday revenue $320 vs. $970 daily average, competitor Sal's running BOGO deals, mozzarella costs up 18% — generate 3–5 recommendations. At least one must address the Tuesday gap. All must cite specific numbers."

A grader is logic that evaluates the output. Graders can be deterministic code (does the confidence field contain a float?), a model-based judge (is this recommendation specific enough to act on?), or human review (would a restaurant operator find this actionable?).[1]

A harness is the infrastructure that runs tasks, applies graders, collects results, and reports pass/fail. Mise's harness is a Python script that runs six evals in ~5 seconds and exits with code 0 (ship it) or 1 (fix it).

The Architecture — Four Levels, One Command

Not all evals are equal. Speed and cost trade off against depth and nuance. The Mise eval system is organized into four levels, each building on the last. At the base: fast, deterministic logic that runs on every commit. At the top: nuanced judgment that requires an LLM call.

04 Ground Truth 20 hand-labeled examples · accuracy ≥80% · ~2s
03 LLM-as-Judge Specificity + Grounding 0–3 · threshold ≥2.0 · ~1.5s each
02 Schema Evals 7 structural checks · LLM output shape · ~2s (one LLM call)
01 Logic Evals Pure business logic · no LLM · no network · <50ms · runs on every commit
← Faster, cheaper, deterministic Slower, more nuanced, subjective →

Running the full suite looks like this:

$ python -m evals.run_evals ✓ vendor_intel (Spike detection logic) OK 3/3 0.0s ✓ scoring (Agent reward ledger) OK 4/4 0.0s ✓ memory (Memory decay & learning) OK 6/6 0.0s ✓ rec_schema (Recommendation schema) OK 7/7 2.1s ✓ customer_intel (Sentiment + segments) OK 7/7 1.8s ✓ rec_quality (LLM-as-judge quality) OK spec=2.3/3 grounding=2.7/3 1.4s 6/6 passed · 5.3s · $0.06

Exit code 0 means ship it. Exit code 1 means fix it. This runs in CI before every deploy.

Level 1 — Logic Evals (No LLM, No Network)

Logic evals test pure business rules. They're deterministic, run in milliseconds, and should pass 100% of the time. If a logic eval fails, something broke in the code — not in the LLM.

Spike Detection (test_vendor_intel)

Mise tracks ingredient cost changes by parsing supplier invoices. The spike detector flags any ingredient whose price has risen more than 15% from the 90-day baseline. The eval verifies three things:

def test_vendor_intel(): # Mozzarella: $3.20/lb baseline → $3.78/lb today (+18%) # Should trigger at 15% threshold assert spike_detected("mozzarella", baseline=3.20, current=3.78) # Flour: $2.10/lb → $2.13/lb (+1.4%) # Should NOT trigger (below threshold) assert not spike_detected("flour", baseline=2.10, current=2.13) # Single invoice: can't calculate a trend # Should NOT trigger (requires ≥2 data points) assert not spike_detected("chicken", invoices=[{"price": 4.50}])

This runs in 50ms and catches regressions immediately if someone refactors the price-averaging logic.

Memory Decay (test_memory)

The learning system applies confidence × 0.97^days decay to old outcome memories. Six checks cover the full lifecycle:

Run time: 40ms. Uses an isolated SQLite temp database. No shared state, no test pollution.

Agent Reward Ledger (test_scoring)

Verifies the arithmetic of agent score updates. Scores start at 100.0. Four checks:

Every logic eval uses an isolated temp database. No shared state between test runs.

Level 2 — Schema Evals (LLM Output Structure)

Once we know the business logic is correct, we verify that the LLM actually produces output we can use. Schema evals don't judge quality — they check shape.

The Mise recommendation schema requires seven fields. The eval feeds the synthesizer a realistic fixture dataset and verifies every recommendation:

REQUIRED_FIELDS = ["problem", "evidence", "action", "expected_impact", "confidence", "risk", "category"] VALID_CATEGORIES = {"pricing", "marketing", "operations", "menu", "staffing", "general"} def validate_recommendation(rec): # 1. All required fields present assert all(f in rec for f in REQUIRED_FIELDS) # 2. Confidence is a float in [0, 1] assert isinstance(rec["confidence"], float) assert 0.0 <= rec["confidence"] <= 1.0 # 3. Category is from the allowed set assert rec["category"] in VALID_CATEGORIES # 4. Evidence contains at least one number (data grounding) assert any(char.isdigit() for char in rec["evidence"]) # 5. Expected impact is quantified (contains "$") assert "$" in rec["expected_impact"] # 6. Action is specific (≥20 chars, not generic filler) assert len(rec["action"]) >= 20

This catches the most common LLM failures: missing fields, wrong types, hallucinated categories, vague non-actionable advice. Run it on every LLM call in CI.

Pro tip

We chain schema eval output directly into the quality eval. One LLM generation, two levels of checking. The recommendations that pass schema validation get fed to the judge — no extra API call needed.

Level 3 — LLM-as-Judge (Quality Grading)

Structural checks catch broken outputs. Quality evals catch outputs that are structurally valid but useless — the recommendation that has all seven fields but says "consider running a promotion sometime."

The judge model is Claude Haiku (claude-haiku-4-5-20251001). It evaluates each recommendation on two axes, each scored 0–3.[3]

Why a cheaper model as judge?

Two reasons: First, grading is a simpler task than generation. Scoring specificity 0–3 requires less reasoning than producing a recommendation in the first place. Second, using a different model than the generator catches failures that wouldn't be self-caught — Haiku and Sonnet make different kinds of mistakes.[1]

Specificity Rubric

Can a restaurant owner execute this recommendation this week without asking follow-up questions?

Score Meaning Example
0 Generic — any restaurant could receive this "Try running a promotion."
1 Somewhat specific but vague on execution "Consider a Tuesday deal."
2 Specific enough to execute this week "Run a BOGO deal on medium pizzas Tue 4–8 PM."
3 Highly specific — names day, price, item, metric "Run a BOGO medium pepperoni deal Tue 4–8 PM for 4 weeks, targeting the $650/day Tuesday gap."

Grounding Rubric

Does the recommendation cite specific data, or is it operating on intuition?

Score Meaning Example
0 No data cited — pure intuition "Tuesdays seem slow."
1 Vague data reference "Sales are lower on Tuesdays."
2 Specific number from one source "Tuesday avg is $320 vs. $970 daily average."
3 Multiple data points from named sources "POS shows $320 Tue avg; Sal's runs BOGO Tue; 31% of locals are 18–34 (high delivery demand)."

Pass threshold: mean ≥ 2.0 on both axes.

The judge receives a narrow system prompt designed to minimize variance:

You are an expert evaluator for a restaurant AI agent. Rate this recommendation on two axes (0–3 each): SPECIFICITY: Can a restaurant owner execute this recommendation this week without asking follow-up questions? 0 = generic advice (any restaurant), 3 = specific day/item/price/metric GROUNDING: Does the recommendation cite specific data? 0 = intuition only, 3 = multiple named data sources with numbers Respond ONLY with valid JSON: {"specificity": N, "grounding": N} Do not explain your reasoning. Do not output anything else.

Narrow rubrics are what make LLM-as-judge reliable. We're not asking the judge to evaluate overall quality — a subjective and failure-prone task. We're asking it to answer two specific, well-defined questions. The narrower the rubric, the more consistent the grades.[1][4]

Level 4 — Ground Truth (Sentiment Accuracy)

For customer sentiment analysis, we have ground truth: 20 hand-labeled reviews where we know the correct classification (positive / neutral / negative). The eval runs all 20 through the full pipeline and checks accuracy.

LABELED_REVIEWS = [ { "platform": "google", "rating": 5, "text": "Best pizza in town — crust is perfectly crispy, toppings fresh.", "label": "positive" }, { "platform": "doordash", "rating": 4, "text": "Food is decent but nothing special. Arrived cold.", "label": "neutral" }, { "platform": "yelp", "rating": 2, "text": "Waited 45 min for delivery, wrong items, nobody answered the phone.", "label": "negative" }, # ... 17 more ]

Accuracy threshold: 80%. Not 95% — because sentiment is genuinely subjective at the margins. A 4-star review saying "good but not great" is defensibly positive or neutral. We also maintain a heuristic keyword fallback for when the LLM fails (API timeout, rate limit).[1]

The Fixture Data — What Good Test Data Looks Like

Most eval failures come from bad fixture data, not bad eval logic. This is the section most engineering writeups skip.

The key principle: fixture data must contain tension. If Tony's Pizza has perfectly average revenue every day of the week, there's no obvious recommendation. If the fixture data is boring, your evals will pass trivially and tell you nothing.

Daily revenue distribution for Tony's Pizza (90-day average from Clover POS). Tuesday's $320 average — 67% below the daily mean of $970 — creates the strongest signal in the dataset. Good fixture data has gaps like this.
$2k $1.5k $1k $500 $0 $480 $320 $580 $650 $1,650 $1,820 $1,200 Mon Tue Wed Thu Fri Sat Sun avg $970

The full fixture structure that produces this kind of tension:

{ "restaurant": "Tony's Pizza", "address": "123 Main St, Austin, TX 78701", "demographics": { "total_population": 45200, "median_household_income": 68400, "age_18_34_pct": 0.31, "nearby_offices": 7, "insights": ["High delivery demand", "Weekday lunch opportunity"] }, "competitors": [ { "name": "Domino's #4471", "distance_miles": 0.4, "google_rating": 3.8, "google_review_count": 412, "ubereats": true, "doordash": true, "active_deals": [] }, { "name": "Sal's Pizzeria", "distance_miles": 1.1, "google_rating": 4.6, "google_review_count": 891, "active_deals": ["BOGO medium pizza every Tuesday"] } ], "pos_data": { "total_revenue_90d": 87300, "avg_daily_revenue": 970, "by_day": { "Mon": 480, "Tue": 320, "Wed": 580, "Thu": 650, "Fri": 1650, "Sat": 1820, "Sun": 1200 } }, "invoices": { "avg_cogs_pct": 34.2, "price_spikes": [ {"item": "mozzarella", "change_pct": 18.0}, {"item": "chicken wings", "change_pct": 22.0} ] } }

This data contains the kind of tension that produces interesting recommendations. Sal's is running BOGO deals on Tuesday — the exact day your revenue is 67% below average. Mozzarella costs are up 18%. Two nearby opportunities, one data point supporting each. A recommendation engine that can't find a signal in this fixture data is broken.

Fixture data is the hardest part of building evals. The logic takes an hour. The harness takes a day. The fixture data — crafting a scenario realistic enough to stress-test quality — takes longer than both combined, and gets better with every real outcome you observe.

What We Don't Eval (Yet) — and Why

Two things are explicitly excluded from the current eval suite, and the exclusions are intentional.

Scraper accuracy

UberEats and DoorDash menus change daily. Any hand-labeled ground truth would be stale within days. Instead, validation is built into the scraper itself: city/state/ZIP matching before extracting, graceful available: false returns if verification fails, JSON extraction with three-level fallback parsing. We validate at the data-collection boundary rather than in a separate eval. The output is either structured and location-verified, or it's nothing.

End-to-end revenue impact

This requires weeks of real-world data — an accept event, a baseline, a post-implementation measurement. That's not CI. That's production monitoring. The auto_measure.py background task handles this: baseline snapshot at accept time, daily POS pulls, alert on >10% revenue drop for 2+ consecutive days. Monitoring is not an eval you run before deploying. It's the layer you instrument after.[1]

Cost Tracking

Design your evals to be cheap enough to run on every commit. If running your eval suite costs $5, it runs once before a major release. If it costs $0.06, it runs on every push.

Model Input (per 1M tokens) Output (per 1M tokens) Role in evals
claude-sonnet-4-6 $3.00 $15.00 Recommendation generation (not eval)
claude-haiku-4-5-20251001 $0.80 $4.00 LLM-as-judge, sentiment eval
gpt-4o $2.50 $10.00 Fallback generator (not eval)
TinyFish (scraping) $0.02 / browser session Not used in evals (production only)

The LLM-as-judge eval uses Haiku capped at 60 output tokens per judgment. A full run of all six evals — including one LLM generation call for schema + quality combined — costs $0.03–$0.08. That's the target. Cheap enough to run constantly.

Here's how we got there: the judge model is Haiku not Sonnet (10x cheaper), output is capped at 60 tokens (JSON only, no reasoning), and the schema eval reuses the same generation from schema validation. One generation, two checks. Never pay twice for the same LLM call.

The Four-Week Roadmap

If you're building this from scratch, here's a practical sequence that avoids the common mistake of starting with LLM-as-judge before you have deterministic coverage.

Week 1: Logic Evals

Week 2: Schema Evals

Week 3: Quality Evals (LLM-as-Judge)

Week 4: Ground Truth

Ongoing

Grader Types — When to Use Each

No single grader type catches everything. Use all four layers.

Grader Type Best for Limitation Mise uses it for
Code-based Deterministic business rules, type checks, value ranges Brittle to valid variations; can't assess nuance Spike detection, schema validation, memory math
Model-based Subjective quality, open-ended outputs, rubric-based scoring Non-deterministic; requires human calibration Specificity and grounding scoring (LLM-as-judge)
Ground truth Tasks with known-correct answers Expensive to label; goes stale in dynamic domains Sentiment classification (20 hand-labeled reviews)
Production monitoring Real-world outcome measurement over time Reactive (users affected first); noisy signals Revenue impact tracking (auto_measure.py)

Use all four. No single layer catches everything.[1]

Lessons Learned

Start with logic evals. They're fast, deterministic, and catch real bugs. If your logic evals aren't passing 100%, your LLM evals are noise. There's no point grading the quality of recommendations if the underlying scoring arithmetic is broken.

Fixture data is the hardest part. Crafting realistic test scenarios that contain genuine tension — the kind of data that should produce a recommendation — took longer than writing the eval harness. Every real outcome you observe makes the fixture data better. It compounds.

LLM-as-judge works, with constraints. Narrow rubrics (0–3 on two specific axes) are consistently reliable. Open-ended quality assessment is not. The narrower the question, the more reliable the judge. If you ask "is this a good recommendation?", you'll get variance. If you ask "does this cite a specific number from a named source?", you'll get consistency.

Set thresholds you can raise. Start at 1.5/3 and raise to 2.0/3 as you improve. A threshold you can never pass tells you nothing; a threshold that's always met tells you nothing. Find the range where improvement is visible. The threshold is a dial, not a finish line.

Cost is a design constraint. $0.06/run gets run on every commit. $5/run doesn't. Cheap evals compound; expensive ones get skipped. Every architectural decision — which model, how many tokens, how many LLM calls — should be evaluated against the cost of running it on every push.

The --fast flag is essential. Logic evals in <1 second for rapid iteration during development. Full suite before deploy. Don't force yourself to choose between speed and thoroughness. Run fast on every save, full suite before shipping.

Evals are a product, not a test file. When our quality score dropped from 2.4 to 1.8 after a prompt change, we caught it in five seconds. It prevented a silent regression that would have shipped degraded recommendations to a real business owner. Treat your eval suite with the same care you'd treat production code — it's how you know production is working.[1][5]

References

[1] Anthropic Engineering. "Demystifying Evals for AI Agents." January 2026. https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents
[2] Liang et al. "Holistic Evaluation of Language Models (HELM)." Stanford Center for Research on Foundation Models. https://crfm.stanford.edu/helm/
[3] Anthropic. "Claude Haiku Pricing." https://www.anthropic.com/pricing
[4] Datagrid. "4 Frameworks to Test Non-Deterministic AI Agent Behavior." https://datagrid.com/blog/4-frameworks-test-non-deterministic-ai-agents
[5] AWS Machine Learning Blog. "Evaluating AI Agents for Production: A Practical Guide to Strands Evals." https://aws.amazon.com/blogs/machine-learning/evaluating-ai-agents-for-production-a-practical-guide-to-strands-evals/