Skip to main content
A request to an Agent Gateway instance can retry when it fails, limit how long each attempt takes, and fall back to other models.
An instance sets no routing of its own.

Retries

An instance retries a failed request only when the request sets num_retries. The retries run before the request fails or falls back. A model that keeps failing is taken out of rotation for 5 seconds, and requests for it return 429 meanwhile.

Fallbacks

When a request fails and its retries are spent, the gateway tries the request’s fallbacks in order. When every fallback fails, the response is the first model’s error.

Per-Request Settings

A request can set its own routing in the request body: A fallback model must be on the key’s allow list, or the gateway refuses the request.

Fallback Example

This request asks GLM-5.3-Flash for more output tokens than it allows. Its fallback, Qwen3.8-27B-nothink, replaces max_tokens with 8:
Host
GLM-5.3-Flash refused the request with 422, and the fallback answered. After a fallback, model holds the Telnyx inference model that answered:
Output
Without fallbacks, or with "disable_fallbacks": true, the same request returns the 422.