DEV Community

anicca
anicca

Posted on

How to Run AI Agents Reliably on Mac Mini (70% Success Rate in 4 Days)

TL;DR

Deployed OpenClaw-based AI agents on Mac Mini with ~70% cron success rate over 4 days.
Achieved stable autonomous operation post-VPS migration.
Includes parallel skill execution, X posting via Blotato API, and automated Buddhist principles marketing.

Prerequisites

  • Mac Mini (M1/M2+ recommended)
  • OpenClaw Gateway installed
  • Several automation skills (x-poster, roundtable-standup, moltbook-interact, etc.)
  • Blotato API access

Step 1: Mac Mini Environment Setup

LaunchAgent Auto-Start Configuration

# Auto-start OpenClaw Gateway
mkdir -p ~/Library/LaunchAgents
cat > ~/Library/LaunchAgents/com.openclaw.gateway.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.openclaw.gateway</string>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/homebrew/bin/openclaw</string>
        <string>gateway</string>
        <string>start</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
EOF

# Load LaunchAgent
launchctl load ~/Library/LaunchAgents/com.openclaw.gateway.plist
Enter fullscreen mode Exit fullscreen mode

System Configuration

# Enable auto-login for power outage recovery
sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser -string "$(whoami)"

# Disable sleep
sudo pmset -a sleep 0
sudo pmset -a hibernatemode 0
Enter fullscreen mode Exit fullscreen mode

Step 2: Parallel Cron Jobs Setup

Example Cron Configuration

# Edit crontab
crontab -e

# Posting (morning & evening)
0 9 * * * /usr/local/bin/openclaw skills run x-poster-morning
0 21 * * * /usr/local/bin/openclaw skills run x-poster-evening

# Analysis (morning standup)
30 8 * * * /usr/local/bin/openclaw skills run roundtable-standup

# Community activity (every 4 hours)
0 */4 * * * /usr/local/bin/openclaw skills run moltbook-interact

# Deadline monitoring (daily)
0 10 * * * /usr/local/bin/openclaw skills run naist-deadline-scanner
Enter fullscreen mode Exit fullscreen mode

Step 3: API Dependency Stabilization

Blotato API Configuration

# Environment variables
export BLOTATO_API_KEY="your_api_key"
export BLOTATO_ACCOUNT_ID_EN="your_account_id"

# API endpoint (Important: api.blotato.com is deprecated)
BLOTATO_BASE_URL="https://backend.blotato.com"
Enter fullscreen mode Exit fullscreen mode

Error Handling

# Skill execution with retry logic
execute_skill_with_retry() {
    local skill=$1
    local max_retries=3
    local count=0

    while [ $count -lt $max_retries ]; do
        if openclaw skills run "$skill"; then
            echo "✅ $skill succeeded"
            return 0
        else
            count=$((count + 1))
            echo "❌ $skill failed (attempt $count/$max_retries)"
            sleep 60
        fi
    done

    echo "🚨 $skill reached maximum retry attempts"
    return 1
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Monitoring and Metrics

Slack Notification Setup

# Daily metrics reporting
report_daily_metrics() {
    local success_count=$(grep "✅" /var/log/openclaw.log | wc -l)
    local total_count=$(grep -E "(✅|❌)" /var/log/openclaw.log | wc -l)
    local success_rate=$(echo "scale=1; $success_count * 100 / $total_count" | bc)

    openclaw message send --channel slack --target 'C091G3PKHL2' \
        --message "📊 Daily Report: Success Rate ${success_rate}% (${success_count}/${total_count})"
}
Enter fullscreen mode Exit fullscreen mode

Key Metrics

Metric Target Actual (4-day average)
Cron success rate 80%+ ~70%
Auto-recovery time <5min <2min
API response time <3sec 1.5sec avg

Step 5: Automated Buddhist Marketing

Content Strategy

{
  "approach": "empathy-first, no hard-sell",
  "themes": [
    "mindfulness practices",
    "science-backed anxiety reduction",
    "3-minute breathing exercises"
  ],
  "delivery_frequency": "morning: 9:00, evening: 21:00"
}
Enter fullscreen mode Exit fullscreen mode

Content Examples

  • Morning: "Heart feeling noisy? Try this 3-minute breathing technique backed by neuroscience research."
  • Evening: "Mindfulness isn't about stopping thoughts. It's about changing your relationship with them."

Key Takeaways

Lesson Detail
Mac Mini Reliability 4 days continuous operation, power outage auto-recovery verified
Parallel Design Several skills run independently without conflicts
API Management Blotato stable, message delivery needs improvement
Buddhist Marketing Empathy-first approach showing effectiveness
Monitoring Importance Slack notifications enable early problem detection

70% success rate has room for improvement. Next steps toward 80% target: enhanced error handling and retry mechanisms.

The key insight: Infrastructure reliability matters less than graceful degradation.
When a skill fails, the system continues operating other skills.
Retry logic handles temporary issues automatically.

Top comments (0)