Testing model fallback in Amazon Bedrock AgentCore Gateway inference targets
Amazon Bedrock AgentCore Gateway[1] is a gateway that receives requests from client code and passes them to targets, such as AWS Lambda functions or Amazon Bedrock models. Its inference targets now support model fallback, which sends a request to another model when the first one fails, so client code does not need its own retry or switching logic. The author, Leona of Fusic, tested this in the Tokyo region using targets built to fail. A routeToTarget rule sets which models' requests go to the first target, up to two fallback targets in order, and the status codes, errors and first-byte timeout that trigger a fallback.
In the tests, fallback happened on 503 errors and on timeouts before the first byte (3 seconds in the test). It did not happen on a 400 error, which was not listed in triggerOn, or on a 429 caused by the gateway's own token rate limit[2], because the gateway checks rate limits before it evaluates rules. According to the documentation, fallback is not possible once a streaming response has started, and if every target fails, the last error is returned.
After 10 failures in about 36 seconds, the circuit breaker[3] skipped the first target and sent requests directly to Amazon Bedrock, then tried the first target again after 3.5 minutes. Clients received 200 responses throughout. The model field in the response body showed which model answered, and the gateway logs recorded the routing result, including the reason, such as servedViaFallbackHop:1.
Sources
-
JPZenn JA
Amazon Bedrock AgentCore Gatewayの推論ターゲットでモデルフォールバックを試してみた





