Automation Workflows
Hermes Agent’s cron system and tool integration make it perfect for building automated workflows. This guide covers common automation patterns and best practices.
Common Automation Patterns
Section titled “Common Automation Patterns”1. Daily Morning Briefing
Section titled “1. Daily Morning Briefing”# Create a daily briefing jobhermes cron create "every day at 8am" \ "Check my calendar, summarize unread emails, and check Hacker News top stories. Send a briefing to Telegram." \ --name "morning-briefing" \ --deliver telegram2. Server Health Monitoring
Section titled “2. Server Health Monitoring”# Create a watchdog scriptcat > ~/.hermes/scripts/health-check.sh << 'EOF'#!/bin/bashCPU=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)MEM=$(free | grep Mem | awk '{printf "%.0f", $3/$2 * 100.0}')if (( $(echo "$CPU > 90" | bc -l) )) || (( $MEM > 90 )); then echo "⚠️ Alert: CPU ${CPU}% | Memory ${MEM}%" exit 1fiEOF
chmod +x ~/.hermes/scripts/health-check.sh
# Schedule the checkhermes cron create "every 5m" \ --no-agent \ --script health-check.sh \ --deliver telegram \ --name "server-health"3. Automated Backups
Section titled “3. Automated Backups”# Backup job with agent reasoningcronjob( action="create", schedule="0 2 * * *", # 2 AM daily name="daily-backup", prompt=""" 1. Check disk space in /backup 2. Create a compressed backup of ~/projects 3. Verify backup integrity 4. Remove backups older than 7 days 5. Report backup size and status """, deliver="telegram")4. Content Monitoring
Section titled “4. Content Monitoring”# Monitor a website for changescronjob( action="create", schedule="every 1h", name="price-monitor", prompt=""" Check https://example.com/product and extract the current price. Compare with the previous price stored in ~/.hermes/data/prices.json. If price dropped by more than 10%, notify with [SILENT] removed. Otherwise respond with [SILENT]. """, deliver="telegram")Workflow Composition
Section titled “Workflow Composition”Chaining Jobs with Context
Section titled “Chaining Jobs with Context”# Job 1: Collect datacronjob( action="create", schedule="0 7 * * *", name="collect-news", prompt="Fetch top AI/ML stories from Hacker News and save to ~/.hermes/data/news.md")
# Job 2: Process data (depends on Job 1)cronjob( action="create", schedule="30 7 * * *", name="summarize-news", context_from="<job1_id>", prompt="Read ~/.hermes/data/news.md and create a 3-bullet summary")
# Job 3: Deliver (depends on Job 2)cronjob( action="create", schedule="0 8 * * *", name="deliver-news", context_from="<job2_id>", prompt="Format the summary for Telegram and deliver")Using Skills in Automation
Section titled “Using Skills in Automation”# Create a bundle for data processinghermes bundles create data-pipeline \ --skill web-scraper \ --skill data-cleaner \ --skill report-generator
# Use the bundle in a cron jobhermes cron create "every 6h" \ --skill data-pipeline \ "Process new sales data and generate a report" \ --name "sales-report"Best Practices
Section titled “Best Practices”1. Error Handling
Section titled “1. Error Handling”Always include error handling in your automation prompts:
Check the API status. If it fails:1. Wait 30 seconds and retry up to 3 times2. If still failing, report the error but don't spam3. Use [SILENT] for expected transient failures2. Rate Limiting
Section titled “2. Rate Limiting”Be respectful of external APIs:
When calling external APIs:- Add delays between requests (sleep 1-2 seconds)- Respect rate limits (check response headers)- Cache results when appropriate- Use exponential backoff for retries3. Resource Management
Section titled “3. Resource Management”For resource-intensive tasks:- Check available disk space before large operations- Monitor memory usage during processing- Clean up temporary files after completion- Use --no-agent mode for simple scripts4. Security
Section titled “4. Security”For automated tasks:- Store credentials in ~/.hermes/.env, never in prompts- Use read-only operations when possible- Validate inputs before processing- Log sensitive operations for auditExample: Complete CI/CD Pipeline
Section titled “Example: Complete CI/CD Pipeline”# Job 1: Monitor repositorycronjob( action="create", schedule="every 15m", name="repo-monitor", prompt=""" Check GitHub repo for new commits on main branch. If new commits found: 1. Pull changes 2. Run tests (pytest) 3. If tests pass, build Docker image 4. Report status """, deliver="slack")Troubleshooting Automation
Section titled “Troubleshooting Automation”Jobs Not Running
Section titled “Jobs Not Running”# Check gateway statushermes gateway statushermes cron list
# View logshermes logs --follow
# Manually trigger a jobhermes cron run <job_id>Delivery Failures
Section titled “Delivery Failures”# Check delivery target configurationhermes config show
# Verify platform credentialscat ~/.hermes/.env | grep -E "(TELEGRAM|DISCORD|SLACK)"
# Test delivery manuallyhermes chat -q "test message" --deliver telegramLearn More
Section titled “Learn More”- Cron Jobs - Complete cron documentation
- Skills System - Create reusable automation components
- Sub-Agents - Parallel task execution