Skip to main content

Class: CountingAttemptBudget

Defined in: packages/agentos/src/safety/runtime/ModelAttemptBudget.ts:226

An authorizer that counts attempts against a local limit, with no money: a local application's own policy.

Implements​

Constructors​

Constructor​

new CountingAttemptBudget(limits): CountingAttemptBudget

Defined in: packages/agentos/src/safety/runtime/ModelAttemptBudget.ts:230

Parameters​

limits​

AttemptLimits

The attempts allowed and each attempt's most.

Returns​

CountingAttemptBudget

Methods​

authorize()​

authorize(_request): Promise<AttemptGrant>

Defined in: packages/agentos/src/safety/runtime/ModelAttemptBudget.ts:232

Authorizes the next attempt.

Parameters​

_request​
purpose​

AttemptPurpose

rateVersion?​

string

Returns​

Promise<AttemptGrant>

Throws​

When the attempt is refused.

Implementation of​

IAttemptAuthorizer.authorize


record()​

record(_attemptId, _usage, _final): Promise<void>

Defined in: packages/agentos/src/safety/runtime/ModelAttemptBudget.ts:238

Records an attempt's quantities by component key.

Parameters​

_attemptId​

string

_usage​

Readonly<Record<string, number>>

_final​

boolean

Returns​

Promise<void>

Implementation of​

IAttemptAuthorizer.record