# ToolLoopSettings

> 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.toolloopsettings/
> Summary: ToolLoopSettings: Tool-call loop settings for a ModelBinding.

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

Tool-call loop settings for a [ModelBinding](/api/tracon.modelbinding/).

```csharp
public sealed record ToolLoopSettings : IEquatable<ToolLoopSettings>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.toolloopsettings/">ToolLoopSettings</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;ToolLoopSettings&gt;</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.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

The loop is the one the model pipeline builds around the provider client; it
runs the tools the model asks for and sends their results back. Every member
keeps the loop's own default when it is left unset, so a binding without
[ModelBinding.ToolLoop](/api/tracon.modelbinding/#Tracon_ModelBinding_ToolLoop) behaves exactly as it did before the
settings existed.

A fallback link runs the same agent's tools, so it takes the primary binding's
loop settings as one object. The tools' thread-safety and the limits of the
agent do not change with the model.

## Constructors

### <a id="Tracon_ToolLoopSettings__ctor"></a> ToolLoopSettings\(\)

```csharp
public ToolLoopSettings()
```

## Properties

### <a id="Tracon_ToolLoopSettings_AllowConcurrentToolCalls"></a> AllowConcurrentToolCalls

Gets whether independent tool calls within one turn may run at the
same time.

```csharp
public bool AllowConcurrentToolCalls { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

#### Remarks

[false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) by default: with no change, tool calls within a
turn run one after another exactly as they do today. A tool body that
is not written to be thread-safe (a non-thread-safe field it shares
across calls, for example) is only safe to run concurrently with
itself once this is turned on for its agent. It is not the same as
[ModelBinding.AllowMultipleToolCalls](/api/tracon.modelbinding/#Tracon_ModelBinding_AllowMultipleToolCalls): that one lets the model
ask for several calls in one turn, this one decides whether Tracon runs
them at the same time.

### <a id="Tracon_ToolLoopSettings_MaximumConsecutiveErrors"></a> MaximumConsecutiveErrors

Gets how many tool-call iterations in a row may fail before the loop
rethrows the error; the loop's default (3) is used when it is
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public int? MaximumConsecutiveErrors { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)?

#### Remarks

`0` rethrows the first failure. A negative value is rejected while the
agent is built, with `TraconCompilationException`.

### <a id="Tracon_ToolLoopSettings_TerminateOnUnknownCalls"></a> TerminateOnUnknownCalls

Gets whether the loop ends when the model asks for a tool the agent does
not have; the loop's default ([false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool)) is used when it is
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public bool? TerminateOnUnknownCalls { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)?

#### Remarks

With the default, the model gets an error result for the unknown call and
the loop goes on. Set it to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to hand the unknown call
back to the caller instead.

## Methods

### <a id="Tracon_ToolLoopSettings_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolLoopSettings_Equals_Tracon_ToolLoopSettings_"></a> Equals\(ToolLoopSettings?\)

```csharp
public bool Equals(ToolLoopSettings? other)
```

#### Parameters

`other` [ToolLoopSettings](/api/tracon.toolloopsettings/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolLoopSettings_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_ToolLoopSettings_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_ToolLoopSettings_op_Equality_Tracon_ToolLoopSettings_Tracon_ToolLoopSettings_"></a> operator ==\(ToolLoopSettings?, ToolLoopSettings?\)

```csharp
public static bool operator ==(ToolLoopSettings? left, ToolLoopSettings? right)
```

#### Parameters

`left` [ToolLoopSettings](/api/tracon.toolloopsettings/)?

`right` [ToolLoopSettings](/api/tracon.toolloopsettings/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolLoopSettings_op_Inequality_Tracon_ToolLoopSettings_Tracon_ToolLoopSettings_"></a> operator \!=\(ToolLoopSettings?, ToolLoopSettings?\)

```csharp
public static bool operator !=(ToolLoopSettings? left, ToolLoopSettings? right)
```

#### Parameters

`left` [ToolLoopSettings](/api/tracon.toolloopsettings/)?

`right` [ToolLoopSettings](/api/tracon.toolloopsettings/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
