Skip to content

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.

Terminal window
# Create a daily briefing job
hermes 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 telegram
# Create a watchdog script
cat > ~/.hermes/scripts/health-check.sh << 'EOF'
#!/bin/bash
CPU=$(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 1
fi
EOF
chmod +x ~/.hermes/scripts/health-check.sh
# Schedule the check
hermes cron create "every 5m" \
--no-agent \
--script health-check.sh \
--deliver telegram \
--name "server-health"
# Backup job with agent reasoning
cronjob(
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"
)
# Monitor a website for changes
cronjob(
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"
)
# Job 1: Collect data
cronjob(
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"
)
Terminal window
# Create a bundle for data processing
hermes bundles create data-pipeline \
--skill web-scraper \
--skill data-cleaner \
--skill report-generator
# Use the bundle in a cron job
hermes cron create "every 6h" \
--skill data-pipeline \
"Process new sales data and generate a report" \
--name "sales-report"

Always include error handling in your automation prompts:

Check the API status. If it fails:
1. Wait 30 seconds and retry up to 3 times
2. If still failing, report the error but don't spam
3. Use [SILENT] for expected transient failures

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 retries
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 scripts
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 audit
# Job 1: Monitor repository
cronjob(
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"
)
Terminal window
# Check gateway status
hermes gateway status
hermes cron list
# View logs
hermes logs --follow
# Manually trigger a job
hermes cron run <job_id>
Terminal window
# Check delivery target configuration
hermes config show
# Verify platform credentials
cat ~/.hermes/.env | grep -E "(TELEGRAM|DISCORD|SLACK)"
# Test delivery manually
hermes chat -q "test message" --deliver telegram