Agent Framework LLM-as-a-judge evals in C# with Claude A developer demonstrated how to add LLM-as-a-judge evaluations to C# agents built with Microsoft Agent Framework 1.24, using the EvaluateAsync extension and Microsoft.Extensions.AI.Evaluation quality evaluators with Claude Haiku 5.5 as the judge. The kitchen-assistant sample scores answers 1 to 5 on qualities like whether a dinner is suggested and whether it fits the pantry, and the judge itself is validated against hand-written answers before its scores are trusted. The writeup stresses reading judge scores as comparisons between runs rather than verdicts. The idea: some qualities of an answer only show when someone reads it, so a second model reads it and gives a score. That score is a model's output too. Test the judge on answers you wrote, give it what it needs to know, and read its scores as a comparison between runs, not as a verdict. The tests and pass rates post https://kootstra.io/writing/agent-framework-testing-agents-csharp/ checks what the agent did: which tools it called and what ended up on the shopping list. Ask the kitchen assistant "What can I cook tonight?" and the questions that matter are different. Does the answer suggest a dinner, or only recite the pantry? Can the household cook it with what it has, or does it need salmon nobody bought? A string match can't answer either. An eval with a judge can: a second model reads the question and the answer and scores them from 1 to 5. Agent Framework 1.24 has an EvaluateAsync extension on every agent that runs it against a list of questions and hands the answers to an evaluator, either checks in code or the quality evaluators of Microsoft.Extensions.AI.Evaluation . Below, the kitchen assistant gets both, with Claude Haiku 5.5 as the judge, and the judge is tested on answers written by hand before its scores on the agent count for anything. Versions: Microsoft Agent Framework 1.24.0, Microsoft.Extensions.AI.Evaluation.Quality and Microsoft.Extensions.AI.Evaluation.Reporting 10.10.0, .NET 10. Code: samples/agent-framework/16-evals https://github.com/nkootstra/samples/tree/main/agent-framework/16-evals , a runnable version of this post with its tests. Who this is for: C developers who have given an agent tools, as in Agent Framework tool calling in C with Claude https://kootstra.io/writing/tool-calling-ai-agents-csharp/ , and tested it with pass rates, as in Agent Framework tests and pass rates in C with Claude https://kootstra.io/writing/agent-framework-testing-agents-csharp/ . Note The code runs on Claude Haiku 5.5, but it depends only on IChatClient : the first post https://kootstra.io/writing/microsoft-agent-framework-first-csharp-agent/ swap-the-provider-by-changing-one-statement shows the swap to OpenAI or Ollama. The judge's chat client removes two options that Claude Haiku 5.5 rejects; another judge model may accept them, or reject others. The costs use Haiku's list prices. The output limit of 4,096 tokens is sized for Haiku, which counts its reasoning as output. Inference Engineering by Philip Kiely separates the two. A public benchmark such as MMLU or SWE-bench measures a model on shared tasks. It helps to shortlist models, but the book warns that they are saturated or even gamed, since every lab wants a record score for its next release. An eval is built for one product, aimed at the hardest problems the model has to solve there, because, in the book's words, "there is no substitute for directly measuring how a model performs for your application." The book also says how to read a result, when it checks a quantized model against the original: compare against a baseline, and treat a difference no larger than the noise between two runs as no difference. Its first tip for eval work is to look at your data and check results against your own sense of the problem p. 32 . For this kitchen the eval set is three questions a household asks, and the hardest problem is staying inside the pantry. A console app with the agent packages and two evaluation packages. Version 10.10.0 is the one Microsoft.Agents.AI 1.24.0 itself depends on: dotnet new console -n KitchenEvals cd KitchenEvals dotnet add package Microsoft.Agents.AI --version 1.24.0 dotnet add package Microsoft.Agents.AI.Anthropic --version 1.24.0 dotnet add package Microsoft.Extensions.AI.Evaluation.Quality --version 10.10.0 dotnet add package Microsoft.Extensions.AI.Evaluation.Reporting --version 10.10.0 The pantry is a constant and a tool that returns it: Pantry.cs js using System.ComponentModel; static class Pantry { public const string Contents = "rice 1 kg, eggs 6, onions 3, spinach 200 g, feta 150 g, " + "canned tomatoes 2 tins"; Description "Lists everything in the household's pantry." public static string ListPantry = Contents; } KitchenAgent.cs using Microsoft.Agents.AI; using Microsoft.Extensions.AI; static class KitchenAgent { public static AIAgent Create IChatClient chatClient = chatClient.AsAIAgent name: "kitchen-assistant", instructions: """ You suggest dinners for one household. Check the pantry with list pantry before you answer. Suggest one dish that uses what is in the pantry, and name anything the household would have to buy. Answer in at most three sentences. """, tools: AIFunctionFactory.Create Pantry.ListPantry, name: "list pantry" , ; } Program.cs creates one chat client for Claude and puts a TokenCounter in front of it twice, one for the agent and one for the judge. TokenCounter is a DelegatingChatClient from the sample that adds up the Usage of every response that reaches Claude: Program.cs IChatClient claude = new AnthropicClient new ClientOptions { ApiKey = apiKey } .AsIChatClient "claude-haiku-5-5", 4096 ; var agentTokens = new TokenCounter claude ; var judgeTokens = new TokenCounter claude ; AIAgent agent = KitchenAgent.Create agentTokens ; ChatConfiguration judge = Judge.Create judgeTokens ; string questions = "What can I cook tonight?", "I have 20 minutes. What's a quick vegetarian dinner?", "Can I make lasagne tonight?", ; The pass rates post https://kootstra.io/writing/agent-framework-testing-agents-csharp/ built this by hand: a runner that runs each scenario several times and counts the passes. Agent Framework 1.24 has it built in, so this post uses the built-in types. Agent Framework's evaluation types live in Microsoft.Agents.AI itself. A LocalEvaluator runs checks in code, and each check returns pass or fail. EvalChecks has ready-made ones, and FunctionEvaluator.Create turns a function into a check: Checks.cs using Microsoft.Agents.AI; static class Checks { static readonly string InThePantry = "rice", "egg", "onion", "spinach", "feta", "tomato" ; public static LocalEvaluator Create = new EvalChecks.ToolCalledCheck "list pantry" , FunctionEvaluator.Create "names a pantry item", NamesAPantryItem ; static bool NamesAPantryItem string answer = InThePantry.Any item = answer.Contains item, StringComparison.OrdinalIgnoreCase ; } AgentEvaluationResults checks = await agent.EvaluateAsync questions, Checks.Create , numRepetitions: 3 ; Console.WriteLine $"Checks in code: {checks.Passed}/{checks.Total} passed" ; EvaluateAsync runs the agent once per question and repetition, each time in a new conversation, wraps every answer in an EvalItem with the question, the answer's text and the whole conversation, and hands the nine items to the evaluator in one batch. The pantry tool only reads, so one agent can serve every run; the pass rates post https://kootstra.io/writing/agent-framework-testing-agents-csharp/ needed a new kitchen per run because its tool wrote to a list. Checks in code: 9/9 passed Nine passes say that the agent looked in the pantry and mentioned something from it. "Make salmon teriyaki and serve it with rice" passes the second check too, and one of the sample's tests proves it. Whether the dinner fits the pantry is a question about meaning, and that is the judge's job. The quality evaluators in Microsoft.Extensions.AI.Evaluation.Quality each send the judge model a prompt with the question and the answer, and turn its reply into a score from 1 to 5 with a reason. RelevanceEvaluator asks whether the answer addresses the question. GroundednessEvaluator asks whether the answer is supported by a context you supply. There are more, such as coherence, completeness and fluency; TaskAdherenceEvaluator , IntentResolutionEvaluator and ToolCallAccuracyEvaluator are marked experimental AIEVAL001 . A third family, the safety evaluators in Microsoft.Extensions.AI.Evaluation.Safety , doesn't use the judge at all: they call the Azure AI Foundry Evaluation service, so they need a Foundry project, not an Anthropic key. The judge is a ChatConfiguration around an IChatClient . The package documentation says the prompts were tuned against GPT-4o, and Claude Haiku is not on that list. new ChatConfiguration claude fails on every evaluation. The evaluators set Temperature and TopP on their requests, and Claude Haiku 5.5 refuses the first with " temperature is deprecated for this model." and, once that is gone, the second with " top p is deprecated for this model." This isn't one model's quirk. Anthropic's migration guide for Claude Haiku 5.5 https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide says to omit temperature , top p and top k and to steer the model with the prompt instead, and OpenAI's guide to its latest models https://developers.openai.com/api/docs/guides/latest-model says to remove temperature and top p whenever reasoning is on. An eval can't count on a temperature of 0 to make the judge repeat itself; the variance below is what remains, and the cache further down is what makes a run repeatable. The judge's client removes both settings before the request leaves: Judge.cs // The quality evaluators send temperature and top p with every // request, and Claude Haiku 5.5 rejects both. public static ChatConfiguration Create IChatClient chatClient = new chatClient .AsBuilder .ConfigureOptions options = { options.Temperature = null; options.TopP = null; } .Build ; A first try with those errors, one question scored by a CompositeEvaluator the type that runs several evaluators on one answer , still printed "CompositeEvaluator passed 1/1": one evaluated answer out of one counted as passed, although every metric on it had errored. AgentEvaluationResults counts an item as failed only when a metric's interpretation says it failed or a boolean metric is false . A metric the judge never scored has neither: it holds an error diagnostic and no value. So an eval whose judge is down reports a perfect run. Judge.FailWhenErrored gives such a metric a failing interpretation: // A metric the judge couldn't score has no verdict, and // AgentEvaluationResults counts a metric without one as passed. public static EvaluationMetricInterpretation? FailWhenErrored EvaluationMetric metric = metric.ContainsDiagnostics d = d.Severity == EvaluationDiagnosticSeverity.Error ? new EvaluationRating.Inconclusive, failed: true, reason: "The judge returned no score." : null; Returning null leaves the metric's own interpretation alone. Every result below goes through it. Before the judge grades the agent, it grades three answers whose quality is known: one cooked from the pantry, one that needs salmon and noodles, and one that only lists the pantry. Each is judged three times; written , an array in the sample's Program.cs , holds the three names and answers. These answers never change, so their verdicts can be cached, which is what Microsoft.Extensions.AI.Evaluation.Reporting does: ReportingConfiguration reporting = DiskBasedReportingConfiguration.Create storageRootPath: Path.Combine Path.GetTempPath , "kitchen-evals" , evaluators: new RelevanceEvaluator , new GroundednessEvaluator , chatConfiguration: judge, enableResponseCaching: true, evaluationMetricInterpreter: Judge.FailWhenErrored ; // ... written, the console header and a stopwatch foreach var name, answer in written { List