Build custom AI agent evaluators in .NET Microsoft Agent Framework + Ollama

Authorised Territory walks through building custom AI agent evaluators in .NET using Microsoft Agent Framework (MAF) with a local Ollama endpoint.

Overview

The tutorial shows how to create a local AI agent and evaluate its responses using custom FunctionEvaluator checks. It focuses on building application-specific evaluation metrics (beyond generic LLM evaluation) and inspecting which checks pass or fail.

Starting solution referenced by the presenter: https://youtu.be/1T-OfUwcPDI

What the tutorial builds

Custom evaluator 1: containsBarcelonaHistory (content evaluation)

This evaluator checks whether the agent response contains the information the app expects. The check verifies that the response:

The point of this example is to demonstrate a domain-specific evaluation metric rather than relying only on generic LLM scoring.

Custom evaluator 2: responseLength (output validation)

This evaluator enforces a simple structural requirement:

Even though it’s a basic check, it illustrates that custom evaluators can validate essentially any requirement you can express in C#.

Key .NET / MAF concepts used