Skip to content
Conduit

skill

openclaw-model-failover-guard

Set up

Skills are installed by placing their folder where your agent loads skills.

The download comes from github.com/BovmantH/openclaw-model-failover-guard itself, not from our server, so what you get is exactly what its author published.

Install instructions come from the README

Skills do not use an MCP config. Follow the steps in the README below.

README

synced Oct 23, 2026

OpenClaw Model Failover Guard

English | 中文

flowchart LR
  A[Primary Model Healthy] -->|Check Interval| B{Primary Failures >= Threshold?}
  B -->|No| A
  B -->|Yes| C[Build Candidate Pool]
  C --> D[Filter: allowlist / excluded / cooldown / compatibility]
  D --> E[Probe Candidates]
  E -->|Any Healthy| F[Switch + Restart Gateway]
  E -->|None Healthy| A
  F --> G{Fallback Stable >= Recover Threshold?}
  G -->|No| F
  G -->|Yes| H[Probe Primary + Failback]
  H -->|Success| A
  H -->|Fail| F

English

Skill name: model-failover-guard

Keywords: openclaw skill, model failover, automatic failback, model routing, reliability, high availability

Automatic model failover + failback guard for OpenClaw.

This guard performs model failover and failback. It does not adapt request payloads across heterogeneous providers. Use only pre-validated compatible fallback candidates.

When your primary model becomes unstable, this guard can switch to an available fallback model automatically, then switch back to the primary after stability is restored.

Overview

  • Monitor model health on an interval
  • If primary fails N times consecutively → failover
  • Build a candidate pool (prefer allowedFallbacks if set)
  • Filter by excluded providers, cooldown, and compatibility rules
  • Probe candidates before switching (optional)
  • After fallback is stable for N checks → probe primary and try failback
  • If failback test fails → revert to fallback and apply primary cooldown

Install

npx skills add BovmantH/openclaw-model-failover-guard --skill model-failover-guard

Files

PathPurpose
skills/model-failover-guard/SKILL.mdSkill definition
skills/model-failover-guard/config.example.jsonConfig template
skills/model-failover-guard/scripts/failover.pyRuntime guard script

Config

Copy config.example.json to config.json.

KeyDescription
primaryModelOptional. Empty = use OpenClaw current default model
preferredFallbackProviderOptional preferred fallback provider
excludedProvidersProviders excluded from fallback candidates
allowedFallbacksOptional allowlist of fallback models
compatibilityOptional compatibility rules (API / reasoning / tools / streaming)
candidateProbeProbe candidates before switching
failbackProbeProbe primary before failback
candidateCooldownCooldown durations for failed candidates
primaryCooldownSecCooldown after failed failback
failoverOnErrorsError types that can trigger failover
ignoreErrorsError types that should never trigger failover
failThresholdConsecutive failures before failover
recoverThresholdStable checks before failback
checkIntervalSecHealth check interval (seconds)
testTimeoutSecSingle test timeout (seconds)

Run

python3 skills/model-failover-guard/scripts/failover.py once
python3 skills/model-failover-guard/scripts/failover.py loop

State & Logs

  • State: ~/.openclaw/failover-state.json
  • Log: ~/.openclaw/failover.log

Run as Systemd Service (Linux)

Install service

mkdir -p ~/.config/systemd/user
cp skills/model-failover-guard/openclaw-model-failover.service ~/.config/systemd/user/
systemctl --user daemon-reload

Enable & Start

systemctl --user enable --now openclaw-model-failover

Logs

journalctl --user -u openclaw-model-failover -f

FAQ

Q: Failback to primary is not happening. What should I do?
A: Check ~/.openclaw/failover.log. You can also run python3 skills/model-failover-guard/scripts/failover.py once manually.

Q: Log file is too large.
A: Rotate/clean periodically. Example: echo "" > ~/.openclaw/failover.log

Q: How to stop the guard completely?
A: systemctl --user stop openclaw-model-failover (if using systemd), or kill the process.

Q: Can I run multiple instances?
A: Not recommended. Run only one instance per machine.


中文

flowchart LR
  A[主模型健康] -->|按间隔检查| B{连续失败达到阈值?}
  B -->|否| A
  B -->|是| C[构建候选池]
  C --> D[过滤:白名单/排除/冷却/兼容性]
  D --> E[探测候选]
  E -->|有健康候选| F[切换并重启 Gateway]
  E -->|无健康候选| A
  F --> G{兜底稳定达到切回阈值?}
  G -->|否| F
  G -->|是| H[探测主模型并切回]
  H -->|成功| A
  H -->|失败| F

这是一个 OpenClaw 模型自动故障切换 + 自动切回守护技能。

该守护器只负责 failover / failback,不会自动适配不同 provider 的请求协议。请只使用已验证兼容的兜底候选。

当主模型不稳定时,守护进程会自动切换到可用的兜底模型,并在稳定后自动尝试切回主模型。

概览

  • 按固定间隔检测模型健康
  • 主模型连续失败 N 次后触发故障切换
  • 构建候选池(优先使用 allowedFallbacks)
  • 过滤:排除 provider / 冷却 / 兼容性规则
  • 切换前可探测候选
  • 兜底稳定 N 次后探测主模型并尝试切回
  • 切回失败会回退兜底并进入主模型冷却

安装

npx skills add BovmantH/openclaw-model-failover-guard --skill model-failover-guard

文件

路径用途
skills/model-failover-guard/SKILL.md技能定义
skills/model-failover-guard/config.example.json配置模板
skills/model-failover-guard/scripts/failover.py运行脚本

配置

复制 config.example.json 为 config.json。

键说明
primaryModel可选;空则使用 OpenClaw 当前默认主模型
preferredFallbackProvider可选的优先兜底 provider
excludedProviders不参与兜底的 provider 列表
allowedFallbacks可选;兜底模型白名单
compatibility可选;兼容性规则(API/推理/工具/流式)
candidateProbe切换前候选探测
failbackProbe切回前主模型探测
candidateCooldown候选失败后的冷却时间
primaryCooldownSec切回失败后的主模型冷却
failoverOnErrors允许触发 failover 的错误类型
ignoreErrors明确不触发 failover 的错误类型
failThreshold触发故障切换的连续失败阈值
recoverThreshold触发切回主模型的稳定检查阈值
checkIntervalSec健康检查间隔(秒)
testTimeoutSec单次测试超时(秒)

运行

python3 skills/model-failover-guard/scripts/failover.py once
python3 skills/model-failover-guard/scripts/failover.py loop

状态与日志

  • 状态:~/.openclaw/failover-state.json
  • 日志:~/.openclaw/failover.log

作为 Systemd 服务运行(Linux)

安装服务

mkdir -p ~/.config/systemd/user
cp skills/model-failover-guard/openclaw-model-failover.service ~/.config/systemd/user/
systemctl --user daemon-reload

启用并启动

systemctl --user enable --now openclaw-model-failover

查看日志

journalctl --user -u openclaw-model-failover -f

常见问题

问:切不回主模型怎么办?
答:检查 ~/.openclaw/failover.log,也可以手动运行 python3 skills/model-failover-guard/scripts/failover.py once。

问:日志文件太大怎么办?
答:定期清理或用 logrotate。例如:echo "" > ~/.openclaw/failover.log

问:如何完全停止守护?
答:如果用了 systemd,执行 systemctl --user stop openclaw-model-failover,或直接 kill 进程。

问:可以同时跑多个实例吗?
答:不建议,同一台机器只跑一个实例。


License

MIT License · Copyright © 2026 BovmantH

See LICENSE for full text.

↑↓ navigate openesc close