Hermes Agent Fallback Providers: Staying Up When a Provider Fails

Configure Hermes Agent to automatically switch providers when your primary model fails.

Model Providers & Routingintermediate15 min readVerified Oct 23, 2026
Hermes Agent Fallback Providers: Staying Up When a Provider Fails

Hermes Agent Fallback Reference

The Hermes Agent automatically switches to backup provider:model pairs when the primary LLM provider fails, keeping sessions running without losing conversation history. This document covers every capability, configuration path, parameter, constraint, and failure mode of the fallback system.

When Fallback Activates

Fallback triggers after retries are exhausted for the following primary provider failures:

  • HTTP 429 (rate limit) after retries exhausted
  • HTTP 500, 502, 503 (server errors) after retries exhausted
  • HTTP 401, 403 (auth failures) — immediate fallback, no retry
  • HTTP 404 (not found) — immediate fallback
  • Repeated invalid or empty responses

Auxiliary tasks (vision, web extract, compression, skills hub, MCP, approval, title generation, triage specifier) trigger fallback only on capacity errors:

  • HTTP 402 (payment required)
  • HTTP 429 (daily-quota exhaustion)
  • Connection failure

Transient HTTP 429 rate limits on auxiliary tasks with an explicit provider do NOT trigger fallback.

Capabilities

  • Per-turn fallback: Each new user message starts with the primary model restored; fallback activates at most once per turn.
  • Seamless switch: Conversation history, tool calls, and context are preserved across fallback.
  • Multiple fallback providers: Tried in order from the fallback_providers list.
  • Legacy single fallback: fallback_model still honored for backward compatibility.
  • Custom OpenAI-compatible endpoint fallback: With base_url and optional key_env.
  • Auxiliary task fallback: Independent provider resolution chains for each auxiliary task.
  • Task-specific fallback_chain: Overrides the main fallback chain for a given auxiliary task.
  • Per-entry timeout: In fallback_chain for slower fallback candidates.
  • Subagent delegation: Inherits parent fallback chain; optional provider/model override.
  • Cron jobs: Inherit configured fallback_providers chain; optional per-job provider/model override.
  • Built-in auto-detection chains: For text tasks and vision tasks when no explicit fallback policy is set.
  • Direct endpoint override: For any auxiliary task via base_url, bypassing provider resolution.

Prerequisites

  • Hermes Agent installed and configured
  • At least one primary provider configured in the model: section of config.yaml
  • For fallback providers: corresponding API keys or authentication set (see the Supported Providers table)
  • For custom endpoint fallback: a running OpenAI-compatible endpoint with base_url and optionally key_env
  • For auxiliary tasks: at least one provider configured if using auto
  • For delegation override: a delegation: section in config.yaml
  • For cron job override: a cron job definition with provider and model parameters

Configuration Procedures

Configure Primary Fallback Chain via Interactive Manager

  1. Run hermes fallback to open the interactive manager.
  2. Use the subcommands: add, list (alias ls), remove (alias rm), clear to manage the chain.
  3. Changes persist under the top-level fallback_providers: list in config.yaml.

Configure Primary Fallback Chain via Direct YAML Edit

  1. Open ~/.hermes/config.yaml.
  2. Add a top-level fallback_providers list.
  3. Each entry requires both provider and model; entries missing either are ignored.

Example:

fallback_providers:
  - provider: openrouter
    model: anthropic/claude-sonnet-4

Configure Custom Endpoint Fallback

  1. In the fallback_providers list, set provider: custom.
  2. Set model to the desired model name.
  3. Set base_url to the endpoint URL (e.g., http://localhost:8000/v1).
  4. Optionally set key_env to the environment variable name containing the API key.

Example:

fallback_providers:
  - provider: custom
    model: llama-3.1-70b
    base_url: http://localhost:8000/v1
    key_env: LOCAL_API_KEY

Configure Auxiliary Task Fallback

  1. In config.yaml, under the auxiliary: section, set provider for the task (e.g., vision: provider: auto).
  2. Optionally set model, base_url, api_key for the task.
  3. Optionally set fallback_chain for the task (a list of provider:model entries).
  4. Each fallback_chain entry may also declare its own timeout in seconds.

Example:

auxiliary:
  vision:
    provider: openrouter
    model: anthropic/claude-sonnet-4
    fallback_chain:
      - provider: nous
        model: nous-hermes-3
        timeout: 30
      - provider: custom
        model: llama-3.1-70b
        base_url: http://localhost:8000/v1

Configure Delegation Provider Override

  1. In config.yaml, under the delegation: section, set provider and model for all subagents.
  2. Optionally set base_url and api_key for a direct endpoint.

Example:

delegation:
  provider: openrouter
  model: anthropic/claude-sonnet-4
  base_url: https://openrouter.ai/api/v1
  api_key: sk-abc123

Configure Cron Job Provider Override

  1. In the cron job definition, set provider and model parameters.
  2. Cron jobs inherit the configured fallback_providers chain by default.

Example:

cron:
  my_job:
    schedule: "0 6 * * *"
    provider: openrouter
    model: anthropic/claude-sonnet-4

Parameters

ParameterMeaningRequired
fallback_providersTop-level list of fallback provider:model pairs tried in order when primary failsNo (optional; if absent, no cross-provider fallback)
fallback_modelLegacy single fallback key; still honored for backward compatibility but fallback_providers takes priority when both are setNo (legacy)
providerThe provider identifier (e.g., openrouter, nous, anthropic, custom)Yes for each entry in fallback_providers and fallback_chain
modelThe model identifier (e.g., anthropic/claude-sonnet-4)Yes for each entry in fallback_providers; optional in fallback_chain entries
base_urlCustom OpenAI-compatible endpoint URL; overrides provider resolutionNo (optional; for custom endpoints or direct endpoint override)
key_envEnvironment variable name containing the API key for custom endpointNo (optional; for custom endpoints)
api_keyAPI key for direct endpoint override in auxiliary tasksNo (optional; falls back to OPENAI_API_KEY if not set)
timeoutPer-entry timeout in seconds for a fallback candidate in fallback_chainNo (optional; if absent, inherits task-level timeout)
auxiliary.<task>.providerProvider for the auxiliary task (auto, openrouter, nous, codex, main, anthropic, etc.)No (default: auto)
auxiliary.<task>.modelModel for the auxiliary taskNo (optional)
auxiliary.<task>.fallback_chainTask-specific fallback policy list; overrides main fallback chain for that taskNo (optional; if omitted, main fallback chain is used)
delegation.providerOverride provider for all subagents spawned by delegate_taskNo (optional)
delegation.modelOverride model for all subagentsNo (optional)
cronjob providerPer-job provider override for cron agentsNo (optional)
cronjob modelPer-job model override for cron agentsNo (optional)

Constraints and Caveats

  • Turn-scoped fallback: Each new user message starts with the primary model restored. Within a single turn, fallback activates at most once. If fallback also fails, normal error handling takes over (retries, then error message).
  • Prompt cache reset: Fallback resets the prompt cache. The next request re-reads the entire history at full input-token price, losing the ~75-90% cached rate discount. When the turn ends and primary is restored, the first request back on primary is also a full re-read (unless primary's cache TTL hasn't expired). Long sessions bouncing between providers can cost noticeably more than staying put.
  • No environment variables for the primary fallback chain: Configure exclusively through config.yaml or hermes fallback.
  • Config shape: fallback_providers (plural, list) is the current config shape; fallback_model (singular) is legacy. When both are set, fallback_providers takes priority. Running hermes fallback writes the current fallback_providers key and migrates legacy config on write.
  • Entry validation: Entries in fallback_providers missing either provider or model are ignored.
  • Provider main: NOT a valid value for top-level model.provider — only for auxiliary tasks.
  • Auxiliary task fallback triggers: For auxiliary tasks with an explicit provider, only capacity errors (HTTP 402, 429 daily-quota, connection failure) trigger fallback. Transient HTTP 429 rate limits respect the explicit provider choice and do NOT trigger the fallback ladder.
  • base_url precedence: For auxiliary tasks, base_url takes precedence over provider.
  • API key handling: Hermes does NOT reuse OPENROUTER_API_KEY for custom endpoints. It uses the configured api_key or falls back to OPENAI_API_KEY.
  • Compression graceful degradation: If no provider is available for compression, Hermes drops middle conversation turns without generating a summary. This does not fail the session.
  • Subagent inheritance: Subagents inherit the parent agent's primary fallback chain.
  • Cron job inheritance: Cron jobs inherit the configured fallback_providers chain (or legacy fallback_model) when they create an agent.
  • Legacy config migration: Legacy configs with compression.summary_model / compression.summary_provider / compression.summary_base_url are automatically migrated to auxiliary.compression.* on first load (config version 17).

Failure Modes

  • If fallback also fails within a turn, normal error handling takes over (retries, then error message).
  • If every layer of auxiliary fallback fails, Hermes logs Auxiliary <task>: ... all fallbacks exhausted at WARNING level and re-raises the original error.
  • If a provider returns a different phrase for daily-quota exhaustion and Hermes does not trigger fallback, that is a bug. Open an issue with the exact error string.
  • If no provider is available for compression, Hermes drops middle conversation turns without generating a summary (graceful degradation).

Examples

OpenRouter as Fallback for Anthropic Native

model:
  provider: anthropic
  default: claude-sonnet-4-6
fallback_providers:
  - provider: openrouter
    model: anthropic/claude-sonnet-4

Nous Portal as Fallback for OpenRouter

model:
  provider: openrouter
  default: anthropic/claude-opus-4
fallback_providers:
  - provider: nous
    model: nous-hermes-3

Local Model as Fallback for Cloud

fallback_providers:
  - provider: custom
    model: llama-3.1-70b
    base_url: http://localhost:8000/v1
    key_env: LOCAL_API_KEY

Codex OAuth as Fallback

fallback_providers:
  - provider: openai-codex
    model: gpt-5.3-codex

Auxiliary Task Fallback Detail

Auxiliary tasks (vision, web extract, compression, skills hub, MCP, approval, title generation, triage specifier) each have their own fallback behavior. When an auxiliary task is configured with an explicit provider, only capacity errors (HTTP 402, 429 daily-quota, connection failure) trigger the fallback ladder. Transient HTTP 429 rate limits do not trigger fallback for tasks with an explicit provider.

The fallback_chain parameter under an auxiliary task overrides the main fallback_providers chain for that specific task. Each entry in fallback_chain can include a timeout value in seconds, which overrides the task-level timeout for that specific fallback candidate.

If base_url is set for an auxiliary task, it takes precedence over the provider setting, allowing direct endpoint override without provider resolution.

Delegation Fallback

Subagents spawned by delegate_task inherit the parent agent's primary fallback chain. You can override the provider and model for all subagents by configuring the delegation: section in config.yaml. Optionally, you can set base_url and api_key for a direct endpoint override.

Cron Job Fallback

Cron jobs inherit the configured fallback_providers chain (or legacy fallback_model) when they create an agent. You can override the provider and model for a specific cron job by setting provider and model parameters in the cron job definition.

Cache and Cost Implications

Fallback resets the prompt cache. The next request after a fallback re-reads the entire conversation history at full input-token price, losing the approximately 75-90% cached rate discount. When the turn ends and the primary model is restored, the first request back on primary is also a full re-read unless the primary's cache TTL has not expired. Long sessions that bounce between providers can cost noticeably more than staying with a single provider.

Legacy Configuration

The fallback_model parameter is a legacy single fallback key. It is still honored for backward compatibility, but fallback_providers takes priority when both are set. Running hermes fallback writes the current fallback_providers key and migrates legacy config on write.

Legacy configs with compression.summary_model, compression.summary_provider, and compression.summary_base_url are automatically migrated to auxiliary.compression.* on first load (config version 17).

Troubleshooting

  • If fallback does not activate when expected, check that the error matches the trigger conditions listed in "When Fallback Activates".
  • If a custom endpoint fallback fails, verify that base_url points to a running OpenAI-compatible endpoint and that key_env references an environment variable that is set.
  • If auxiliary task fallback does not trigger for daily-quota exhaustion, check the exact error string from the provider. If it is a different phrase, open an issue.
  • If compression fails and no provider is available, Hermes drops middle conversation turns without generating a summary. This is graceful degradation and does not fail the session.
  • If you see Auxiliary <task>: ... all fallbacks exhausted at WARNING level, all fallback layers for that auxiliary task have been exhausted. The original error is re-raised.

Sources & References

This page was researched from 1 independent source, combined and verified for completeness.

Newsletter

The #1 AI Newsletter

The most important ai updates, guides, and fixes — one weekly email.

No spam, unsubscribe anytime. Privacy policy

Other Hermes Agent integrations