Schedules

Automated task scheduling and monitoring

2 min read9 sections

Schedules

Schedule automated tasks to run at specific times or intervals. Perfect for monitoring websites, collecting data regularly, or maintaining up-to-date information without manual intervention.

Schedule Types

  • One-time - Execute once at a specific date/time
  • Recurring - Repeat at regular intervals
  • Cron-based - Use cron expressions for complex timing
  • Event-driven - Trigger based on external events

Creating Schedules

Create schedules via the dashboard or API:

bash
POST /schedules
  
  {
    "name": "Daily Price Check",
    "prompt": "Check product prices on competitor websites",
    "schedule": {
      "type": "recurring",
      "interval": "daily",
      "time": "09:00",
      "timezone": "UTC"
    },
    "webhook_url": "https://your-app.com/price-updates",
    "active": true
  }

Cron Expressions

Use cron expressions for precise scheduling:

json
{
    "schedule": {
      "type": "cron",
      "expression": "0 */6 * * *",  // Every 6 hours
      "timezone": "America/New_York"
    }
  }

Common cron patterns:

  • 0 9 * * 1-5 - Weekdays at 9 AM
  • 0 */2 * * * - Every 2 hours
  • 0 0 1 * * - First day of each month
  • 0 0 * * 0 - Every Sunday at midnight

Monitoring and Alerts

Set up monitoring to track changes and receive alerts:

bash
POST /schedules
  
  {
    "name": "Website Monitor",
    "prompt": "Check if the homepage content has changed",
    "schedule": {
      "type": "recurring",
      "interval": "hourly"
    },
    "monitoring": {
      "enabled": true,
      "alert_on_change": true,
      "alert_threshold": 0.1  // 10% content change
    },
    "notifications": [
      {
        "type": "email",
        "address": "alerts@yourcompany.com"
      },
      {
        "type": "slack",
        "webhook": "https://hooks.slack.com/..."
      }
    ]
  }

Schedule Management

Manage your schedules programmatically:

bash
# List all schedules
  GET /schedules
  
  # Get schedule details
  GET /schedules/{schedule_id}
  
  # Update schedule
  PUT /schedules/{schedule_id}
  
  # Pause/resume schedule
  POST /schedules/{schedule_id}/pause
  POST /schedules/{schedule_id}/resume
  
  # Delete schedule
  DELETE /schedules/{schedule_id}

Execution History

Track schedule execution history and performance:

bash
GET /schedules/{schedule_id}/executions
  
  Response:
  {
    "executions": [
      {
        "id": "exec_123",
        "started_at": "2025-01-01T09:00:00Z",
        "completed_at": "2025-01-01T09:02:15Z",
        "status": "completed",
        "result": {...},
        "duration": 135.2
      }
    ],
    "stats": {
      "total_executions": 30,
      "success_rate": 96.7,
      "average_duration": 142.5
    }
  }

Error Handling

Schedules include robust error handling:

  • Automatic retries for failed executions
  • Exponential backoff for temporary failures
  • Alert notifications for persistent failures
  • Automatic schedule pausing after repeated failures
Schedules respect rate limits and will queue executions if necessary.

Best Practices

  • Use appropriate intervals to avoid overwhelming target websites
  • Set up monitoring and alerts for critical schedules
  • Test schedules with one-time executions first
  • Use webhooks for real-time notifications
  • Monitor execution history for performance optimization
  • Consider timezone differences for global operations
Scheduled tasks can use all rtrvr.ai features including Sheets workflows, MCP tools, and webhooks.