RetryConfig
Defined in: core/retry.ts:23
Configuration options for retry behavior.
Example
Section titled “Example”// Custom retry with monitoringconst agent = LLMist.createAgent() .withRetry({ retries: 5, minTimeout: 2000, onRetry: (error, attempt) => console.log(`Retry ${attempt}`), }) .ask("Hello");Properties
Section titled “Properties”enabled?
Section titled “enabled?”
optionalenabled:boolean
Defined in: core/retry.ts:28
Whether retry is enabled.
Default
Section titled “Default”truefactor?
Section titled “factor?”
optionalfactor:number
Defined in: core/retry.ts:52
Exponential factor for backoff calculation.
Default
Section titled “Default”2maxTimeout?
Section titled “maxTimeout?”
optionalmaxTimeout:number
Defined in: core/retry.ts:46
Maximum delay between retries in milliseconds.
Default
Section titled “Default”30000minTimeout?
Section titled “minTimeout?”
optionalminTimeout:number
Defined in: core/retry.ts:40
Minimum delay before the first retry in milliseconds.
Default
Section titled “Default”1000onRetriesExhausted()?
Section titled “onRetriesExhausted()?”
optionalonRetriesExhausted: (error,attempts) =>void
Defined in: core/retry.ts:70
Called when all retries are exhausted and the operation fails. The error will still be thrown after this callback.
Parameters
Section titled “Parameters”Error
attempts
Section titled “attempts”number
Returns
Section titled “Returns”void
onRetry()?
Section titled “onRetry()?”
optionalonRetry: (error,attempt) =>void
Defined in: core/retry.ts:64
Called before each retry attempt. Use for logging or metrics.
Parameters
Section titled “Parameters”Error
attempt
Section titled “attempt”number
Returns
Section titled “Returns”void
randomize?
Section titled “randomize?”
optionalrandomize:boolean
Defined in: core/retry.ts:58
Whether to add random jitter to prevent thundering herd.
Default
Section titled “Default”trueretries?
Section titled “retries?”
optionalretries:number
Defined in: core/retry.ts:34
Maximum number of retry attempts.
Default
Section titled “Default”3shouldRetry()?
Section titled “shouldRetry()?”
optionalshouldRetry: (error) =>boolean
Defined in: core/retry.ts:78
Custom function to determine if an error should trigger a retry.
If not provided, uses the default isRetryableError classification.
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”boolean
true to retry, false to fail immediately