● Live Retail SaaS LLM-as-Judge

RAG Quality
Eval Agent

An automated evaluation pipeline that tests Agent 02's RAG system against 20 benchmark questions. Claude acts as an impartial judge — scoring each response on Accuracy, Completeness, and Grounding — producing a pass-rate report that mirrors how production AI teams measure model quality.

01 — Problem & Objective

Why AI systems need automated evaluation

Agent 02 can retrieve products and generate answers — but how do you know if the answers are actually good? Without a systematic evaluation framework, quality is subjective and regressions go undetected. When a prompt changes, a model updates, or the catalogue grows, you need to know immediately whether the system got better or worse.

The objective was to build an automated eval pipeline that runs on demand, scores responses against known-correct answers, and produces a structured report — the same way engineering teams run test suites before shipping code.

The Problem

Without evals, AI quality is anecdotal. One good demo does not mean the system works reliably across all question types, edge cases, and failure modes.

The Objective

An automated LLM-as-Judge pipeline that scores Agent 02's RAG responses on three dimensions and produces a quantified pass-rate report.

02 — n8n Workflow Implementation

The same pipeline, built in n8n

The eval pipeline is orchestrated in n8n — a webhook triggers a loop over all 20 benchmark questions. For each question, the workflow embeds the query via OpenAI, retrieves the top-3 matching products from Pinecone, generates Agent 02's answer using Claude, then passes the question, retrieved context, and answer to a second Claude instance acting as judge. Scores are aggregated across all questions and returned as a structured pass-rate report.

Agent 03 n8n workflow diagram
03 — How LLM-as-Judge Works

Claude evaluating Claude

Traditional rule-based evaluation checks for keyword matches — brittle, unable to handle paraphrasing, and blind to reasoning quality. LLM-as-Judge uses a second model instance as an impartial evaluator, assessing responses the way a human expert would.

1
Agent 02 answers the question

The full RAG pipeline runs — embed query → retrieve from Pinecone → generate with Claude. The agent produces a natural language answer grounded in retrieved products.

2
Judge receives question + expected + actual

A second Claude instance receives the original question, the ground-truth expected answer, and Agent 02's actual response. It judges purely on answer quality.

3
Judge scores on three dimensions

Each response is scored 1–5 on Accuracy, Completeness, and Grounding. The judge returns structured JSON with scores and one-sentence reasoning.

4
Dashboard aggregates the report

Pass/Partial/Fail verdicts are tallied. Average scores per dimension are charted. Results can be filtered by category and exported as JSON.

04 — Scoring Framework

How each response is scored

Every response is evaluated on three independent dimensions. A response can be factually accurate but incomplete, or complete but contain hallucinated details — each dimension captures a different failure mode.

ScoreAccuracyCompletenessGrounding
5All facts correct — prices, SKUs, materials exactFully addresses question with all key detailsEntirely from retrieved products, nothing invented
4Minor inaccuracies that do not misleadMain point covered, minor details missingMostly grounded, trivial additions
3Mix of correct and incorrect factsPartially addresses the questionMix of grounded and invented content
2Mostly incorrect factsSignificant gaps in the answerSignificant hallucinations present
1Completely wrong or hallucinatedDoes not address the questionMostly or entirely hallucinated

Verdict thresholds: PASS = average ≥ 4.0  ·  PARTIAL = average ≥ 2.5  ·  FAIL = average < 2.5

05 — Eval Dataset Design

20 questions across 6 failure modes

The eval dataset is designed to stress-test different aspects of the RAG pipeline — not just easy lookups. Each category targets a specific failure mode that production systems commonly encounter.

Dataset Breakdown
Specific Lookup    (7)  -- price, SKU, materials, stock, colours
Category Browsing  (4)  -- "what bedding for hot sleepers?"
Cross-Category     (3)  -- "what sustainable products do you sell?"
Care & Maintenance (3)  -- "how do I care for the berber rug?"
Edge Cases         (2)  -- products not in catalogue (tests honest refusal)
Comparison         (2)  -- "difference between jute and sheepskin rug?"

Difficulty: Easy (9) · Medium (5) · Hard (4) · Edge (2)
06 — Concepts Demonstrated

What this agent teaches

⚖️
LLM-as-Judge

Using a second model instance to evaluate responses — the same pattern used by Anthropic, OpenAI, and enterprise AI teams to automate quality measurement.

📐
Eval Dataset Design

20 questions across 6 categories and 4 difficulty levels — intentionally targeting different failure modes rather than just easy happy-path queries.

🔢
Multi-Dimensional Scoring

Accuracy, Completeness, and Grounding scored independently — because a response can fail on one dimension while passing others.

📊
Pass-Rate Reporting

Aggregated pass/partial/fail metrics by category and difficulty — the kind of report a PM shares with engineering to prioritise improvements.

🔍
Failure Analysis

Each result shows the agent's answer, the expected answer, scores per dimension, and the judge's reasoning — making failures actionable, not just countable.

📤
Exportable Reports

Results export as timestamped JSON — shareable with engineering teams, trackable over time, and importable into dashboards or notebooks.

07 — Lessons Learned

What I would do differently

1

Edge cases reveal the most important failure modes. The two “products not in catalogue” questions are the most revealing — they test whether the agent honestly says “I don't have that” or hallucinates a product. In production, honest refusal is far better than a confident wrong answer.

2

The judge prompt is a product decision, not a technical one. How you define the scoring rubric — what counts as a 4 vs a 5 on Accuracy — directly shapes what the system optimises for. This is a PM decision that should be made with the business, not left to engineers.

3

Evals should run automatically on every change. Running evals manually is useful for demos — but production value comes from running them in CI/CD. Every prompt change, model update, or catalogue expansion should trigger an automatic eval run with regression alerting.

4

Track scores over time, not just point-in-time. A single eval run tells you current quality. A trend over 10 runs tells you whether the system is improving or degrading. Time-series eval tracking is what separates mature AI teams from teams that just run demos.

5

Human-in-the-loop review on borderline cases is essential. PARTIAL verdicts are where the most learning happens — a human expert can identify exactly what the model got right and wrong, and use that to improve the prompt or retrieval strategy.