← Resources
guide·
Mar 15, 2026·12 min
Updated Mar 24, 2026

The Complete Guide to Scheduling Tasks for AI Agents

By Govind Kavaturi

Five stars in ascending diagonal path connected by silver lines

You run three AI agents on a Mac Mini. One polls your CRM for new leads, another sends follow-up sequences, and a third processes support tickets overnight. They work great when they work - but when something goes wrong, you find out days later when customers complain. What if your agents could register their own checkpoints, report completion when tasks fire on schedule, and confirm successful delivery? That's accountability through automation: Schedule -> Deliver -> Confirm.

TL;DR: AI agents running on local hardware like Mac Minis can handle tasks like CRM polling and support ticket processing, but failures often go undetected for days until customers complain. The solution is implementing self-reporting checkpoints where agents can register their own health status and task completion.

Key Takeaways: - 3 AI agents running on Mac Mini can handle CRM leads, follow-ups, and support tickets, but failures often go undetected for days until customers complain - The Schedule -> Deliver -> Confirm accountability model ensures agents register checkpoints, report completion, and verify successful delivery of time-dependent tasks - Cron jobs lack retry logic, execution history, and multi-tenancy support, creating single points of failure when agents need to poll APIs every 15 minutes or send 24-hour follow-ups - In-process timers using setTimeout and message queues with delayed delivery have critical limitations like 15-minute maximum delays in SQS and memory leaks in long-running processes

That's the accountability gap. Your agents went quiet, and you had no idea.

Modern AI agents are not just chatbots. They interact with external systems, manage long-running workflows, and coordinate with other agents. When these interactions are time-dependent - poll an API every hour, send a follow-up email tomorrow, retry a failed task in five minutes - they need scheduling. More importantly, you need to know they actually ran.

Why Agents Need Scheduling (And Accountability)

AI agents handle time-dependent work that requires execution visibility:

  • Polling external APIs: Check for new data every 15 minutes
  • Sending follow-ups: Email a user 24 hours after signup
  • Retry logic: Retry a failed API call with exponential backoff
  • Batch processing: Run a data pipeline every night at midnight
  • Health checks: Verify upstream services every 5 minutes
  • Multi-agent coordination: Agent A triggers Agent B after completing a step

Without a scheduling layer, agents resort to setTimeout, sleep loops, or cron jobs. Without accountability, you are flying blind on delivery vs outcome.

The Problem with DIY Scheduling

Cron Jobs

Cron is the most common scheduling tool. It works - until it does not. More critically, cron has no concept of success.

  • Single point of failure: Cron runs on one server. If that server restarts, scheduled tasks disappear.
  • No retry logic: If a cron job fails, it does not retry. You find out when someone notices the data is stale.
  • No execution history: Cron does not track whether a job ran, succeeded, or failed.
  • No multi-tenancy: Every agent shares the same crontab. Isolation requires manual orchestration.
  • Deployment complexity: Adding or removing cron jobs requires SSH access and server restarts.

In-Process Timers

Using setTimeout, setInterval, or Python's asyncio.sleep inside your agent process:

  • Lost on restart: When the process restarts, all pending timers vanish.
  • Memory leaks: Long-running timers accumulate and consume memory.
  • No persistence: If the agent crashes, scheduled work is lost.
  • Scaling issues: Running multiple instances means duplicate firings or missed tasks.

Message Queues with Delayed Delivery

Some teams use RabbitMQ or SQS with delayed messages:

  • Maximum delay limits: SQS caps delay at 15 minutes. RabbitMQ's delay plugin has similar constraints.
  • No cron support: Recurring schedules require external scheduling to enqueue messages.
  • Operational overhead: Running and maintaining a message broker is a significant burden.

What Is a Scheduling API?

A scheduling API is a managed service that handles time-based task execution with verified success. You register tasks via API calls, and the service fires them at the right time. The key properties:

  1. Persistence: Tasks survive server restarts and deployments.
  2. Reliability: Built-in retries ensure tasks are delivered even if the first attempt fails.
  3. Execution visibility: Every execution is logged with timestamps, status, and outcome.
  4. Multi-tenancy: Each user or agent gets isolated tasks and usage tracking.
  5. API-first: No SSH, no crontab files, no server configuration. Just HTTP calls.

This runs anywhere your agents run - from a Mac Mini to distributed cloud deployments.

How CueAPI Works

CueAPI is a scheduling API designed specifically for AI agents. Here is how the core flow works:

Step 1: Create a Cue

A cue is a scheduled task. You create one by calling the CueAPI endpoint with a schedule and a callback:

curl -X POST https://api.cueapi.ai/v1/cues \
  -H "Authorization: Bearer cue_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "hourly-data-sync",
    "schedule": {
      "type": "recurring",
      "cron": "0 * * * *",
      "timezone": "UTC"
    },
    "transport": "webhook",
    "callback": {
      "url": "https://your-agent.com/webhook",
      "method": "POST"
    },
    "payload": {
      "action": "sync_data",
      "source": "salesforce"
    }
  }'
import httpx

response = httpx.post("https://api.cueapi.ai/v1/cues", 
    headers={
        "Authorization": "Bearer cue_sk_your_key",
        "Content-Type": "application/json"
    }, 
    json={
        "name": "hourly-data-sync",
        "schedule": {
            "type": "recurring",
            "cron": "0 * * * *",
            "timezone": "UTC"
        },
        "transport": "webhook",
        "callback": {
            "url": "https://your-agent.com/webhook",
            "method": "POST"
        },
        "payload": {
            "action": "sync_data",
            "source": "salesforce"
        }
    })

This creates a cue that fires every hour. When it fires, CueAPI POSTs the payload to your callback URL.

Step 2: Receive the Webhook

When a cue fires, CueAPI creates an execution and delivers it:

{
  "execution_id": "exec_abc123",
  "cue_id": "cue_xyz789",
  "cue_name": "hourly-data-sync",
  "payload": {
    "action": "sync_data",
    "source": "salesforce"
  },
  "scheduled_for": "2026-03-15T14:00:00Z",
  "attempt": 1
}

Your agent processes the payload and reports the outcome.

Step 3: Report the Outcome

After processing, report success or failure back to CueAPI:

curl -X POST https://api.cueapi.ai/v1/executions/exec_abc123/outcome \
  -H "Authorization: Bearer cue_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "success": true,
    "result": "Synced 142 records",
    "metadata": {"records_synced": 142}
  }'
import httpx

response = httpx.post("https://api.cueapi.ai/v1/executions/exec_abc123/outcome",
    headers={
        "Authorization": "Bearer cue_sk_your_key",
        "Content-Type": "application/json"
    },
    json={
        "success": True,
        "result": "Synced 142 records", 
        "metadata": {"records_synced": 142}
    })

CueAPI logs the outcome. If the webhook delivery fails, CueAPI retries automatically.

Schedule Types

CueAPI supports two schedule types:

Recurring Schedules (Cron)

Standard 5-field cron expressions:

ExpressionMeaning
0 Every hour
/15 *Every 15 minutes
0 9 1-5Weekdays at 9 AM
0 0 1 First of every month
30 2 *Daily at 2:30 AM

One-Time Schedules

Fire once at a specific time:

{
  "schedule": {
    "type": "once",
    "at": "2026-03-20T15:00:00Z",
    "timezone": "UTC"
  }
}

Perfect for delayed tasks: "send a reminder in 24 hours" or "retry this in 5 minutes."

Webhook Transport

CueAPI POSTs execution data to your callback URL when cues fire. Best for:

  • Agents with a public HTTP endpoint
  • Serverless functions (AWS Lambda, Cloudflare Workers)
  • Microservices behind a load balancer

All cues use webhook transport by specifying a callback URL in the cue configuration.

Retry and Failure Handling

CueAPI retries failed webhook deliveries automatically:

  1. First retry: 1 minute after failure
  2. Second retry: 5 minutes after first retry
  3. Third retry: 15 minutes after second retry

If all retries fail, the execution is marked as failed and failure notifications are sent based on your cue configuration.

You can customize retry behavior per cue:

{
  "retry": {
    "max_attempts": 5,
    "backoff_minutes": [1, 5, 15, 60, 360]
  },
  "on_failure": {
    "email": true,
    "webhook": null,
    "pause": false
  }
}

Security

CueAPI provides multiple security layers:

  • API key authentication: Every request requires a valid Authorization: Bearer header.
  • Webhook secrets: CueAPI signs webhook payloads with HMAC-SHA256. Your agent verifies the signature to ensure the webhook came from CueAPI.
  • Key rotation alerts: When an API key is regenerated, CueAPI sends an email notification and returns a key_rotated error code for 24 hours on the old key.
  • Rate limiting: Per-user rate limits prevent abuse. Headers include X-RateLimit-Remaining and X-RateLimit-Reset.

Agent Accountability and Execution Visibility

Every execution is tracked with:

  • Status: pendingdeliveringdelivered or failed
  • Timestamps: scheduled_for, started_at, completed_at
  • Attempt count: How many delivery attempts were made
  • Outcome: The result reported by your agent (success, failure, error)
  • Output data: Any JSON output your agent returns

Query execution history via the API:

curl https://api.cueapi.ai/v1/cues/cue_xyz789 \
  -H "Authorization: Bearer cue_sk_your_key"
import httpx

response = httpx.get("https://api.cueapi.ai/v1/cues/cue_xyz789",
    headers={"Authorization": "Bearer cue_sk_your_key"})

Common Agent Patterns

Pattern 1: Delayed Follow-Up

Schedule a one-time cue to fire 24 hours from now:

curl -X POST https://api.cueapi.ai/v1/cues \
  -H "Authorization: Bearer cue_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "follow-up-user-123",
    "schedule": {
      "type": "once", 
      "at": "2026-03-16T14:00:00Z",
      "timezone": "UTC"
    },
    "transport": "webhook",
    "callback": {
      "url": "https://agent.example.com/follow-up",
      "method": "POST"
    },
    "payload": {"user_id": "123", "action": "send_follow_up"}
  }'
import httpx

response = httpx.post("https://api.cueapi.ai/v1/cues",
    headers={
        "Authorization": "Bearer cue_sk_your_key",
        "Content-Type": "application/json"
    },
    json={
        "name": "follow-up-user-123",
        "schedule": {
            "type": "once",
            "at": "2026-03-16T14:00:00Z",
            "timezone": "UTC"
        },
        "transport": "webhook",
        "callback": {
            "url": "https://agent.example.com/follow-up",
            "method": "POST"
        },
        "payload": {"user_id": "123", "action": "send_follow_up"}
    })

Pattern 2: Health Check Monitor

Ping an endpoint every 5 minutes and alert on failure:

curl -X POST https://api.cueapi.ai/v1/cues \
  -H "Authorization: Bearer cue_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "health-check-prod",
    "schedule": {
      "type": "recurring", 
      "cron": "*/5 * * * *",
      "timezone": "UTC"
    },
    "transport": "webhook",
    "callback": {
      "url": "https://agent.example.com/health-check",
      "method": "POST"
    },
    "payload": {"target": "https://api.example.com/health"}
  }'
import httpx

response = httpx.post("https://api.cueapi.ai/v1/cues",
    headers={
        "Authorization": "Bearer cue_sk_your_key",
        "Content-Type": "application/json"
    },
    json={
        "name": "health-check-prod",
        "schedule": {
            "type": "recurring",
            "cron": "*/5 * * * *",
            "timezone": "UTC"
        },
        "transport": "webhook",
        "callback": {
            "url": "https://agent.example.com/health-check",
            "method": "POST"
        },
        "payload": {"target": "https://api.example.com/health"}
    })

Pattern 3: Multi-Agent Pipeline

Agent A schedules Agent B to run after processing:

curl -X POST https://api.cueapi.ai/v1/cues \
  -H "Authorization: Bearer cue_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "agent-b-run-2026-03-16T14:05:00Z",
    "schedule": {
      "type": "once", 
      "at": "2026-03-16T14:05:00Z",
      "timezone": "UTC"
    },
    "transport": "webhook",
    "callback": {
      "url": "https://agent-b.example.com/process",
      "method": "POST"
    },
    "payload": {"source": "agent-a", "batch_id": "batch_456"}
  }'
import httpx
from datetime import datetime, timedelta, timezone

# The Complete Guide to Scheduling Tasks for AI Agents
next_run = datetime.now(timezone.utc) + timedelta(minutes=5)

response = httpx.post("https://api.cueapi.ai/v1/cues", 
    headers={
        "Authorization": "Bearer cue_sk_your_key",
        "Content-Type": "application/json"
    }, 
    json={
        "name": f"agent-b-run-{next_run.isoformat()}",
        "schedule": {
            "type": "once", 
            "at": next_run.isoformat(),
            "timezone": "UTC"
        },
        "transport": "webhook",
        "callback": {
            "url": "https://agent-b.example.com/process",
            "method": "POST"
        },
        "payload": {"source": "agent-a", "batch_id": "batch_456"}
    })

Getting Started

  1. Sign up at https://cueapi.ai and get your API key
  2. Create your first cue: Use the API to register a scheduled task
  3. Set up your webhook endpoint to receive execution data
  4. Monitor executions via the API

Full API documentation is available at https://docs.cueapi.ai.

FAQ

Q: How is this different from cron? A: CueAPI provides execution visibility and accountability. You know if your agent ran, succeeded, or failed. Cron just fires and forgets.

Q: Can I use this with serverless functions? A: Yes. CueAPI works with any HTTP endpoint - Lambda, Cloudflare Workers, or your agent running on localhost.

Q: What happens if my agent goes offline? A: CueAPI retries failed deliveries automatically. You get execution history showing what happened and when.

Q: How do I handle failures? A: Report outcomes back to CueAPI. Configure failure notifications via email or webhook to alert you immediately.

Summary

Scheduling with accountability closes the gap between delivery and outcome. CueAPI provides API-first scheduling that runs anywhere your agents run, with verified success tracking for every execution. Replace your cron jobs, remove your timer hacks, and know your agents actually worked.

Make your agents accountable. Know they worked. Get on with building.


Schedule -> Deliver -> Confirm -> Make your agents accountable. Know they worked. Get on with building.


Make your agents accountable. Free to start.

Frequently Asked Questions

What happens when AI agents fail without proper scheduling accountability?

When AI agents lack scheduling accountability, failures often go undetected for days until customers complain about missing follow-ups or stale data. You might discover that your CRM polling agent stopped working three days ago, or that support tickets haven't been processed overnight, only when users start reaching out about delays.

Why can't I just use cron jobs for scheduling my AI agents?

Cron jobs create single points of failure and lack essential features for reliable agent scheduling. They have no retry logic when tasks fail, no execution history to track success or failure, and no multi-tenancy support, making them unsuitable for agents that need to poll APIs every 15 minutes or send time-sensitive follow-ups.

What is the Schedule -> Deliver -> Confirm accountability model?

This model ensures complete visibility into your AI agent workflows by requiring agents to register their own checkpoints, report task completion when scheduled events fire, and confirm successful delivery of their work. It transforms unreliable "fire and forget" scheduling into accountable, trackable automation.

What are the limitations of using setTimeout or message queues for agent scheduling?

In-process timers like setTimeout can cause memory leaks in long-running processes and disappear when applications restart. Message queues have their own constraints, such as SQS's 15-minute maximum delay limit, making them inadequate for longer scheduling intervals that agents often require.

How many AI agents can effectively run on local hardware like a Mac Mini?

A Mac Mini can effectively run multiple AI agents handling different tasks like CRM polling, follow-up sequences, and support ticket processing. The key limitation isn't the number of agents, but ensuring proper scheduling and accountability mechanisms so you can monitor their health and task completion in real-time.

Sources


About the Author

Govind Kavaturi is co-founder of Vector Apps Inc. and CueAPI. Previously co-founded Thena (reached $1M ARR in 12 months, backed by Lightspeed, First Round, and Pear VC, with customers including Cloudflare and Etsy). Building AI-native products with small teams and AI agents. Forbes Technology Council member.

Get started

pip install cueapi
Get API Key →

Related Articles

How do I know if my agent ran successfully?
Ctrl+K