Skip to content

Fallback model not triggered on LLM timeout (ServiceUnavailableError / 503) #1121

@AgentGaius21

Description

@AgentGaius21

Description:
When the primary model returns a litellm.Timeout or litellm.ServiceUnavailableError (e.g. Gemini 503 after 600 seconds), the configured fallback models in agents.defaults.fallbacks are not triggered. The agent simply returns an error to the user instead of retrying with the next model in the fallback chain.

Expected behavior:
When the primary model times out or returns a 503, nanobot should automatically retry the request with the next model in fallbacks, transparently and without user intervention.

Actual behavior:
The error is returned directly to the user:
Error calling LLM: litellm.Timeout: Connection timed out.
Timeout passed=600.0, time taken=600.006 seconds
No fallback is attempted.

Config:

json"agents": {
  "defaults": {
    "model": "gemini/gemini-3.1-pro-preview",
    "fallbacks": [
      "vllm/mlx-community/Qwen3-14B-4bit",
      "openrouter/meta-llama/llama-3.3-70b-instruct"
    ]
  }
}

Environment:

nanobot-ai version: 0.1.4.post1
macOS, Apple Silicon (M4)
Primary model: Gemini 3.1 Pro Preview via Google AI Studio
Fallback: Qwen3 14B via local MLX server

Use case:
Gemini API occasionally returns 503 errors due to high demand (new model launch). A working fallback would allow uninterrupted operation without manual intervention or gateway restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions