Patch Changes
-
#11369
d6ad973Thanks @hntrl! - fix(langchain): use unified endpoint for gateway -
#11342
3b0e4c4Thanks @thushanth-bengre-langchain! - feat(core): mark errors as retryable or not, and stop retrying the ones that aren'tRetry middleware retried every failure up to
maxRetries, including deterministic ones like a bad API key or an unknown model. Retries also nest, so a single such failure could cost dozens of API calls.@langchain/core/errorsaddsstampRetryable(error, retryable)andgetRetryable(error). Marking an error leaves its class and shape untouched, so a provider SDK error can be classified without breakinginstanceof.getRetryablereturnsundefinedfor errors nobody classified, and both are exported so tool authors can mark their own failures.modelRetryMiddlewareandtoolRetryMiddlewarenow respect the mark by default, and retries stop as soon as one is found rather than each layer spending its own budget. Aborted calls, context overflow, and oversized payloads are marked non-retryable out of the box.
Models accept a per-callmaxRetriesso a surrounding retry loop can take over.Behavior change: errors marked non-retryable now fail on the first attempt. Unclassified errors — including any from third-party integrations or custom tools — retry exactly as before. Pass
retryOn: () => trueto restore the old default. A customonFailedAttemptreplaces the built-in handler and opts out of marking.