/** Configuration options for exponential backoff retry behavior. */
export interface RetryOptions {
    /** Maximum number of retry attempts (default: 5) */
    maxRetries: number;
    /** Base delay in milliseconds (default: 4000) */
    baseDelay: number;
    /** Maximum delay in milliseconds (default: 60000) */
    maxDelay: number;
    /** Jitter factor for randomization (0-1, default: 0.8) */
    jitter: number;
    /** Function to determine if error should trigger retry (default: isRetryError) */
    handleError: (error: unknown) => boolean;
}
/**
 * Retries failed LLM API calls with exponential backoff and jitter.
 *
 * Automatically retries transient failures (rate limits, server errors, network
 * issues) while immediately failing on permanent errors (quota exceeded,
 * invalid requests). Uses exponential backoff with randomized jitter to avoid
 * thundering herd problems when multiple concurrent requests fail
 * simultaneously.
 *
 * The retry logic is critical for production reliability: LLM APIs frequently
 * return temporary 429/5xx errors under heavy load, and network timeouts are
 * common. Without retry, these transient failures would cascade into
 * user-visible errors despite being automatically recoverable.
 *
 * @author Kakasoo
 * @param fn Async function to execute with retry logic
 * @param options Retry configuration (maxRetries, delays, error handler)
 * @returns Promise resolving to function result if successful
 * @throws Last encountered error if all retry attempts exhausted
 */
export declare function randomBackoffRetry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
/**
 * Calculates retry delay using exponential backoff with jitter.
 *
 * Throws immediately for non-retryable errors or when retry count exceeds 5.
 * Used by orchestrators that need explicit delay calculation without automatic
 * retry loop execution.
 *
 * @param props Retry count and error to evaluate
 * @returns Calculated delay in milliseconds
 * @throws Original error if non-retryable or max retries exceeded
 */
export declare function randomBackoffStrategy(props: {
    count: number;
    error: unknown;
}): number;
