Skip to content

QuotaDefinition

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

A quota rule defined for a tenant or an agent.

public sealed record QuotaDefinition : IEquatable<QuotaDefinition>

objectQuotaDefinition

IEquatable<QuotaDefinition>

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

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: only the ones that are set are enforced. If all three are empty, the rule does nothing.

public QuotaDefinition()

The agent the rule is bound to. If null, the rule applies to all of the tenant’s runs.

public string? AgentName { get; init; }

string?

The creation time (UTC).

public required DateTimeOffset CreatedAt { get; init; }

DateTimeOffset

Whether the rule is enabled.

public bool Enabled { get; init; }

bool

The rule identifier.

public required Guid Id { get; init; }

Guid

The maximum monetary amount per period. Unlimited if null.

public decimal? MaxCost { get; init; }

decimal?

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.

The maximum number of runs per period. Unlimited if null.

public long? MaxRuns { get; init; }

long?

The maximum tokens per period. Unlimited if null.

public long? MaxTokens { get; init; }

long?

The counter’s reset interval.

public required QuotaPeriod Period { get; init; }

QuotaPeriod

The tenant the rule belongs to.

public required string TenantId { get; init; }

string

The last-updated time (UTC).

public required DateTimeOffset UpdatedAt { get; init; }

DateTimeOffset

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(QuotaDefinition? other)

other QuotaDefinition?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(QuotaDefinition?, QuotaDefinition?)

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

left QuotaDefinition?

right QuotaDefinition?

bool

operator !=(QuotaDefinition?, QuotaDefinition?)

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

left QuotaDefinition?

right QuotaDefinition?

bool