# QuotaDefinition

> 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.quotadefinition/
> Summary: QuotaDefinition: A quota rule defined for a tenant or an agent.

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

A quota rule defined for a tenant or an agent.

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

A quota is at **day/month** scale and is counted in the
database. The **rate limit** that smooths bursty load is a
separate mechanism and lives in memory; the two must not be confused.

All three limits may be [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null): only the ones that are set
are enforced. If all three are empty, the rule does nothing.

## Constructors

### <a id="Tracon_QuotaDefinition__ctor"></a> QuotaDefinition\(\)

```csharp
public QuotaDefinition()
```

## Properties

### <a id="Tracon_QuotaDefinition_AgentName"></a> AgentName

The agent the rule is bound to. If [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the rule
applies to all of the tenant's runs.

```csharp
public string? AgentName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_QuotaDefinition_CreatedAt"></a> CreatedAt

The creation time (UTC).

```csharp
public required DateTimeOffset CreatedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

### <a id="Tracon_QuotaDefinition_Enabled"></a> Enabled

Whether the rule is enabled.

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

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

The rule identifier.

```csharp
public required Guid Id { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

### <a id="Tracon_QuotaDefinition_MaxCost"></a> MaxCost

The maximum monetary amount per period. Unlimited if [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public decimal? MaxCost { get; init; }
```

#### Property Value

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

This limit **cannot be enforced** on a model with undefined
pricing: since the cost is unknown, the quota falls back to tokens. See
[PricingSource.Unknown](/api/tracon.pricingsource/).

### <a id="Tracon_QuotaDefinition_MaxRuns"></a> MaxRuns

The maximum number of runs per period. Unlimited if [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public long? MaxRuns { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)?

### <a id="Tracon_QuotaDefinition_MaxTokens"></a> MaxTokens

The maximum tokens per period. Unlimited if [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public long? MaxTokens { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)?

### <a id="Tracon_QuotaDefinition_Period"></a> Period

The counter's reset interval.

```csharp
public required QuotaPeriod Period { get; init; }
```

#### Property Value

 [QuotaPeriod](/api/tracon.quotaperiod/)

### <a id="Tracon_QuotaDefinition_TenantId"></a> TenantId

The tenant the rule belongs to.

```csharp
public required string TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_QuotaDefinition_UpdatedAt"></a> UpdatedAt

The last-updated time (UTC).

```csharp
public required DateTimeOffset UpdatedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

## Methods

### <a id="Tracon_QuotaDefinition_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_QuotaDefinition_Equals_Tracon_QuotaDefinition_"></a> Equals\(QuotaDefinition?\)

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

`other` [QuotaDefinition](/api/tracon.quotadefinition/)?

#### Returns

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

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

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

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

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

### <a id="Tracon_QuotaDefinition_op_Equality_Tracon_QuotaDefinition_Tracon_QuotaDefinition_"></a> operator ==\(QuotaDefinition?, QuotaDefinition?\)

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

`left` [QuotaDefinition](/api/tracon.quotadefinition/)?

`right` [QuotaDefinition](/api/tracon.quotadefinition/)?

#### Returns

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

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

`left` [QuotaDefinition](/api/tracon.quotadefinition/)?

`right` [QuotaDefinition](/api/tracon.quotadefinition/)?

#### Returns

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