Skip to content

[Feature] Configurable fallback chains for auxiliary tasks #26882

@zccyman

Description

@zccyman

Feature Description

Add configurable fallback chains for auxiliary tasks so that when the primary provider fails (quota, rate limit, connection), the system automatically tries alternative providers instead of failing silently.

Problem

Currently, auxiliary tasks like vision, tts, and compression have a single provider. When that provider fails:

  • Vision: image analysis silently fails, agent loses visual context
  • Compression: context compaction fails, conversation history dropped without summary
  • TTS: voice output fails, user gets no audio

See #26803 for a detailed analysis of the fallback chain gap in call_llm.

Proposed Config

auxiliary:
  vision:
    provider: glm
    model: glm-4v-flash
    fallback_chain:
      - provider: openrouter
        model: google/gemini-3-flash-preview
      - provider: nous
        model: claude-sonnet-4
  compression:
    provider: openrouter
    fallback_chain:
      - provider: openai
        model: gpt-4o-mini

Behavior

  1. Try primary provider first
  2. On fallback-worthy errors (429 quota, 402 payment, connection timeout, auth failure), try the next entry in fallback_chain
  3. If all entries fail, raise the last error
  4. Log which provider was actually used for observability

This extends the existing fallback logic in call_llm (currently gated on is_auto) to work with explicitly configured providers.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/configConfig system, migrations, profilescomp/agentCore agent loop, run_agent.py, prompt buildertype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions