The Trustware SDK automatically retries requests that receive aDocumentation Index
Fetch the complete documentation index at: https://docs.trustware.io/llms.txt
Use this file to discover all available pages before exploring further.
429 Too Many Requests response. The retry field in TrustwareConfigOptions lets you tune that behavior: how many times to retry, how long to wait between attempts, and whether to receive callbacks as the rate limit window fills up.
autoRetry controls client-side retry behavior only. It does not disable or
modify backend rate limits — those are enforced server-side regardless of
this setting.RetryConfig type
Default values
Properties
When
true, the SDK automatically retries any request that receives a 429
response, using exponential backoff calculated from baseDelayMs. Set to
false to disable automatic retry and handle 429 responses yourself via
onRateLimited.The maximum number of retry attempts before the SDK gives up and throws a
RateLimitError. Once this limit is exhausted, the error propagates to your
onError callback if one is configured.The base delay in milliseconds used for exponential backoff. The delay before
each retry attempt is calculated as
baseDelayMs * 2^retryCount. With the
default of 1000:- Retry 1: ~1 second
- Retry 2: ~2 seconds
- Retry 3: ~4 seconds
The number of remaining requests in the current rate limit window at which the
SDK calls
onRateLimitApproaching. For example, the default of 5 means the
callback fires when 5 or fewer requests remain before the window resets.Callbacks
Called on every response that includes rate limit headers from the server,
regardless of whether the limit has been reached. Use this for passive
monitoring or to display a rate limit gauge in your UI.
Called when a
429 response is received. retryCount is the current attempt
number (starting at 1). Use this to log rate limit events or show a warning
to the user.Called when the remaining request count in the current window falls below
approachingThreshold. Use this as an early warning to reduce request
frequency before hitting the limit.RateLimitInfo shape
All three callbacks receive aRateLimitInfo object:
What happens when retries are exhausted
WhenmaxRetries is reached without a successful response, the SDK throws a RateLimitError. If you have configured an onError callback on TrustwareConfigOptions, it will be called with that error. If you are using the headless API directly, the promise rejects with RateLimitError.
