Skip to main content

Overview

Genie Helper runs multiple services managed by PM2 (Process Manager 2). This guide covers monitoring service health, analyzing logs, and debugging common issues.

Service Architecture

PM2 Quick Reference

Check Service Status

Restart Services

View Logs

Start/Stop Services

Log Analysis

AnythingLLM Logs

What to look for:
  • MCP server boot messages
  • Agent tool execution
  • WebSocket connection status
  • LLM inference timing
  • Action Runner intercepts
Common errors:

Media Worker Logs

What to look for:
  • BullMQ job processing
  • Stagehand session status
  • FFmpeg/ImageMagick output
  • Platform scrape results
  • HITL session creation
Common errors:

Directus Logs

What to look for:
  • API request errors
  • Database connection issues
  • Flow execution status
  • File upload errors
  • RBAC sync webhook calls
Common errors:

Stagehand Logs

What to look for:
  • Browser session creation
  • Navigation timing
  • Cookie injection status
  • Screenshot captures
  • Page interaction errors
Common errors:

Service Health Checks

Manual Health Checks

Expected Responses

Common Issues & Solutions

High Memory Usage

Symptoms:
  • pm2 status shows high memory
  • System becomes sluggish
  • Services crash with OOM errors
Diagnosis:
Solutions:
  • Restart memory-heavy service: pm2 restart anything-llm
  • Check for memory leaks in logs
  • Reduce concurrent Stagehand sessions
  • Upgrade server RAM (current ceiling: ~33 concurrent browser sessions)

Slow LLM Response

Symptoms:
  • Chat responses take >30 seconds
  • Agent actions timeout
  • First token delay excessive
Diagnosis:
Solutions:
  • Current setup: CPU-only inference, dolphin3:8b stalls
  • Workaround: Use qwen-2.5:latest (33s first token acceptable)
  • Long-term: Upgrade to GPU-enabled VPS
  • Check: Ollama service not overloaded

MCP Server Not Starting

Symptoms:
  • Agent can’t use tools
  • “Tool not found” errors
  • MCP connection failures
Diagnosis:
Solutions:
  1. Check MCP config exists:
  2. Verify MCP scripts exist:
  3. Check Node.js version:
  4. Restart AnythingLLM:

Stagehand Session Stuck

Symptoms:
  • Scrape jobs never complete
  • “Browser session timeout” errors
  • Memory usage climbs over time
Diagnosis:
Solutions:
  1. Restart Stagehand:
  2. Check browser process:
  3. Review session management in media-worker logs
  4. Implement session timeout in job processing

Dashboard Not Updating

Symptoms:
  • Code changes not reflected
  • Old version still serving
  • 404 on new routes
Solutions:

HITL Sessions Not Created

Symptoms:
  • No yellow banner on dashboard
  • Scrape fails silently
  • No entries in hitl_sessions
Diagnosis:
Solutions:
  1. Check platform_sessions for existing cookies:
  2. Verify media-worker detecting missing cookies
  3. Check Directus permissions on hitl_sessions collection
  4. Review system prompt includes HITL instructions

Performance Monitoring

CPU Usage

Normal CPU usage:
  • Idle: Less than 5% total
  • LLM inference: 80-100% single core, 2-5 seconds
  • FFmpeg clip: 80-100% single core, approximately 30 seconds
  • Stagehand session: 20-40% per active browser

Disk Space

Cleanup:

Network Monitoring

Debugging Workflows

Debug LLM Agent Issues

1

Check agent logs

2

Verify MCP tools available

Check boot sequence for MCP server initialization
3

Test tool manually

Use AnythingLLM UI (localhost:3001) to test tool directly
4

Review Action Runner

Check agent_audits collection for execution logs
5

Check system prompt

Verify workspace prompt includes required instructions

Debug Media Processing

1

Check job queue

2

Verify BullMQ jobs

Check media_jobs collection in Directus for job status
3

Test FFmpeg/ImageMagick

Run commands manually to isolate issue
4

Check file permissions

Ensure media-worker can read/write storage directory
5

Review Stagehand session

Check session cleanup, screenshot captures

Debug Platform Scraping

1

Check platform sessions

Verify cookies exist in platform_sessions collection
2

Test cookie freshness

Cookies expire, may need HITL re-authentication
3

Review Stagehand logs

Check navigation, selectors, timeout errors
4

Check HITL flow

If cookies missing, verify HITL session created
5

Test manually

Use browser to verify platform accessible, not blocking

Alerting & Notifications

Alerting system not yet implemented. Consider adding:
  • Service down alerts: Email/SMS when PM2 process crashes
  • Disk space warnings: Alert at 80% capacity
  • Memory thresholds: Alert when service exceeds limits
  • Job failures: Notify when BullMQ jobs fail repeatedly
  • HITL requests: Alert admin when human intervention needed

Admin Access

For direct service access:
Change these credentials before public launch