HPD-Agent.Evaluations 0.9.5

dotnet add package HPD-Agent.Evaluations --version 0.9.5
                    
NuGet\Install-Package HPD-Agent.Evaluations -Version 0.9.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HPD-Agent.Evaluations" Version="0.9.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HPD-Agent.Evaluations" Version="0.9.5" />
                    
Directory.Packages.props
<PackageReference Include="HPD-Agent.Evaluations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HPD-Agent.Evaluations --version 0.9.5
                    
#r "nuget: HPD-Agent.Evaluations, 0.9.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HPD-Agent.Evaluations@0.9.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HPD-Agent.Evaluations&version=0.9.5
                    
Install as a Cake Addin
#tool nuget:?package=HPD-Agent.Evaluations&version=0.9.5
                    
Install as a Cake Tool

HPD-Agent.Evaluations

Evaluate HPD Agent turns and responses with deterministic assertions, datasets, LLM judges, safety checks, red-team cases, human annotation, and saved score history.

The package targets net8.0, net9.0, and net10.0.

Install

dotnet add package HPD-Agent.Evaluations

Evaluate One Turn

using HPD.Agent.Evaluations;
using HPD.Agent.Evaluations.Integration;

var report = await agent.CheckAsync(
    "Return a JSON object with a title and summary.",
    Eval.Contains("\"title\""),
    Eval.Contains("\"summary\""));

report.Print();
report.ThrowIfPolicyViolations();

Deterministic evaluators default to EvalPolicy.MustAlwaysPass. Call ThrowIfPolicyViolations() when the report is a CI or release gate.

Run a Batch

using HPD.Agent.Evaluations.Batch;

var report = await agent.EvaluateAsync(
    [
        ("Summarize the incident.", "Short incident summary"),
        ("List the mitigating controls.", "Controls list"),
    ],
    [new HPD.Agent.Evaluations.Evaluators.LlmJudge.AnswerSimilarityEvaluator()],
    experimentName: "nightly-support");

report.Print();
await report.WriteHtmlAsync("artifacts/evaluations.html");

Use RunEvals.ExecuteAsync when cases need their own metadata, evaluators, ground truth, version, or validity window.

var dataset = new Dataset<string>
{
    DatasetId = "support-bench",
    Version = "2026.11",
    Cases =
    [
        new EvalCase<string>
        {
            CaseId = "refund-policy",
            Input = "Can I refund an annual plan?",
            GroundTruth = "Follow the annual-plan refund policy.",
            Evaluators = [Eval.Contains("annual")],
        },
    ],
};

var report = await RunEvals.ExecuteAsync(
    agent,
    dataset,
    [new HPD.Agent.Evaluations.Evaluators.LlmJudge.AnswerSimilarityEvaluator()],
    new RunEvalsOptions<string>
    {
        Concurrency = 2,
        EvaluatorConcurrency = 2,
        Repeat = 1,
    },
    experimentName: "refund-regression");

Structured Dataset Inputs

The agent receives one user message. A non-string dataset input therefore needs an explicit formatter. HPD does not silently send ToString() output.

var dataset = new Dataset<SearchRequest>
{
    Cases =
    [
        new EvalCase<SearchRequest>
        {
            Input = new SearchRequest("refund policy", 5),
        },
    ],
};

var report = await RunEvals.ExecuteAsync(
    agent,
    dataset,
    [Eval.Contains("refund")],
    new RunEvalsOptions<SearchRequest>
    {
        InputFormatter = input =>
            $"Search for '{input.Query}' and return {input.MaxResults} results.",
    });

When reading YAML or writing JSON/YAML in a Native AOT application, also supply the parse/serialize delegates used by Dataset<T>.FromFile and ToFile.

Live Evaluation

Live evaluation runs after a completed message turn without delaying the user response. Set samplingRate to control judge cost.

using HPD.Agent.Evaluations.Integration;
using HPD.Agent.Evaluations.Storage;

var scores = new InMemoryScoreStore();

await using var agent = await new AgentBuilder(config)
    .AddEvaluator(Eval.Contains("refund"))
    .AddEvaluator(
        new HPD.Agent.Evaluations.Evaluators.LlmJudge.TaskSuccessEvaluator(),
        samplingRate: 0.1,
        policy: EvalPolicy.TrackTrend)
    .UseEvaluationJudgeConfig(new EvaluationJudgeRunConfig
    {
        Timeout = TimeSpan.FromSeconds(45),
    })
    .UseScoreStore(scores)
    .BuildAsync();

AddEvaluator defaults deterministic evaluators to MustAlwaysPass and model-judged or custom evaluators to TrackTrend. A per-evaluator judge config takes precedence over UseEvaluationJudgeConfig.

Without UseScoreStore, scores are still published as EvalScoreEvent. Subscribe to EvalScoreEvent, EvalFailedEvent, EvalPersistenceFailedEvent, and EvalPolicyViolationEvent for live monitoring.

Storage

InMemoryScoreStore and InMemoryDatasetStore are for development and tests. They lose all data when the process exits.

For durable production storage, use HPD-Agent.Evaluations.HpdBase on net10.0, or implement IScoreStore, IDatasetStore, or both. The analytics endpoints use these interfaces and return 503 when the required store is not registered.

Evaluators

Eval exposes common deterministic assertions:

Eval.Contains("text");
Eval.ContainsAny("one", "two");
Eval.ContainsAll("one", "two");
Eval.ContainsIgnoringCase("text");
Eval.OutputEquals("exact output");
Eval.MatchesRegex("^ok$");
Eval.StartsWith("prefix");
Eval.WordCount(min: 10, max: 200);
Eval.ToolCalled("search");
Eval.ToolCallCount("search", 1);
Eval.ToolArgumentMatches("search", "query", "refund");
Eval.ToolResultContains("search", "policy");
Eval.NoToolsCalled();
Eval.ToolCallOrder("authenticate", "search");
Eval.ToolCallF1("search", "summarize");
Eval.JsonValidity();
Eval.SchemaConformance("""{"type":"object"}""");
Eval.MaxDuration(30);
Eval.HasMatchingSpan(new SpanQuery { NameEquals = "search" });
Eval.Bleu("reference response");

Deterministic and NLP implementations are factory-backed and intentionally internal. Model-judged, safety, and composite evaluators remain public under Evaluators.LlmJudge, Evaluators.Safety, and Evaluators.Composite because their constructors carry policy and rubric configuration. Implement IEvaluator directly or derive from HpdEvaluatorBase for custom behavior.

EvaluatorCatalog.All provides stable IDs, categories, metric names, default policy, judge requirements, and required evaluation contexts for every built-in evaluator.

Red Team

using HPD.Agent.Evaluations.RedTeam;

var options = new RedTeamRunOptions
{
    Plugins =
    [
        RedTeamPlugins.Create("prompt-injection"),
        RedTeamPlugins.Create("secret-leak"),
    ],
    Strategies =
    [
        RedTeamStrategies.Create("basic"),
        RedTeamStrategies.BestOfN(variantCount: 4),
    ],
    GlobalEvaluators =
    [
        new HPD.Agent.Evaluations.Evaluators.Safety.PromptInjectionEvaluator(),
    ],
};

var report = await RedTeamRunner.ExecuteAsync(agent, options);

Built-in plugin and strategy implementations are internal. Use RedTeamPlugins.Catalog, RedTeamStrategies.Catalog, the factories, JSON/YAML configuration, or implement IRedTeamPlugin and IRedTeamStrategy directly.

Datasets

Dataset files support:

dataset_id: support-bench
version: "2026.11"
cases:
  - case_id: refund-policy
    name: annual refund
    input: Can I refund an annual plan?
    ground_truth: Follow the annual-plan refund policy.
    metadata:
      difficulty: easy
    evaluators:
      - OutputContains: annual

Evaluator definitions are intentionally limited to names that can be represented without arbitrary reflection. Use code-based evaluators when a dataset needs a custom evaluator.

CI Suggestions

var report = await RunEvals.ExecuteAsync(
    agent,
    dataset,
    evaluators,
    new RunEvalsOptions<string> { Concurrency = 4 },
    experimentName: "pull-request");

report.Print();
report.ThrowIfPolicyViolations();

if (report.Failures.Any(f => f.Kind == FailureKind.TaskFailure))
    throw new InvalidOperationException(
        $"Evaluation task failures: {report.Failures.Count}");

Inspect InfrastructureErrorRate before comparing scores. A high rate indicates provider throttling or transient infrastructure noise rather than model quality.

Use HPD-Agent.AspNetCore.Evaluations to expose score, analytics, run, dataset, and red-team data over HTTP.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on HPD-Agent.Evaluations:

Package Downloads
HPD-Agent.Evaluations.HpdBase

HPD Base-backed durable score, run, dataset, and evaluation result storage for HPD Agent.

HPD-Agent.AspNetCore.Evaluations

Optional evaluation API endpoints for HPD-Agent ASP.NET hosts.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.5 67 11/10/2026
0.9.2 94 11/2/2026
0.9.1 92 10/21/2026
0.9.0 95 10/20/2026
0.8.1 142 8/6/2026
0.8.0 112 8/5/2026
0.7.0 118 7/19/2026
0.6.0 148 7/4/2026
0.5.5 125 6/21/2026
0.5.0 125 6/11/2026
0.3.3 120 2/25/2026
0.3.2 115 2/25/2026
0.3.1 113 2/24/2026
0.3.0 99 2/24/2026