# TraconOnlineEvaluationBuilderExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.tracononlineevaluationbuilderextensions/
> Summary: TraconOnlineEvaluationBuilderExtensions: Chain extensions that turn on the built-in model-based judge.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Core.dll</code></div>

Chain extensions that turn on the built-in model-based judge.

```csharp
public static class TraconOnlineEvaluationBuilderExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.tracononlineevaluationbuilderextensions/">TraconOnlineEvaluationBuilderExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

This is an extension method, not a member of [ITraconBuilder](/api/tracon.itraconbuilder/):
adding a member to the interface is a breaking change after release, adding
an extension method is not.

## Methods

### <a id="Tracon_TraconOnlineEvaluationBuilderExtensions_AddEvalEvaluatorFactory__1_Tracon_ITraconBuilder_"></a> AddEvalEvaluatorFactory<TFactory\>\(ITraconBuilder\)

Registers the factory that builds the `AI.IAgentEvaluator` an
eval suite is graded with.

```csharp
public static ITraconBuilder AddEvalEvaluatorFactory<TFactory>(this ITraconBuilder builder) where TFactory : class, IEvalEvaluatorFactory
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

Configuration chain.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Type Parameters

`TFactory` 

The factory implementation type.

#### Remarks

The consumer's registration wins: the built-in factory is registered
with `TryAdd`, so this one replaces it. Registering none leaves
MAF's `AI.LocalEvaluator`, built over the suite's own checks.

```csharp
builder.AddTracon()
       .AddEvalEvaluatorFactory<LoggingEvaluatorFactory>();
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_TraconOnlineEvaluationBuilderExtensions_AddEvalEvaluatorFactory_Tracon_ITraconBuilder_Tracon_IEvalEvaluatorFactory_"></a> AddEvalEvaluatorFactory\(ITraconBuilder, IEvalEvaluatorFactory\)

Registers a configured eval-evaluator factory instance.

```csharp
public static ITraconBuilder AddEvalEvaluatorFactory(this ITraconBuilder builder, IEvalEvaluatorFactory factory)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

Configuration chain.

`factory` [IEvalEvaluatorFactory](/api/tracon.ievalevaluatorfactory/)

The factory instance. The caller owns it.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

The consumer's registration wins over the built-in one.

```csharp
builder.AddTracon()
       .AddEvalEvaluatorFactory(new LoggingEvaluatorFactory());
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` or `factory` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_TraconOnlineEvaluationBuilderExtensions_AddEvaluatorJudge_Tracon_ITraconBuilder_System_String_Microsoft_Extensions_AI_Evaluation_IEvaluator_"></a> AddEvaluatorJudge\(ITraconBuilder, string, IEvaluator\)

Registers a Microsoft.Extensions.AI `Evaluation.IEvaluator` as a
Tracon run judge.

```csharp
public static ITraconBuilder AddEvaluatorJudge(this ITraconBuilder builder, string name, IEvaluator evaluator)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

Configuration chain.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The judge name, matching `[A-Za-z0-9._-]{1,64}`.

`evaluator` IEvaluator

The evaluator to grade sampled runs with.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

The calibrated evaluator catalog lives in the
`Microsoft.Extensions.AI.Evaluation.Quality` package, which
Tracon deliberately does not reference: add it yourself when you
want the catalog, and a consumer who does not use it carries no extra
dependency.

Every metric the evaluator reports becomes its own score row, named
`{name}.{metric}`. The prefix is what keeps two evaluators that
report the same metric from overwriting each other, because a score name
is part of the stored uniqueness key.

The evaluator calls a model on every sampled run, so evaluation cost
grows with the number of registered evaluators. The model is the judge
model, set here or by [TraconOnlineEvaluationBuilderExtensions.AddModelRunJudge](/api/tracon.tracononlineevaluationbuilderextensions/#Tracon_TraconOnlineEvaluationBuilderExtensions_AddModelRunJudge_Tracon_ITraconBuilder_System_Action_Tracon_ModelRunJudgeOptions__); registering an
evaluator judge without one fails the judge at call time.

Like [TraconOnlineEvaluationBuilderExtensions.AddModelRunJudge](/api/tracon.tracononlineevaluationbuilderextensions/#Tracon_TraconOnlineEvaluationBuilderExtensions_AddModelRunJudge_Tracon_ITraconBuilder_System_Action_Tracon_ModelRunJudgeOptions__), this call alone scores nothing:
`Tracon:OnlineEvaluation:Enabled` and its sample rate are still
the gate.

```csharp
builder.AddTracon()
       .AddEvaluatorJudge(
           "relevance",
           new RelevanceEvaluator(),
           options => options.Model = new ModelBinding { Provider = "openai", Model = "gpt-5.4-mini" });
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` or `evaluator` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`name` is not a legal judge name.

### <a id="Tracon_TraconOnlineEvaluationBuilderExtensions_AddEvaluatorJudge_Tracon_ITraconBuilder_System_String_Microsoft_Extensions_AI_Evaluation_IEvaluator_System_Action_Tracon_ModelRunJudgeOptions__"></a> AddEvaluatorJudge\(ITraconBuilder, string, IEvaluator, Action<ModelRunJudgeOptions\>\)

Registers a Microsoft.Extensions.AI `Evaluation.IEvaluator` as a
Tracon run judge and configures the shared judge model.

```csharp
public static ITraconBuilder AddEvaluatorJudge(this ITraconBuilder builder, string name, IEvaluator evaluator, Action<ModelRunJudgeOptions> configure)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

Configuration chain.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The judge name, matching `[A-Za-z0-9._-]{1,64}`.

`evaluator` IEvaluator

The evaluator to grade sampled runs with.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[ModelRunJudgeOptions](/api/tracon.modelrunjudgeoptions/)\>

The judge model the evaluator calls.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

The judge model is **shared** with every other judge:
this overload writes the same [ModelRunJudgeOptions](/api/tracon.modelrunjudgeoptions/) that
[TraconOnlineEvaluationBuilderExtensions.AddModelRunJudge](/api/tracon.tracononlineevaluationbuilderextensions/#Tracon_TraconOnlineEvaluationBuilderExtensions_AddModelRunJudge_Tracon_ITraconBuilder_System_Action_Tracon_ModelRunJudgeOptions__) writes. Use it to run evaluator judges
without also turning on the built-in model judge. Calling it more than
once applies each configuration in order, as options configuration
always does.

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder`, `evaluator` or
`configure` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`name` is not a legal judge name.

### <a id="Tracon_TraconOnlineEvaluationBuilderExtensions_AddModelRunJudge_Tracon_ITraconBuilder_System_Action_Tracon_ModelRunJudgeOptions__"></a> AddModelRunJudge\(ITraconBuilder, Action<ModelRunJudgeOptions\>\)

Registers Tracon's built-in model-based [IRunJudge](/api/tracon.irunjudge/)
implementation ([Tracon.ModelRunJudge](/api/tracon/)).

```csharp
public static ITraconBuilder AddModelRunJudge(this ITraconBuilder builder, Action<ModelRunJudgeOptions> configure)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

Configuration chain.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[ModelRunJudgeOptions](/api/tracon.modelrunjudgeoptions/)\>

The judge's model, criteria, and instructions.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

This call ALONE scores nothing. The actual gate for online evaluation
is `Tracon:OnlineEvaluation:Enabled` AND
`Tracon:OnlineEvaluation:SampleRate` (the no-surprises rule: no run is sampled
unless both are on). This extension only registers which model is USED
as the judge.

Because [ModelBinding](/api/tracon.modelbinding/) is a nested type, it is set up in
code rather than from a configuration section - the same pattern as
other provider bindings (e.g. `AgentDefinition.Model`).

```csharp
builder.AddTracon()
       .AddModelRunJudge(options =>
       {
           options.Model = new ModelBinding { Provider = "openai", Model = "gpt-5.4-mini" };
           options.Criteria.Add("Does the response directly answer the question?");
       });
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder`
or
`configure`
is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
