AIdeazz Blog About Portfolio

AI Agent Restart Discrepancies: Stability vs. Relentless Recovery

· by

My PM2-supervised AI agents show a wide range of restart counts, from 0 to 55193. This isn't just a metric; it's a direct indicator of system stability and, critically, how much hidden work goes into keeping an agent "online." The algom-stream process, for example, has restarted 55193 times over 33 days. In contrast, algom-poll has 0 restarts over 52 days, and n8n also has 0 restarts over 36 days. This discrepancy forces a re-evaluation of what "online" truly means for an AI agent in production.

The 55193-Restart Agent: algom-stream

The algom-stream agent is a case study in relentless recovery. With 55193 restarts in 33 days, it's effectively a process that fails and restarts almost constantly. Its memory usage is 53 MB, which isn't particularly high. This high restart count suggests a fundamental instability, likely an unhandled exception or a resource contention issue that PM2 is diligently masking. While PM2 keeps it "online," the underlying problem is never resolved, only reset. This creates a false sense of security; the service is technically available, but its operational efficiency and reliability are severely compromised. I do not have logs for algom-stream measured in the evidence, so the specific cause of these restarts remains unpinned.

The Moderately Restarted Agents: cto-aipa and serpapi-jobs

Other agents exhibit moderate restart counts. cto-aipa has 152 restarts, but it's only been up for 0 days. This indicates a recent deployment or a period of intense instability followed by a restart of the PM2 daemon itself. Its memory usage is 188 MB. The serpapi-jobs agent has 22 restarts over 1 day, using 35 MB of memory. These numbers, while not as extreme as algom-stream, still point to intermittent issues. For cto-aipa, the NOW.md file, which serves as working memory for Cursor and Claude Code, highlights the challenge of fragmented AI agent communication. The file explicitly states: "Cursor Cloud, Cursor Desktop and Claude Code all work this repo and none of them can see each other's chats." This lack of shared context could contribute to unexpected states and subsequent restarts if agents are making assumptions about the system's state that are not globally consistent.

The Stable Agents: algom-poll and n8n

On the other end of the spectrum, algom-poll and n8n demonstrate remarkable stability. algom-poll has 0 restarts over 52 days, consuming 72 MB. n8n also has 0 restarts over 36 days, with 500 MB memory usage. These agents represent the ideal state for production systems: long uptime without interruption. Their stability suggests robust error handling, predictable external dependencies, or simpler operational logic that is less prone to failure. The cita-sort.log shows cita-sort OK messages, indicating successful operations without issues, which aligns with the stability observed in some agents.

Implications for AI Agent Development and Monitoring

The wide range of AI agent restart discrepancies highlights several critical points for development and monitoring:

1. "Online" is not "Healthy": A process being listed as "online" by PM2 does not guarantee it's operating efficiently or without underlying issues. A high restart count, like algom-stream's 55193, indicates a system that is constantly failing and recovering, which consumes resources and can lead to data inconsistencies or missed operations.
2. Log Granularity is Key: Without detailed logs for agents like algom-stream, diagnosing the root cause of frequent restarts is impossible. My wiki-ship.log shows "error: failed to push some refs to 'https://github.com/ElenaRevicheva/aideazz.git'" repeatedly, which is a clear error message. Similar clarity is needed for all agents.
3. Proactive vs. Reactive Monitoring: Relying solely on PM2's restart mechanism is reactive. While it prevents total service outages, it doesn't address the underlying instability. Proactive monitoring should track restart rates, memory usage patterns, and application-specific health checks beyond just process status. The concierge-selftest.log shows ✅ PASS — 4 checks, 3102ms to first card, which is an example of a good application-level health check.
4. Agent Communication and State Management: For multi-agent systems, the NOW.md file's description of fragmented communication between Cursor and Claude Code is a critical insight. If agents cannot share context, they might operate on stale or incorrect assumptions, leading to errors and restarts. This underscores the need for robust inter-agent communication protocols or shared, consistent state.

Addressing Restart Discrepancies

My immediate action items involve deeper investigation into the highly restarting agents. For algom-stream, I need to implement comprehensive logging to capture the specific errors causing its 55193 restarts. This might involve adding more try-catch blocks, detailed error messages, and perhaps integrating with a centralized logging system. For cto-aipa, given its recent 152 restarts and the NOW.md context, I need to review its interaction patterns and state management to ensure it's not encountering race conditions or inconsistent data due to fragmented agent communication. The VibeJobHunterAIPA_AIMCF repository has seen 3 commits in the last 48 hours, indicating active development, which could also contribute to recent instability if changes introduce new bugs.

The goal is not just to reduce restart counts but to understand why they are happening. A stable system, like algom-poll with 0 restarts over 52 days, is one where failures are either gracefully handled internally or are so rare that they don't trigger a process restart. This is the standard I aim for across all my AI agents.

Frequently Asked Questions

Q: Does a high restart count always mean a problem?
A: Not always a complete outage, but it indicates instability. For algom-stream with 55193 restarts in 33 days, it means the process is constantly failing and being brought back up, which consumes resources and can lead to missed operations or data inconsistencies.

Q: How do you diagnose the cause of frequent restarts?
A: The primary method is detailed logging. For agents like algom-stream where I do not have specific logs measured, I need to implement more granular error logging to capture the exact exceptions or conditions leading to the restarts.

Q: What is the impact of fragmented AI agent communication on restarts?
A: If agents like Cursor and Claude Code cannot share context, as described in NOW.md, they might operate on outdated or inconsistent information. This can lead to logic errors, unexpected states, and subsequent process crashes that trigger restarts.

Q: Are there any agents that never restart?
A: Yes, algom-poll has 0 restarts over 52 days and n8n has 0 restarts over 36 days. These agents demonstrate robust stability, likely due to effective error handling and predictable operational environments.

— Elena Revicheva · AIdeazz · Portfolio