agentskit.js

CostGuardOptions

Auto-generated API reference for CostGuardOptions.

Interface: CostGuardOptions

Defined in: cost-guard.ts:45

#Properties

#budgetUsd

budgetUsd: number

Defined in: cost-guard.ts:47

Hard budget in USD. Aborts the run when exceeded.


#controller

controller: AbortController

Defined in: cost-guard.ts:52

AbortController to signal the runtime to stop. The runtime picks this up via RunOptions.signal (RT13).


#modelOverride?

optional modelOverride?: string

Defined in: cost-guard.ts:72

Force a specific model id if the runtime doesn't emit one.


#name?

optional name?: string

Defined in: cost-guard.ts:74

Observer name for tracing.


#onCost?

optional onCost?: (info) => void

Defined in: cost-guard.ts:60

Called whenever the running total changes. Useful for progress UI.

#Parameters

info
budgetRemainingUsd

number

completionTokens

number

costUsd

number

promptTokens

number

#Returns

void


#onExceeded?

optional onExceeded?: (info) => void

Defined in: cost-guard.ts:70

Called when the budget is exceeded (just before abort). By default also logs a warning to stderr.

#Parameters

info
budgetUsd

number

costUsd

number

#Returns

void


#prices?

optional prices?: Record<string, TokenPrice>

Defined in: cost-guard.ts:56

Optional price table override. Partial — merged over DEFAULT_PRICES.

Explore nearby

✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page