{
  "_comment": "Fallback Chain Configuration - Global defaults for model fallback chains",
  "_docs": "See .agents/tools/ai-assistants/fallback-chains.md for full documentation",

  "chains": {
    "_comment": "Per-tier fallback chains. Anthropic ONLY. Never use openrouter, openai, or google providers for worker dispatch.",

    "haiku": [
      "anthropic/claude-haiku-4-5"
    ],
    "flash": [
      "anthropic/claude-haiku-4-5"
    ],
    "sonnet": [
      "anthropic/claude-sonnet-4-6"
    ],
    "pro": [
      "anthropic/claude-sonnet-4-6"
    ],
    "opus": [
      "anthropic/claude-opus-4-6"
    ],
    "coding": [
      "anthropic/claude-opus-4-6",
      "anthropic/claude-sonnet-4-6"
    ],
    "eval": [
      "anthropic/claude-sonnet-4-6"
    ],
    "health": [
      "anthropic/claude-sonnet-4-6"
    ],

    "default": [
      "anthropic/claude-sonnet-4-6"
    ]
  },

  "triggers": {
    "_comment": "Trigger configuration. Each trigger type can be enabled/disabled with custom cooldown.",

    "api_error": {
      "enabled": true,
      "cooldown_seconds": 300,
      "description": "Provider returned 5xx or connection failure"
    },
    "timeout": {
      "enabled": true,
      "cooldown_seconds": 180,
      "description": "Request exceeded timeout threshold"
    },
    "rate_limit": {
      "enabled": true,
      "cooldown_seconds": 60,
      "description": "Provider returned 429 (rate limited)"
    },
    "auth_error": {
      "enabled": true,
      "cooldown_seconds": 3600,
      "description": "Provider returned 401/403 (key invalid or expired)"
    },
    "overloaded": {
      "enabled": true,
      "cooldown_seconds": 120,
      "description": "Provider returned 529 (overloaded)"
    }
  },

  "gateways": {
    "_comment": "Gateway provider configuration for provider-level fallback routing",

    "openrouter": {
      "enabled": false,
      "endpoint": "https://openrouter.ai/api/v1",
      "key_env_var": "OPENROUTER_API_KEY",
      "description": "OpenRouter - multi-provider gateway with unified API"
    },
    "cloudflare": {
      "enabled": false,
      "account_id": "YOUR_CF_ACCOUNT_ID_HERE",
      "gateway_id": "YOUR_CF_GATEWAY_ID_HERE",
      "key_env_var": "CF_AIG_TOKEN",
      "description": "Cloudflare AI Gateway - caching, rate limiting, analytics"
    }
  },

  "settings": {
    "max_chain_depth": 5,
    "default_cooldown_seconds": 300,
    "probe_timeout_seconds": 10,
    "log_retention_days": 30
  }
}
