AIdeazz Blog About Portfolio

AI Agent Restart Patterns: From Zero to 55193 in Production

· by

My production environment currently shows 8 AI agents online, supervised by PM2. This looks healthy on the surface, but a deeper look at their restart counts reveals a spectrum of stability, from perfect uptime to catastrophic loops. Understanding these AI Agent Restart Patterns is critical for anyone shipping production AI.

The Zero-Restart Agents: Quiet Stability

Two of my agents, algom-poll and n8n, show 0 restarts. algom-poll has been up for 47 days, consuming 72 MB of memory. n8n has been up for 31 days, using 500 MB. These are the ideal cases. They perform their tasks without interruption, indicating robust code, stable dependencies, and predictable resource usage. For algom-poll, its log shows consistent cita-sort OK messages, with 0 cards repositioned across 3 boards, hourly. This suggests a steady, uneventful operation.

The Low-Restart Agents: Minor Glitches or Planned Maintenance

Most of my agents fall into the low-restart category, with counts ranging from 1 to 21.

These low restart counts often indicate either minor, self-correcting issues, or planned restarts for deployments. My git log shows 2 commits in the last 48 hours, specifically 51158b3 and b5cc107 on 2026-09-12 and 2026-09-11 respectively, related to ai-ops-wiki surfaces. These deployments could account for some of the restarts if agents were updated.

The Moderate-Restart Agent: cto-aipa

The cto-aipa agent stands out with 151 restarts, but has only been up for 1 day, consuming 211 MB. This is a significant number of restarts in a short timeframe. 151 restarts in 1 day means it's restarting roughly every 9.5 minutes. This pattern suggests a recurring, non-fatal error that PM2 is configured to handle by restarting the process.

The NOW.md file, which serves as a shared session between Cursor and Claude Code, mentions: "Cursor Cloud, Cursor Desktop and Claude Code all work this repo and none of them can see each other's chats. No shared conversation, no Claude MCP in Cursor, no way to send the other agent a message. The only things all of them read are HubSpot and this So this file is not documentation. It is the working memory of whichever agent is not currently running, and the protocol below is how two agents that cannot talk avoid". This fragmented communication could be a source of instability if cto-aipa relies on state that is not consistently shared or synchronized, leading to crashes. The followup-radar.log shows email processing, with 245 inbox items for imap.zoho.com and 661 for imap.gmail.com, suggesting cto-aipa is actively working with external services. Failures in these external interactions could trigger restarts.

The High-Restart Agent: algom-stream

Despite this, PM2 reports it as "online." This highlights a critical distinction: "online" does not mean "healthy" or "functional." It simply means the process manager is attempting to keep the process running. The low memory usage (53 MB) might suggest it's crashing before it can consume significant resources, or it's a very lightweight process that quickly re-initializes.

Implications for AI Agent Operations

These varied AI Agent Restart Patterns reveal different classes of operational issues:

1. Zero Restarts: Indicates robust, stable agents. Focus on monitoring for performance degradation or unexpected log entries.
2. Low Restarts (1-21): Suggests minor, transient issues or planned deployments. Review logs for error messages around restart times.
3. Moderate Restarts (151 in 1 day): Points to a recurring problem that the agent can't recover from gracefully without a full restart. This requires deeper investigation into the specific code path causing the failure.
4. High Restarts (55193 in 28 days): This is a critical failure mode. The agent is effectively non-functional, even if PM2 reports it as "online." Immediate debugging is required to identify the root cause of the continuous crash.

The wiki-ship.log shows "error: failed to push some refs to 'https://github.com/ElenaRevicheva/aideazz.git'" repeatedly. While not directly tied to agent restarts, it indicates other operational issues in my system that could indirectly affect agent stability if deployments are failing or code is not being updated correctly.

Frequently Asked Questions

Q: Does PM2's "online" status mean an AI agent is working correctly?
A: No. As seen with algom-stream having 55193 restarts while "online," PM2 only indicates the process manager is attempting to keep the process running. It does not guarantee the application logic is executing successfully or producing valid output.

Q: How do you differentiate between a planned restart and an error-induced restart?
A: Planned restarts typically correlate with deployment events (like the 2 commits in the last 48 hours) or scheduled maintenance. Error-induced restarts show specific error messages in application logs immediately preceding the restart, often in a recurring pattern.

Q: What's the first step when an AI agent shows 55193 restarts?
A: Immediately check the agent's specific application logs for the exact error message causing the crash. This high restart count indicates a fundamental, unhandled exception or resource issue that needs to be addressed directly in the code or environment configuration.

Q: Is 151 restarts in 1 day acceptable for an AI agent?
A: No, 151 restarts in 1 day is not acceptable. It points to a recurring issue that is significantly impacting the agent's uptime and potentially its ability to complete tasks, even if it eventually recovers. This pattern warrants investigation to improve stability.

— Elena Revicheva · AIdeazz · Portfolio