DEV Community

Cover image for Cron & Scheduled Tasks in Garudust Agent — Autonomous Agents That Run Without You
Garudust
Garudust

Posted on

Cron & Scheduled Tasks in Garudust Agent — Autonomous Agents That Run Without You

Most AI agents wait. They sit idle until a human types something, respond, then go back to waiting.

Garudust Agent can be different. With garudust-cron, you schedule tasks using standard cron syntax — the agent wakes up, runs a full LLM loop with all its tools, and goes back to sleep. No human required.

This post shows you exactly how to configure it, with the correct syntax pulled straight from the source.


How It Works

garudust-cron is a crate within the Garudust workspace. When a scheduled trigger fires, it calls agent.run(task) — the same code path as a user typing a message. The agent has access to all its configured tools: file read/write, terminal, RAG, web search, and anything else you've enabled.

Cron runs as part of garudust-server. There is no separate daemon.


Three Ways to Set Up Cron Jobs

1. config.yaml — Permanent, survives restarts

# ~/.garudust/config.yaml
cron:
  jobs:
    - schedule: "0 9 * * 1-5"   # weekdays at 09:00 (server timezone)
      task: "Write a morning briefing and append it to ~/briefing.md"

    - schedule: "0 18 * * 5"    # Fridays at 18:00
      task: "Summarise this week's git commits and save to ~/weekly.md"
Enter fullscreen mode Exit fullscreen mode

CronJob has exactly two fields: schedule and task. Nothing else.

schedule uses standard 5-field cron syntax:

┌─────── minute (059)
│ ┌───── hour (023)
│ │ ┌─── day of month (131)
│ │ │ ┌─ month (112)
│ │ │ │ ┌ day of week (06, Sun=0)
│ │ │ │ │
0 9 * * 1-5
Enter fullscreen mode Exit fullscreen mode

Timezone follows the server process — set your system timezone before starting garudust-server if needed.


2. CLI flag or environment variable — One-off / Docker

# CLI flag — comma-separated "cron_expr=task" pairs
garudust-server --cron-jobs "0 9 * * *=Write morning briefing,0 18 * * 5=Weekly summary"

# Or via environment variable in ~/.garudust/.env
GARUDUST_CRON_JOBS="0 9 * * *=Write morning briefing"
Enter fullscreen mode Exit fullscreen mode

These take precedence over config.yaml when both are set.


3. Runtime via chat — No restart needed

Once the server is running, you (or any admin) can create jobs live by asking the agent:

You:   Create a cron job that runs every day at 7am to check disk usage
       and send me an alert if any partition is above 80%.

Agent: [uses cron_create tool]
       Created cron job 'disk_check' with schedule: 0 0 7 * * *
Enter fullscreen mode Exit fullscreen mode

Note: cron_create uses 6-field cron syntax (seconds first): sec min hour dom month dow
This is different from the 5-field syntax in config.yaml.

Format Where used Example
5-field config.yaml, --cron-jobs, env var 0 9 * * 1-5
6-field cron_create tool at runtime 0 0 9 * * 1-5

Runtime jobs are not persisted — they disappear on server restart. Add them to config.yaml for permanent schedules.

Manage runtime jobs:

You:   List all active cron jobs.
Agent: - [disk_check]  schedule: 0 0 7 * * *  task: Check disk usage...  created: 2025-05-21 07:00 UTC

You:   Delete the disk_check job.
Agent: Cron job 'disk_check' removed.
Enter fullscreen mode Exit fullscreen mode

Memory Maintenance (Bonus)

CronConfig has two extra fields specifically for automatic memory housekeeping:

cron:
  jobs:
    - schedule: "0 9 * * *"
      task: "Morning briefing"

  # Consolidate and deduplicate memory entries
  memory_consolidation: "0 3 * * *"   # daily at 03:00

  # Expire stale memory entries (based on memory_expiry settings)
  memory_expiry: "0 4 * * 0"          # weekly on Sunday at 04:00
Enter fullscreen mode Exit fullscreen mode

These run lightweight maintenance tasks — no LLM call required.


Practical Examples

Morning Briefing

cron:
  jobs:
    - schedule: "0 8 * * 1-5"
      task: >
        Write a morning briefing covering: (1) any new files in ~/inbox/,
        (2) a summary of yesterday's ~/logs/app.log errors,
        (3) today's date and day of week.
        Save the result to ~/briefing/$(date +%Y-%m-%d).md.
Enter fullscreen mode Exit fullscreen mode

Log Monitoring

cron:
  jobs:
    - schedule: "*/15 * * * *"   # every 15 minutes
      task: >
        Check /var/log/app/error.log for entries in the last 15 minutes.
        If there are more than 10 errors, append a summary to ~/alerts/errors.log.
Enter fullscreen mode Exit fullscreen mode

Weekly Git Summary

cron:
  jobs:
    - schedule: "0 17 * * 5"   # Fridays at 17:00
      task: >
        Run git log --since="1 week ago" --oneline in ~/project/,
        summarise what changed by area, and save to ~/reports/weekly.md.
Enter fullscreen mode Exit fullscreen mode

Sending Results to Telegram

Cron jobs have no built-in delivery mechanism — the agent writes to files or uses tools. To send to Telegram, write it into the task prompt:

cron:
  jobs:
    - schedule: "0 9 * * *"
      task: >
        Write a morning briefing (top 3 priorities for today, weather summary).
        Then send it to Telegram chat ID 123456789 using the send_message tool.
Enter fullscreen mode Exit fullscreen mode

The agent calls send_message itself. The chat ID must be hardcoded in the task or retrievable from a file the agent can read.


Disabling Cron Tools

If you want to prevent the agent from creating or deleting jobs at runtime, disable the toolset:

disabled_toolsets: [cron]
Enter fullscreen mode Exit fullscreen mode

Config-file jobs still run — only the cron_create / cron_list / cron_delete runtime tools are disabled.


Summary

config.yaml --cron-jobs / env var Runtime (cron_create)
Cron syntax 5-field 5-field 6-field (sec first)
Persists across restarts
Requires restart to activate
cron_list shows it

Start with config.yaml for anything you want running reliably. Use runtime jobs for experiments or tasks you only need for the current server session.


Garudust AgentGitHub · Releases

Top comments (0)