Running AI Agents 24/7 on a Home Server
Running AI Agents 24/7 on a Home Server
Cloud hosting is convenient until you see the bill. Running AI agents 24/7 on a home server - a Mac Mini, an old laptop, or a dedicated machine - costs a fraction of what cloud instances charge. But keeping agents reliably running requires solving three problems: power, crashes, and monitoring.
Power Management
Your server needs to survive power outages gracefully. A basic UPS (uninterruptible power supply) gives you 10-15 minutes of runtime during an outage - enough time to save state and shut down cleanly.
Configure your OS to trigger a graceful shutdown when the UPS reports low battery. On macOS, Energy Saver settings can auto-boot after power loss. On Linux, set restart policies in systemd.
The goal is simple: power goes out, agents save their state. Power comes back, agents resume automatically.
Crash Recovery
Agents crash. Models run out of memory. Network connections drop. Your crash recovery strategy determines whether you wake up to a working system or a pile of error logs.
Essential patterns:
- Process supervisors - Use systemd, launchd, or PM2 to auto-restart crashed agent processes. Set a restart delay of 5-10 seconds to avoid tight crash loops.
- State checkpointing - Save agent progress to disk every N steps. When an agent restarts, it picks up from the last checkpoint instead of starting over.
- Health checks - A simple script that pings each agent process every 60 seconds. If an agent is unresponsive for 3 checks, kill and restart it.
- Memory limits - Set hard memory caps per agent. Better to restart one agent than let it OOM-kill the whole system.
Monitoring Without Overengineering
You do not need Grafana and Prometheus for a home server. A cron job that checks process status and writes to a log file works fine. Send yourself a notification (email, Telegram, webhook) if an agent has been down for more than 5 minutes.
Check disk space weekly. Agent logs grow fast and a full disk is the most common cause of silent failures.
Keep it simple. A well-configured home server runs for months without intervention.
Fazm is an open source macOS AI agent. Open source on GitHub.