Retries & reliability
Custom retry predicate
The default only retries 429/5xx and a few network error codes -- pass isRetryable to match a provider's own non-standard error shape.
← All recipes
import { Klaro, retries } from "@klaroshield/sdk";
const klaro = new Klaro().use(
retries({
max: 3,
isRetryable: (error) => {
const e = error as { code?: string };
return e?.code === "rate_limit_exceeded" || e?.code === "model_overloaded";
},
})
);Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.