Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scheduling

Agents can create time-based triggers to proactively send messages or execute tasks. Schedules persist across restarts and deliver results via any configured gateway.

Overview

Scheduling lets agents handle use cases like:

  • “Remind me to check deployment status tomorrow at 9am”
  • “Send me a daily standup prompt on weekdays”
  • “Follow up on this issue in 2 hours”

Schedule Types

TypeDescriptionExample
One-shot (at)Fire once at a specific time2026-02-01T09:00:00Z
Interval (every)Repeat every N seconds3600 (hourly)
CronStandard cron expression0 9 * * MON-FRI (9am weekdays)

Schedule Tool

A single built-in schedule tool handles all scheduling operations via an action parameter:

ActionDescription
createCreate a new schedule. The agent specifies the timing, destination, and payload.
listList all active schedules for the current agent.
cancelCancel an active schedule by its ID.
spec:
  tools:
    - type: builtin
      name: schedule

Payload Types

TypeDescription
messageSend text directly (no LLM call)
taskExecute with agent tools, summarize results

Example Scenarios

One-Time Reminder

  1. User: “Remind me to review the PR in 2 hours”
  2. Agent calls schedule with action: "create", at: "2026-01-30T16:00:00Z"
  3. Two hours later, user receives: “Reminder: review the PR”

Recurring Prompt

  1. User: “Send me a daily standup prompt at 9am on weekdays”
  2. Agent calls schedule with action: "create", cron: "0 9 * * MON-FRI"
  3. Every weekday at 9am, user receives the prompt
  4. User replies, and the conversation continues naturally

Session Continuity

Scheduled messages inject into the active session for a (chat_id, agent) pair if one exists. If not, a new session is created. This means scheduled messages appear in the same conversation as user messages — enabling natural follow-up.

Storage

Schedules are persisted as YAML files:

.duragent/
├── schedules/
│   ├── sched_01HQXYZ.yaml      # Schedule definition
│   └── runs/
│       └── sched_01HQXYZ.jsonl  # Run history

Schedule File Format

id: reminder-abc123
agent: my-assistant
created_by_session: session_xyz
destination:
  gateway: telegram
  chat_id: "123456789"
schedule:
  at:                                    # one-shot
    at: "2026-01-30T16:00:00Z"
  # or:
  # cron:                                # recurring
  #   expr: "0 9 * * MON-FRI"
payload:
  message:
    message: "Reminder: review the PR"

Process-Linked Schedules

A schedule can be linked to a background process by passing process_handle when creating it. When the linked process exits (completes, fails, times out, or is killed), all schedules with that process_handle are automatically cancelled.

This is useful for the watch pattern, where a recurring schedule monitors a background process. Without process_handle, the watch schedule would keep firing after the process exits until the next poll notices it’s done.

Retry

Schedules support optional retry with exponential backoff and jitter for transient failures (e.g., LLM provider 503).