# TraconQuotaOptions

> 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.traconquotaoptions/
> Summary: TraconQuotaOptions: Defines options for the quota subsystem.

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

Defines options for the quota subsystem.

```csharp
public sealed class TraconQuotaOptions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconquotaoptions/">TraconQuotaOptions</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

Read from the `Tracon:Quotas` configuration section.

## Constructors

### <a id="Tracon_TraconQuotaOptions__ctor"></a> TraconQuotaOptions\(\)

```csharp
public TraconQuotaOptions()
```

## Fields

### <a id="Tracon_TraconQuotaOptions_SectionName"></a> SectionName

Gets the configuration section name.

```csharp
public const string SectionName = "Tracon:Quotas"
```

#### Field Value

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

### <a id="Tracon_TraconQuotaOptions_AllowOnStoreFailure"></a> AllowOnStoreFailure

Gets or sets whether to allow a run when quota enforcement fails.

```csharp
public bool AllowOnStoreFailure { get; set; }
```

#### Property Value

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

Defaults to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) so a temporary database outage does
not stop the service. A strict deployment can set this to
[false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) and choose "do not run when quota cannot be verified".

### <a id="Tracon_TraconQuotaOptions_Enabled"></a> Enabled

Gets or sets whether quota enforcement is enabled. When disabled, rules
can be stored but no run is rejected and no counter increments.

```csharp
public bool Enabled { get; set; }
```

#### Property Value

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

Defaulting to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) is safe: nothing is rejected while
no rule exists. The "no default quota" rule comes from an *empty rule
set*, not from disabling the subsystem.

### <a id="Tracon_TraconQuotaOptions_PublishThresholdToRunStream"></a> PublishThresholdToRunStream

Gets or sets whether a crossed quota threshold is also written as a
[RunEventType.Custom](/api/tracon.runeventtype/) notice ([RunEventCustomTypes.QuotaThreshold](/api/tracon.runeventcustomtypes/#Tracon_RunEventCustomTypes_QuotaThreshold)) into the triggering root
run's own event stream, before its terminal event.

```csharp
public bool PublishThresholdToRunStream { get; set; }
```

#### Property Value

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

Defaults to [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool): with it off, behavior is
byte-for-byte identical to before this option existed — the same
`quota.threshold` webhook, no new frame in the run's event
stream. The webhook itself is unaffected by this flag; it always
fires when a threshold is crossed, exactly as before.

A consumer that wants a threshold notice correlated to the exact run
and delivered on the same connection the run streamed from turns this
on. A call tree's runs each write their own consumption, so the notice is in the
stream of the run whose consumption crossed the threshold: usually the root, and a
child run when it is the one that crosses. A child's stream is read from
`GET /api/runs/{id}/events`. See [RunEventCustomTypes.QuotaThreshold](/api/tracon.runeventcustomtypes/#Tracon_RunEventCustomTypes_QuotaThreshold) for the
event's shape and the guarantee that only Tracon can write it.

### <a id="Tracon_TraconQuotaOptions_ThresholdPercents"></a> ThresholdPercents

Gets percentages that publish a `quota.threshold` event when the
quota counter reaches them.

```csharp
public IList<int> ThresholdPercents { get; }
```

#### Property Value

 [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist\-1)<[int](https://learn.microsoft.com/dotnet/api/system.int32)\>

#### Remarks

Each threshold is published **once** per period. Otherwise,
every run above the threshold would produce a new event as the counter increments.

In configuration, a list (`ThresholdPercents:0 = "50"`) that replaces the
default. Each value must be between 1 and 100: an entry outside that range or
one that is not a number stops the application at startup with an
`Options.OptionsValidationException` that names
`ThresholdPercents` and quotes the entry as written. Such an entry used to
be dropped without a word.

### <a id="Tracon_TraconQuotaOptions_TimeZone"></a> TimeZone

Gets or sets the time zone used to calculate period boundaries. Windows
and IANA names are accepted.

```csharp
public string TimeZone { get; set; }
```

#### Property Value

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

An administrator who says "daily quota" means their business day. The
consumer is therefore expected to change the default UTC time zone.

## Methods

### <a id="Tracon_TraconQuotaOptions_ResolveTimeZone"></a> ResolveTimeZone\(\)

Returns the resolved time zone, falling back to UTC when its name is unknown.

```csharp
public TimeZoneInfo ResolveTimeZone()
```

#### Returns

 [TimeZoneInfo](https://learn.microsoft.com/dotnet/api/system.timezoneinfo)

The time zone.

#### Remarks

An unrecognized name does not throw because quota enforcement must not
stop all traffic for a bad name. `TraconQuotaOptionsValidator`
validates it during startup and reports the error there.
