Skip to main content

Scheduling & Automation

OrcBot provides three scheduling mechanisms: one-time task scheduling, recurring heartbeat tasks, and event-driven polling. Together, these enable fully autonomous operation.

schedule_task

Schedule a one-time task for future execution.

Parameters

string
required
When to run the task. Supports:
  • Relative time: "in 2 hours", "in 30 minutes", "in 1 day"
  • Absolute time: "2025-01-15T14:30:00Z" (ISO 8601)
  • Cron expression: "0 9 * * 1-5" (weekdays at 9 AM)
string
required
Natural language task description

Return Value

string
Confirmation with scheduled time and task ID

Relative Time Parsing

Supported formats:
  • "in N minutes" - N minutes from now
  • "in N hours" - N hours from now
  • "in N days" - N days from now
  • "in N weeks" - N weeks from now

Cron Expressions

Standard cron format:

Example Usage

Relative time:
Absolute time:
Cron expression:

Response Example

Task Metadata

Scheduled tasks are stored in scheduled-tasks.json with:
  • id: Unique task identifier
  • cronExpression: Cron pattern
  • description: Task description
  • nextRun: Next execution timestamp
  • createdAt: Creation timestamp

Canceling Tasks

Scheduled tasks can be canceled by modifying scheduled-tasks.json manually (future skill planned).

Metadata

  • isDeep: false
  • isDangerous: false
Use schedule_task for one-time future tasks. For recurring automation, use heartbeat_schedule instead.

heartbeat_schedule

Schedule a recurring autonomous task.

Parameters

string
required
Cron expression for recurrence (see format above)
string
required
What the agent should do on each execution

Return Value

string
Confirmation with next run time and schedule ID

Heartbeat vs Autonomy

Heartbeat tasks:
  • Triggered by cron schedule
  • Task-specific and focused
  • Runs even when queue is empty
  • Survives restarts (persisted to heartbeat-schedules.json)
Autonomy mode:
  • Triggered by interval timer
  • Context-aware and exploratory
  • Only runs when idle
  • Governed by autonomyEnabled config

Example Usage

Daily report:
Hourly check:
Weekly backup:
Every 15 minutes:

Response Example

Persistence

Heartbeat schedules are saved to heartbeat-schedules.json and survive agent restarts.

Smart Heartbeat Features

Exponential Backoff: When heartbeat tasks are unproductive (no meaningful work done), the interval automatically increases:
  • First idle: 2x interval
  • Second idle: 4x interval
  • Third idle: 8x interval
  • Max: 16x original interval
Productivity resets the interval to baseline. Productivity Tracking: The system tracks whether heartbeat tasks result in:
  • User-visible messages sent
  • Files created
  • Commands executed
  • Research completed
Unproductive tasks (e.g., “nothing to do”) trigger backoff. Context-Aware Execution: Heartbeat tasks have access to:
  • Recent conversation context
  • User preferences from USER.md
  • Past actions from memory
  • Current time and date

Metadata

  • isDeep: false
  • isDangerous: false
Heartbeat tasks run autonomously. Ensure they have clear success criteria and don’t spam users. Use autonomyAllowedChannels to control which channels receive proactive messages.

Polling System

Event-driven condition monitoring without busy-waiting loops.

Architecture

The polling system provides:
  • Condition checking: Evaluate a condition function repeatedly
  • Success/failure callbacks: Trigger actions when condition met
  • Timeout handling: Maximum wait time before giving up
  • Interval control: How often to check the condition
  • Event bus integration: Emits events for monitoring

Creating a Poll

Polls are created programmatically (not via a skill). Example:

Use Cases

Wait for file creation:
Wait for API response:
Wait for process completion:

Event Bus Events

Best Practices

Efficient polling intervals:
  • Fast events (1-10s): 1-2 second intervals
  • Medium events (1-5min): 5-10 second intervals
  • Slow events (>5min): 30-60 second intervals
Set reasonable timeouts. Polls consume memory until they complete or time out. Always set a maximum wait time.

Common Workflows

Deployment Automation

Daily Reports

Monitoring Integration

Reminder System

Configuration

Autonomy Settings

Heartbeat Backoff

Polling Defaults

Best Practices

Scheduling strategy:
  1. Use schedule_task for one-time future actions
  2. Use heartbeat_schedule for recurring autonomous work
  3. Use polling for waiting on external events
  4. Combine all three for complex workflows
Avoid heartbeat spam:
  • Set realistic cron intervals (not every minute unless necessary)
  • Use specific task descriptions so the agent knows when to skip
  • Configure autonomyAllowedChannels to control where messages go
  • Monitor productivity metrics to detect noisy tasks
Heartbeat tasks have full skill access. They can search the web, read files, send messages, and execute commands just like user-initiated tasks.

Troubleshooting

”Heartbeat not triggering”

  • Cause: Cron expression invalid or agent not running
  • Fix: Validate cron with https://crontab.guru/, check daemon status

”Polling timed out”

  • Cause: Condition never became true within timeout
  • Fix: Increase timeout or check condition logic

”Autonomy paused”

  • Cause: Backlog limit reached
  • Fix: Process pending tasks or increase autonomyBacklogLimit

”Scheduled task not executing”

  • Cause: Task ID collision or scheduler not started
  • Fix: Check scheduled-tasks.json for duplicates, restart agent

Memory

Store context for autonomous tasks

Orchestration

Spawn agents for parallel scheduled work