Hermes Agent Fallback Providers: Staying Up When a Provider Fails
Configure Hermes Agent to automatically switch providers when your primary model 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_providerslist. - Legacy single fallback:
fallback_modelstill honored for backward compatibility. - Custom OpenAI-compatible endpoint fallback: With
base_urland optionalkey_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_chainfor slower fallback candidates. - Subagent delegation: Inherits parent fallback chain; optional provider/model override.
- Cron jobs: Inherit configured
fallback_providerschain; 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 ofconfig.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_urland optionallykey_env - For auxiliary tasks: at least one provider configured if using
auto - For delegation override: a
delegation:section inconfig.yaml - For cron job override: a cron job definition with
providerandmodelparameters
Configuration Procedures
Configure Primary Fallback Chain via Interactive Manager
- Run
hermes fallbackto open the interactive manager. - Use the subcommands:
add,list(aliasls),remove(aliasrm),clearto manage the chain. - Changes persist under the top-level
fallback_providers:list inconfig.yaml.
Configure Primary Fallback Chain via Direct YAML Edit
- Open
~/.hermes/config.yaml. - Add a top-level
fallback_providerslist. - Each entry requires both
providerandmodel; entries missing either are ignored.
Example:
fallback_providers:
- provider: openrouter
model: anthropic/claude-sonnet-4
Configure Custom Endpoint Fallback
- In the
fallback_providerslist, setprovider: custom. - Set
modelto the desired model name. - Set
base_urlto the endpoint URL (e.g.,http://localhost:8000/v1). - Optionally set
key_envto 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
- In
config.yaml, under theauxiliary:section, setproviderfor the task (e.g.,vision: provider: auto). - Optionally set
model,base_url,api_keyfor the task. - Optionally set
fallback_chainfor the task (a list ofprovider:modelentries). - Each
fallback_chainentry may also declare its owntimeoutin 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
- In
config.yaml, under thedelegation:section, setproviderandmodelfor all subagents. - Optionally set
base_urlandapi_keyfor 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
- In the cron job definition, set
providerandmodelparameters. - Cron jobs inherit the configured
fallback_providerschain by default.
Example:
cron:
my_job:
schedule: "0 6 * * *"
provider: openrouter
model: anthropic/claude-sonnet-4
Parameters
| Parameter | Meaning | Required |
|---|---|---|
fallback_providers | Top-level list of fallback provider:model pairs tried in order when primary fails | No (optional; if absent, no cross-provider fallback) |
fallback_model | Legacy single fallback key; still honored for backward compatibility but fallback_providers takes priority when both are set | No (legacy) |
provider | The provider identifier (e.g., openrouter, nous, anthropic, custom) | Yes for each entry in fallback_providers and fallback_chain |
model | The model identifier (e.g., anthropic/claude-sonnet-4) | Yes for each entry in fallback_providers; optional in fallback_chain entries |
base_url | Custom OpenAI-compatible endpoint URL; overrides provider resolution | No (optional; for custom endpoints or direct endpoint override) |
key_env | Environment variable name containing the API key for custom endpoint | No (optional; for custom endpoints) |
api_key | API key for direct endpoint override in auxiliary tasks | No (optional; falls back to OPENAI_API_KEY if not set) |
timeout | Per-entry timeout in seconds for a fallback candidate in fallback_chain | No (optional; if absent, inherits task-level timeout) |
auxiliary.<task>.provider | Provider for the auxiliary task (auto, openrouter, nous, codex, main, anthropic, etc.) | No (default: auto) |
auxiliary.<task>.model | Model for the auxiliary task | No (optional) |
auxiliary.<task>.fallback_chain | Task-specific fallback policy list; overrides main fallback chain for that task | No (optional; if omitted, main fallback chain is used) |
delegation.provider | Override provider for all subagents spawned by delegate_task | No (optional) |
delegation.model | Override model for all subagents | No (optional) |
cronjob provider | Per-job provider override for cron agents | No (optional) |
cronjob model | Per-job model override for cron agents | No (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.yamlorhermes fallback. - Config shape:
fallback_providers(plural, list) is the current config shape;fallback_model(singular) is legacy. When both are set,fallback_providerstakes priority. Runninghermes fallbackwrites the currentfallback_providerskey and migrates legacy config on write. - Entry validation: Entries in
fallback_providersmissing eitherproviderormodelare ignored. - Provider
main: NOT a valid value for top-levelmodel.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_urlprecedence: For auxiliary tasks,base_urltakes precedence overprovider.- API key handling: Hermes does NOT reuse
OPENROUTER_API_KEYfor custom endpoints. It uses the configuredapi_keyor falls back toOPENAI_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_providerschain (or legacyfallback_model) when they create an agent. - Legacy config migration: Legacy configs with
compression.summary_model/compression.summary_provider/compression.summary_base_urlare automatically migrated toauxiliary.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 exhaustedat 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_urlpoints to a running OpenAI-compatible endpoint and thatkey_envreferences 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 exhaustedat 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.
- 1.Fallback ProvidersOfficial documentation · primary source
The #1 AI Newsletter
The most important ai updates, guides, and fixes — one weekly email.
No spam, unsubscribe anytime. Privacy policy