Skip to content

.NET: [Feature]: Expose the MEAI IEvaluator -> IAgentEvaluator bridge (AsAgentEvaluator) #7363

Description

@ANcpLua

Description

Microsoft.Agents.AI already contains exactly the right bridge between the Microsoft.Extensions.AI.Evaluation ecosystem and agent evals — MeaiEvaluatorAdapter (dotnet/src/Microsoft.Agents.AI/Evaluation/MeaiEvaluatorAdapter.cs) wraps any MEAI IEvaluator into an IAgentEvaluator, runs it per item, handles the RawResponse-vs-bare-text shapes, and aggregates results. But it is internal (verified on main @ 7b6d25798), so every consumer who wants to run an MEAI evaluator (the bundled quality evaluators, the safety evaluators, or their own IEvaluator) through LocalEvaluator-style agent pipelines must re-implement the same ~40-line adapter verbatim.

  • What problem does it solve? Removes a copy-paste seam between the two first-party evaluation ecosystems. MEAI has a rich, growing IEvaluator catalog; agent-framework's eval pipeline speaks IAgentEvaluator. The bridge exists, is tested by usage, and is the obvious connector — it just isn't reachable.
  • Expected behavior: any MEAI IEvaluator becomes an IAgentEvaluator in one call.
  • Alternatives considered: keep copying the adapter into every consumer (status quo — drift risk per copy); make the class public without an extension method (works, but an As* extension matches the framework's existing AsAIAgent / MEAI AsChatClient idiom).

Proposed API

namespace Microsoft.Agents.AI;

public static class AgentEvaluatorExtensions
{
    /// <summary>Wraps an MEAI evaluator so it can run in agent evaluation pipelines.</summary>
    public static IAgentEvaluator AsAgentEvaluator(
        this IEvaluator evaluator,
        ChatConfiguration chatConfiguration);
}

Implementation is a one-line delegation to the existing MeaiEvaluatorAdapter, which can stay internal. Purely additive — no behavior change for existing callers. Happy to send the PR (extension class + XML docs + one adapter test; no changes to MeaiEvaluatorAdapter itself) if the shape is acceptable.

Code Sample

using Microsoft.Agents.AI;
using Microsoft.Extensions.AI.Evaluation;
using Microsoft.Extensions.AI.Evaluation.Quality;

IAgentEvaluator quality = new CoherenceEvaluator()
    .AsAgentEvaluator(new ChatConfiguration(judgeChatClient));

AgentEvaluationResults results = await quality.EvaluateAsync(items, "quality-gate");

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETUsage: [Issues, PRs], Target: .NettriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions