model-watchdog

Tools & Infrastructure 💻 Python 🟡 Quiet lately
2 stars

model-watchdog is a zero-dependency Python tool that monitors an AI agent's health endpoint and automatically rolls back configuration changes if the agent starts failing, then restarts the service. It solves the problem of agent downtime caused by bad config changes, and is for developers running AI agents or services with HTTP health checks and config files.

✨ Key features

  • Auto-rollback on repeated health check failures
  • Saves last known good config backup
  • Restarts service after rollback
  • Alerts via Telegram, Slack, Discord, or webhook
  • Zero dependencies, single Python file
  • Supports JSON and optional YAML config

🎯 Use cases

  • Monitor and auto-recover AI agent config changes
  • Prevent prolonged downtime from bad model upgrades
  • Integrate health checks into CI with one-shot mode
  • Run as a systemd service for 24/7 monitoring

📦 Installation

🧰 Requirements: Python 3.8+; no external dependencies required, optional pyyaml for YAML config.

# Clone the repository
git clone https://github.com/feralghost/model-watchdog.git
cd model-watchdog

# No installation needed; run directly with Python 3.8+

🚀 Usage

Probe http://localhost:18789/health every 30s · Roll back after 3 failures in 3 minutes
python3 watchdog.py
Custom config
python3 watchdog.py --config watchdog.yaml
One-shot health check (for CI/scripts)
python3 watchdog.py --check-once

❓ FAQ

What happens when the agent fails health checks?

After K failures within M minutes, it rolls back the config to the last known good backup and restarts the service.

How does it decide what is a 'good' config?

When the agent is healthy after a config change, it saves the current config as the 'good backup'.

Can I use it with services other than OpenClaw?

Yes, it works with any AI agent or service that has an HTTP health endpoint and a config file plus restart command.

Does it require any external dependencies?

No, it uses only the Python standard library. Optionally, you can install pyyaml for YAML config support.

📊 Repository

Stars★ 2
Forks🍴 1
Open issues🐛 0
Last commit🕒 Mar 15, 2026
Created📅 Mar 2026
Language💻 Python

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.