Table of Contents

Class AgentEvaluator

Namespace
LMKit.Agents.Evaluation
Assembly
LM-Kit.NET.dll

Runs evaluation suites and scores what they observed. The checks are mechanical (what the answer says, which tools ran, whether the answer cites or abstains, whether a structured answer carries its properties), so the same transcript always scores the same way. Every case runs with zero real side effects: the in-process runner answers every tool that writes with a SimulatedTool.

public static class AgentEvaluator
Inheritance
AgentEvaluator
Inherited Members

Examples

var suite = AgentEvaluationSuite.FromJson(File.ReadAllText("support.suite.json"));
var report = await AgentEvaluator.RunAsync(suite, () =>
{
    var chat = new MultiTurnConversation(model) { SystemPrompt = "You answer support questions." };
    chat.Tools.Register(new OrderLookupTool());
    return chat;
});
foreach (var failed in report.Results.Where(r => !r.Passed))
    Console.WriteLine($"{failed.CaseId}: {string.Join("; ", failed.Failures)}");

Methods

RunAsync(AgentEvaluationSuite, Func<Agent>, AgentExecutionOptions, CancellationToken)

Runs a suite in process against an agent: each case gets a fresh agent from createAgent (an agent built from an AgentDefinition plays exactly as the definition says: its prompt, tools, knowledge and output schema) and every tool that writes is answered by its simulation.

RunAsync(AgentEvaluationSuite, Func<AgentEvaluationCase, CancellationToken, Task<AgentEvaluationTranscript>>, CancellationToken)

Runs a suite through any player: play plays one case (on a server over HTTP, in process, anywhere) and returns what it observed; the cases run one after the other and are scored the same way whoever played them.

RunAsync(AgentEvaluationSuite, Func<MultiTurnConversation>, CancellationToken)

Runs a suite in process: each case gets a fresh conversation from createConversation, its tools that write are replaced by simulations (Guard(ITool)), its turns are submitted in order, and every tool call and the final knowledge verdict are recorded.

Score(AgentEvaluationCase, AgentEvaluationTranscript)

Scores one case against what its run observed.

Share