Skip to content
Tracon

LoopSettings

Namespace Tracon · Assembly Tracon.Abstractions.dll

Turns the harness loop on: the agent is re-invoked until a stop criterion says the work is finished.

public sealed record LoopSettings : IEquatable<LoopSettings>

objectLoopSettings

IEquatable<LoopSettings>

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

An agent that keeps working until it writes ALL DONE, for at most five iterations:

new AgentDefinition
{
Name = "researcher",
Model = new ModelBinding { Provider = "openai", Model = "gpt-5" },
Harness = new HarnessSettings
{
Loop = new LoopSettings
{
Criteria = [new LoopCriterion { Kind = "completionMarker", Marker = "ALL DONE" }],
MaxIterations = 5,
},
},
};

The loop is off while HarnessSettings.Loop is null, and the harness behaves exactly as it did before this setting existed. Nothing turns it on implicitly.

This is not HarnessSettings.MaximumIterationsPerRequest. The two numbers count different things and are deliberately kept in separate types so they cannot be read as one:

SettingWhat it bounds
`HarnessSettings.MaximumIterationsPerRequest` The harness's *inner* tool-calling loop inside ONE agent invocation. It is a runaway-safety ceiling, not a stop criterion.
`MaxIterations` The *outer* loop that re-invokes the whole agent after a criterion says the work is not finished. It bounds how many times that may happen.

Criteria are evaluated in order, and the first one that asks for another iteration wins — the remaining criteria are not evaluated that iteration. The loop therefore stops only when every criterion is satisfied. Put the cheapest criterion first: an aiJudge placed after a completionMarker costs nothing on the iterations the marker already keeps going.

Every completed iteration writes a RunEventType.LoopIterationCompleted event to the run, so the loop is visible in the run record instead of hidden inside a caller’s own code.

public LoopSettings()

The iteration ceiling applied when MaxIterations is null.

public const int DefaultMaxIterations = 10

int

The ceiling is never left open. A criterion that can never be satisfied — a marker the model does not write, a judge that is never convinced — turns an open loop into a bill the consumer only learns about from an invoice, so Tracon applies its own ceiling instead of leaving the number to the framework’s default.

Gets the stop criteria, evaluated in order. At least one is required.

public required IReadOnlyList<LoopCriterion> Criteria { get; init; }

IReadOnlyList<LoopCriterion>

Gets a value that starts every iteration from a fresh context instead of carrying the previous iterations’ messages forward.

public bool FreshContextPerIteration { get; init; }

bool

Off by default. Turning it on changes what the agent remembers between iterations: the agent no longer sees its own earlier answers, only the original request and the criterion’s feedback. Use it when repeated context is what makes the agent repeat itself; leave it off when the work builds on the previous iteration.

Gets the upper number of loop iterations. null takes DefaultMaxIterations. Must be greater than zero.

public int? MaxIterations { get; init; }

int?

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(LoopSettings? other)

other LoopSettings?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(LoopSettings?, LoopSettings?)

Section titled “ operator ==(LoopSettings?, LoopSettings?)”
public static bool operator ==(LoopSettings? left, LoopSettings? right)

left LoopSettings?

right LoopSettings?

bool

operator !=(LoopSettings?, LoopSettings?)

Section titled “ operator !=(LoopSettings?, LoopSettings?)”
public static bool operator !=(LoopSettings? left, LoopSettings? right)

left LoopSettings?

right LoopSettings?

bool