Hermes Agent Tutorial Part 3: Cron Jobs and Automated Workflows

In Part 1 and Part 2 of this series, we covered the fundamentals of Hermes Agent and explored its powerful tool ecosystem. Now it is time to unlock one of its most compelling features: automated, scheduled workflows powered by cron jobs.

Modern AI agents should not wait for manual triggers. Whether you need daily reports, periodic health checks, recurring data analysis, or automated content generation, Hermes Agent’s built-in cronjob tool transforms your agent from a reactive assistant into a proactive automation engine. In this article, we will explore every aspect of cron jobs in Hermes Agent, from basic scheduling to complex multi-step pipelines with cross-platform delivery.


Why Cron Jobs Matter for AI Agents

Traditional cron utilities on Linux have served system administrators for decades. They are excellent for running shell scripts at fixed intervals, but they lack two critical capabilities for the AI era:

  1. Context awareness — A standard cron job cannot reason about its output, adapt to failures, or invoke AI-driven decision-making. It simply executes a command and hopes for the best.
  2. Delivery flexibility — Sending results to Slack, email, Feishu, or other platforms usually requires additional scripting, API integration, and credential management.

Hermes Agent bridges this gap elegantly. Its cron system combines standard cron expressions with the full power of the agent’s skills, toolsets, and delivery mechanisms. You define what should happen and when; the agent handles how. This means your scheduled tasks can leverage natural language understanding, code generation, data analysis, and multi-platform communication — all within a single unified framework.

Consider the difference between a traditional cron job that runs df -h to check disk space and a Hermes Agent cron job that analyzes disk usage trends, predicts when storage will run out, and writes a contextual alert explaining which directories are growing fastest and what cleanup actions are recommended. The former dumps raw data; the latter delivers actionable intelligence.


The cronjob Tool: A Complete Overview

Hermes Agent exposes a unified cronjob interface with seven primary actions. This consistent API design mirrors familiar DevOps workflows, making it intuitive for engineers while remaining accessible to non-technical users.

ActionPurpose
createRegister a new scheduled task with a unique name and cron expression
listView all existing cron jobs with their status and metadata
updateModify an existing job’s schedule, prompt, or delivery configuration
pauseTemporarily disable a job without deleting its configuration
resumeRe-enable a previously paused job
removePermanently delete a job and cancel its schedule
runManually trigger a job on demand for testing or immediate execution

This seven-action vocabulary covers the entire lifecycle of a scheduled task. You never need to SSH into a server, edit crontab files, or worry about timezone configurations on individual machines. Everything is managed through the agent’s API, making your automation infrastructure portable, version-controllable, and cloud-native.


Creating Your First Cron Job

Let us start with a simple but practical example: a daily summary that runs every morning at 9:00 AM and delivers insights to your team chat.

Basic Syntax

When you invoke the cronjob tool, you provide a JSON payload specifying the action and parameters. Here is a minimal create request:

{
  "action": "create",
  "name": "daily-morning-summary",
  "schedule": "0 9 * * *",
  "prompt": "Generate a brief summary of today's priorities based on the project backlog.",
  "delivery": {
    "channel": "feishu",
    "target": "my-group-chat-id"
  }
}

Key fields explained:

Cron Expression Quick Reference

If you are rusty on cron syntax, here is a refresher. The five fields represent:

* * * * *
│ │ │ │ └─── Day of week (0–7, Sunday = 0 or 7)
│ │ │ └───── Month (1–12)
│ │ └─────── Day of month (1–31)
│ └───────── Hour (0–23)
└─────────── Minute (0–59)

Common patterns you will use frequently:

ExpressionMeaning
0 * * * *Every hour, on the hour
*/15 * * * *Every 15 minutes
0 0 * * 1Every Monday at midnight
0 9,17 * * 1-5At 9 AM and 5 PM on weekdays
0 0 1 * *At midnight on the first day of every month
0 */6 * * *Every 6 hours
30 8 * * 1-5At 8:30 AM on weekdays

Understanding these patterns is essential because the schedule is the heartbeat of your automation. A poorly chosen interval can overwhelm your systems or miss critical windows.


The no_agent Mode: Direct Script Execution

Not every scheduled task needs AI reasoning. Sometimes you simply want to run a shell script, a Python program, a database backup command, or a file cleanup routine. Hermes Agent supports this via the no_agent flag, which bypasses the LLM entirely.

{
  "action": "create",
  "name": "nightly-database-backup",
  "schedule": "0 2 * * *",
  "no_agent": true,
  "command": "pg_dump mydb > /backups/mydb-$(date +\%Y\%m\%d).sql",
  "delivery": {
    "channel": "email",
    "target": "[email protected]",
    "subject": "Database backup completed"
  }
}

When no_agent is set to true, the agent skips the LLM inference step and executes the command directly in its sandboxed environment. The output of the command (stdout and stderr) is captured and delivered according to your configuration.

This mode is ideal for:

The beauty of no_agent mode is that it coexists seamlessly with AI-powered jobs in the same scheduling system. You do not need a separate cron daemon for scripts and another for AI tasks. Everything lives in one place, with unified logging, monitoring, and delivery.


Attaching Skills and Toolsets

One of the most powerful features of Hermes Agent cron jobs is the ability to attach skills and toolsets. This means your scheduled tasks can leverage the same rich capabilities available in interactive sessions, including code execution, web browsing, database queries, and API interactions.

Example: Automated Code Review

Suppose you want a nightly job that scans your repository for potential issues and posts a summary to your engineering channel:

{
  "action": "create",
  "name": "nightly-code-review",
  "schedule": "0 22 * * *",
  "prompt": "Review the latest commits in the main branch. Identify any potential bugs, security issues, or code smells. Provide a concise summary with file names and line numbers where relevant.",
  "skills": ["git-analysis", "security-scan"],
  "toolsets": ["github", "static-analysis"],
  "delivery": {
    "channel": "slack",
    "target": "#engineering"
  }
}

Here, the job automatically loads the git-analysis and security-scan skills, and grants access to the github and static-analysis toolsets. When 10:00 PM rolls around, the agent wakes up, pulls the latest commits, runs the analysis, and delivers the report — all without human intervention.

Example: Competitive Intelligence Gathering

You can also build jobs that gather external data and synthesize insights:

{
  "action": "create",
  "name": "weekly-competitor-watch",
  "schedule": "0 9 * * 1",
  "prompt": "Visit the pricing pages of competitor1.com and competitor2.com. Extract their current pricing tiers, feature lists, and any promotional offers. Compare these with our pricing at example.com/pricing. Generate a competitive analysis summary highlighting gaps and opportunities.",
  "skills": ["web-scraping", "market-analysis"],
  "toolsets": ["web", "document"],
  "delivery": {
    "channel": "email",
    "target": "[email protected]",
    "subject": "Weekly Competitive Intelligence Report"
  }
}

This job demonstrates how cron scheduling combined with web tools and document generation creates a fully automated research assistant.


Managing Jobs Over Their Lifecycle

Listing All Jobs

To see what is currently scheduled, use the list action:

{
  "action": "list"
}

The response includes rich metadata for each job:

{
  "jobs": [
    {
      "id": "cron-7f3a9b2",
      "name": "daily-morning-summary",
      "schedule": "0 9 * * *",
      "status": "active",
      "last_run": "2026-06-12T09:00:00Z",
      "next_run": "2026-06-13T09:00:00Z",
      "run_count": 45,
      "failure_count": 0
    },
    {
      "id": "cron-8e4c1d5",
      "name": "nightly-database-backup",
      "schedule": "0 2 * * *",
      "status": "active",
      "last_run": "2026-06-12T02:00:00Z",
      "next_run": "2026-06-13T02:00:00Z",
      "run_count": 45,
      "failure_count": 1
    }
  ]
}

The run_count and failure_count fields help you quickly assess the health of your automation fleet. A high failure_count relative to run_count is a signal to investigate the job’s prompt, tool permissions, or external dependencies.

Pausing and Resuming

Need to temporarily halt a job during maintenance windows or holidays? Use pause and resume:

{
  "action": "pause",
  "name": "nightly-database-backup"
}
{
  "action": "resume",
  "name": "nightly-database-backup"
}

Unlike remove, pause preserves the job configuration so you can resume it later with zero friction. This is particularly useful for seasonal jobs or tasks that need to be disabled during deployments.

Updating a Job

Schedules and requirements change constantly. The update action lets you modify any field without deleting and recreating the job:

{
  "action": "update",
  "name": "daily-morning-summary",
  "schedule": "0 8 * * 1-5",
  "prompt": "Generate a weekday morning summary focusing on sprint blockers, overdue tickets, and deadlines. Keep it under 200 words."
}

This changes the schedule to 8:00 AM on weekdays only and refines the prompt for a more focused output. The job retains its original ID, delivery settings, and execution history.

Removing a Job

When a job is no longer needed, clean it up to prevent clutter:

{
  "action": "remove",
  "name": "daily-morning-summary"
}

Manual Execution with run

Want to test a job immediately without waiting for the next scheduled trigger? The run action executes the job on demand:

{
  "action": "run",
  "name": "nightly-code-review"
}

This is invaluable for debugging and validating new cron jobs before they go live. You can iterate on the prompt, observe the output, and refine the delivery settings — all without modifying the schedule or creating duplicate test jobs.


Building Automated Pipelines

Real-world automation rarely involves a single step. Hermes Agent cron jobs can serve as the orchestration layer for multi-stage pipelines by chaining tool calls within the prompt or by having one job trigger another via webhooks.

Example: End-to-End Reporting Pipeline

Imagine a weekly pipeline that:

  1. Pulls sales data from a database
  2. Analyzes trends with an AI model
  3. Generates a PDF report
  4. Emails the report to stakeholders
  5. Posts a summary to Feishu

You can implement this as a single cron job with a detailed prompt:

{
  "action": "create",
  "name": "weekly-sales-report",
  "schedule": "0 8 * * 1",
  "prompt": "Execute the following pipeline:\n1. Query the sales database for last week's transactions using the database tool.\n2. Analyze the data to identify top products, revenue trends, and anomalies.\n3. Generate a formatted PDF report using the document tool.\n4. Email the PDF to [email protected] with subject 'Weekly Sales Report'.\n5. Post a one-paragraph summary to the Feishu group 'sales-updates'.",
  "skills": ["data-analysis", "report-generation"],
  "toolsets": ["database", "document", "email", "feishu"],
  "delivery": {
    "channel": "feishu",
    "target": "ops-dashboard"
  }
}

Because the agent retains context across tool calls within a single session, it can pass intermediate results (like query output) seamlessly from one step to the next. The database query results become the input for analysis, which feeds into the report generator, which produces the attachment for the email.

Advanced Pipeline: Incident Response

For more complex scenarios, you can build conditional logic directly into the prompt:

{
  "action": "create",
  "name": "smart-incident-detector",
  "schedule": "*/10 * * * *",
  "prompt": "Check the error rate from the monitoring API.\n- If error rate < 1%: Log 'All systems healthy' and exit.\n- If error rate 1-5%: Investigate recent deployments and generate a warning summary.\n- If error rate > 5%: Escalate immediately. Collect logs, identify affected services, and notify the on-call engineer via SMS and Slack.",
  "skills": ["incident-response", "log-analysis"],
  "toolsets": ["web", "terminal", "slack", "sms"],
  "delivery": {
    "channel": "slack",
    "target": "#ops-alerts"
  }
}

This demonstrates how a single cron job can function as a smart monitoring system with built-in escalation policies.


Delivery Channels and Configuration

Hermes Agent supports multiple delivery channels out of the box, each with its own configuration options.

Feishu (Lark)

{
  "delivery": {
    "channel": "feishu",
    "target": "chat-id-or-group-id",
    "format": "markdown"
  }
}

Feishu renders Markdown natively, so your agent’s output can include bold text, code blocks, links, and even images if the agent generates them. This makes Feishu an excellent choice for technical reports and formatted summaries.

Slack

{
  "delivery": {
    "channel": "slack",
    "target": "#channel-name",
    "thread_ts": "optional-parent-thread-id"
  }
}

The optional thread_ts field lets you reply to an existing thread, keeping related alerts organized.

Email

{
  "delivery": {
    "channel": "email",
    "target": "[email protected]",
    "subject": "Automated Report",
    "cc": ["[email protected]"],
    "attach_output": true
  }
}

Setting attach_output to true converts the agent’s response into a file attachment, which is useful for long reports.

Webhook

For custom integrations, use a generic webhook:

{
  "delivery": {
    "channel": "webhook",
    "target": "https://api.example.com/webhook",
    "method": "POST",
    "headers": {
      "Authorization": "Bearer your-token",
      "Content-Type": "application/json"
    }
  }
}

This enables integration with virtually any third-party service, from custom dashboards to ticketing systems.


Best Practices for Reliable Automation

1. Use Descriptive Names

A job named job-42 tells you nothing six months later. Prefer weekly-security-audit or daily-customer-churn-alert. Good names make list output self-documenting.

2. Set Appropriate Timeouts

Long-running jobs should have explicit timeouts to prevent resource exhaustion. While Hermes Agent handles sandboxing, your infrastructure will thank you for bounded execution windows. Consider breaking very long tasks into smaller, chained jobs.

3. Test with run Before Scheduling

Always trigger a new job manually before letting it run on a schedule. This catches prompt errors, permission issues, and tool misconfigurations early. Run at least three manual tests: one for the happy path, one for expected edge cases, and one simulating a failure condition.

4. Monitor last_run and next_run

Poll the list output periodically or set up a meta-job that alerts you if any critical job has not run within its expected window. A job that silently stops firing is often worse than a job that fails loudly.

5. Keep Prompts Idempotent

Design your prompts so that running the job twice by accident does not cause harm. For example, use INSERT IF NOT EXISTS in database operations, timestamped filenames for generated files, and deduplication checks in notification logic.

6. Version Control Your Job Definitions

Store your cron job JSON definitions in a Git repository. This enables code review, rollback, and audit trails for your automation infrastructure. Treat your cron jobs as infrastructure-as-code.

7. Use pause Instead of remove for Temporary Changes

When you need to disable a job temporarily, prefer pause over remove. This preserves the configuration and history, making it easy to resume later without re-creating the job from scratch.

8. Document Dependencies

If a job relies on external services (a database, an API, a third-party platform), document these dependencies in the job name or description. This helps during incident response and maintenance planning.


Putting It All Together: A Real-World Example

Let us conclude with a comprehensive example that ties together everything we have learned. This job monitors a web application, alerts on downtime, and generates an incident report with full context:

{
  "action": "create",
  "name": "app-health-monitor",
  "schedule": "*/5 * * * *",
  "prompt": "Perform the following health check:\n1. Send an HTTP GET request to https://api.example.com/health using the web tool.\n2. If the status code is not 200 or the response time exceeds 2000ms, classify this as an incident.\n3. If an incident is detected:\n   a. Capture the current timestamp, status code, and response time.\n   b. Check the last 50 lines of application logs using the terminal tool.\n   c. Generate a concise incident report with severity classification.\n   d. Post the report to the #incidents Slack channel with @here mention.\n   e. Send an email to [email protected] with subject 'ALERT: API Health Check Failed'.\n4. If healthy, do nothing.",
  "skills": ["incident-response", "log-analysis"],
  "toolsets": ["web", "terminal", "slack", "email"],
  "delivery": {
    "channel": "slack",
    "target": "#monitoring"
  }
}

This job runs every five minutes, uses four different toolsets, applies conditional logic based on the health check result, and delivers alerts through two channels — all defined in a single, readable JSON payload. It demonstrates how Hermes Agent cron jobs can replace entire monitoring stacks for small to medium teams.


Conclusion

Hermes Agent’s cron system is more than a scheduler. It is a fully programmable automation framework that brings AI reasoning, rich tool integration, and flexible delivery into the world of recurring tasks. Whether you are running simple maintenance scripts in no_agent mode or orchestrating complex, multi-step pipelines with skills and toolsets, the cronjob tool provides the control and reliability you need.

The key insight is that cron jobs in Hermes Agent are not just timed triggers — they are persistent, autonomous workflows that combine the precision of traditional scheduling with the intelligence of modern AI. By mastering this feature, you transform your agent from a conversational assistant into a round-the-clock operations partner.

In the next part of this series, we will explore multi-agent collaboration — how multiple Hermes Agent instances can work together to solve problems that exceed the scope of a single agent.

Stay automated!