Skip to main content

Function: withBoundedRetry()

withBoundedRetry<T>(fn, policy, isTransient): Promise<T>

Defined in: packages/agentos/src/safety/runtime/SpendMeter.ts:189

Runs fn, trying again on an error isTransient accepts, with a doubling delay, until the tries or the deadline run out. Any failure that ends the loop is thrown as a SpendMeterUnavailableError carrying the last error.

Type Parameters​

T​

T

Parameters​

fn​

() => Promise<T>

policy​

SpendRetryPolicy

isTransient​

(e) => boolean

Returns​

Promise<T>