How to Set Up Scheduled AI Agents
On This Page
What a Scheduled Agent Does
A scheduled agent runs the same workflow on a repeating timer. Unlike event-driven agents that respond to incoming data (a new email, a form submission, a webhook), scheduled agents initiate their own work cycle. At the scheduled time, the cron system spawns the agent's workflow, which then queries for new data, processes it with AI, and takes action.
The most common use case is batch processing. New records accumulate throughout the day, and a scheduled agent processes them all at once during off-peak hours. A data processing agent scheduled to run every night at 2 AM can classify hundreds of records without interfering with daytime operations.
Scheduled agents also handle monitoring tasks. A website monitoring agent that runs every 15 minutes checks for downtime and content changes. A server monitoring agent that runs hourly analyzes log files for anomalies. The schedule ensures consistent coverage without anyone needing to remember to run the check.
Setting Up the Schedule
Schedules use a time format that specifies the hour and minute. The hour can be a specific number (0-23 in EST), a range (8-19 for business hours), or a wildcard (*) for every hour. The minute is a specific two-digit number (00, 15, 30, 45).
Schedule Examples
- Every hour at the top: Hour = *, Minute = 00. The agent runs at 12:00, 1:00, 2:00, and so on, every hour of the day.
- Every hour during business hours: Hour = 8-17, Minute = 00. The agent runs hourly from 8 AM to 5 PM EST, then stops for the night.
- Once daily at 6 AM: Hour = 6, Minute = 00. The agent runs exactly once per day at 6:00 AM EST.
- Twice daily: Create two schedule entries, one for Hour = 9, Minute = 00 and another for Hour = 17, Minute = 00. The agent runs at 9 AM and 5 PM.
- Every 15 minutes during business hours: Four schedule entries with Hour = 8-17 and Minutes = 00, 15, 30, 45 respectively.
Each account can turn scheduling on or off through the settings. When scheduling is turned off, no scheduled agents run for that account, but the schedule configuration is preserved so it can be re-enabled later.
Tracking State Between Runs
Because scheduled agents run repeatedly, they need to know what has already been processed. Without state tracking, the agent would reprocess the same data on every run, wasting credits and potentially sending duplicate notifications.
Timestamp-Based Tracking
The simplest approach is storing a "last run" timestamp. At the start of each run, the agent reads its state record from the database to find when it last ran. It then queries only for records created or modified after that timestamp. At the end of the run, it updates the state record with the current time.
Status Field Tracking
For record-level tracking, add a status field to each record. New records start with status "pending." The agent queries for pending records, processes each one, then updates the status to "completed" or "failed." On the next run, it queries for pending records again and only finds unprocessed ones.
Combining Both Methods
For maximum reliability, use both. The timestamp narrows the query range so the database scan is efficient, and the status field ensures no individual record is processed twice even if the agent's previous run was interrupted. This pattern is especially important for agents that process financial data or send customer notifications where duplicates cause real problems.
Common Scheduling Patterns
Daily Summary Agent
Runs once per day (typically early morning). Queries the previous day's data, sends it to the AI for summarization, and delivers a digest via email or SMS. Works well for sales reports, support ticket summaries, and activity logs. Use GPT-4.1-mini (about 4 credits per call) for generating readable summaries.
Hourly Monitor Agent
Runs every hour. Checks for specific conditions (website down, error rate spike, inventory low) and sends alerts only when a problem is detected. Most runs find nothing and cost only the database query. When the AI is called (on anomaly detection), it provides context about the issue. Use GPT-5-nano (about 1 credit) for simple threshold checks, GPT-4.1-mini for more nuanced analysis.
Business Hours Processing Agent
Runs every 15 or 30 minutes during business hours (8 AM - 6 PM). Processes incoming leads, support tickets, or orders in near-real-time during the workday, then pauses overnight. This balances responsiveness with cost, since running every minute would be expensive for tasks that can wait a few minutes.
Weekly Cleanup Agent
Runs once per week (Sunday night or Monday morning). Identifies stale records, archives old conversations, generates weekly metrics, and sends a summary report. The AI reviews the week's data patterns and highlights trends. Schedule it during low-traffic hours to minimize any performance impact.
Multi-Timezone Agent
For businesses serving customers across time zones, schedule the agent to run at the start of each major timezone's business day. Three schedule entries at 8 AM EST, 8 AM CST, and 8 AM PST ensure customers get processed at the appropriate local time. The workflow uses conditional logic to filter records by timezone.
Managing Costs for Recurring Agents
Scheduled agents can accumulate significant costs because they run repeatedly. An agent that costs 10 credits per run and runs every hour costs 240 credits per day, or about 7,200 credits per month ($7.20). Planning your schedule frequency and model choice carefully keeps costs reasonable.
Cost Reduction Strategies
- Right-size the frequency: If hourly processing is just as useful as processing every 15 minutes, use hourly. That is four times fewer runs and four times lower cost.
- Skip empty runs early: Add a database count check before the AI step. If no new records exist since the last run, exit immediately without calling the AI. Most scheduled runs cost only 1-2 credits for the database query.
- Use the cheapest viable model: GPT-5-nano at roughly 1 credit handles simple classification. GPT-4.1-mini at roughly 4 credits handles moderate analysis. Reserve expensive models for tasks where accuracy justifies the cost.
- Batch AI calls: Instead of sending one record per AI call, combine 5-10 records into a single prompt and ask the AI to classify all of them. This reduces the number of API calls and can cut costs by 50-80% for bulk classification tasks.
- Pause when not needed: If the business is seasonal or the data source has quiet periods, turn scheduling off during those times through the account settings.
Handling Failures in Scheduled Runs
When a scheduled agent fails partway through, the next scheduled run needs to pick up where it left off. This is why state tracking matters: if the agent updates each record's status as it processes, a partial failure leaves some records as "completed" and others still "pending." The next run processes only the pending ones.
Common failure scenarios for scheduled agents include API timeouts when calling external services, database throttling during high-traffic periods, and AI model rate limits when processing large batches. Add error handling branches to your workflow for each of these cases.
For critical agents (those processing payments, sending customer communications, or updating inventory), add a monitoring layer. The agent writes its completion status and record count to a log table. A separate lightweight monitor checks that the agent completed successfully and sends an alert if it did not run or if it processed fewer records than expected.
Step-by-Step: Create a Scheduled Agent
Set up AI agents that run on autopilot with configurable schedules. No coding required.
Get Started Free