How to Schedule AI Agents with Cron Jobs (Automated Workflows)
What if your AI agent could work while you sleep? Not in a creepy sci-fi way — in a "generate my weekly report every Monday at 9am" way.
Most AI agent platforms require you to manually trigger every interaction. You open a chat, type a prompt, wait for a response. That's fine for ad-hoc questions, but useless for the workflows that actually save you time: daily summaries, weekly competitive analysis, hourly monitoring alerts, monthly customer outreach.
This guide shows you how to set up scheduled AI agents that run automatically on any cadence — from every 5 minutes to once a month.
Last updated: June 2026
Why Schedule AI Agents?
The best use cases for scheduled agents aren't the ones you'd use ChatGPT for. They're the boring, repetitive tasks that a human does reliably but resentfully:
| Use Case | Schedule | What the Agent Does |
|---|---|---|
| Daily standup summary | cron(0 9 * * ? *) (9am daily) | Pulls PRs, tickets, and commits; writes a Slack-ready summary |
| Weekly competitor monitor | rate(7 days) | Searches news/Reddit for competitor mentions, writes digest |
| Hourly uptime check | rate(1 hour) | Hits your endpoints, reports failures to Slack |
| Monthly report | cron(0 6 1 * ? *) (1st of month) | Aggregates analytics, generates PDF-style report |
| Content calendar reminder | rate(3 days) | Checks your editorial calendar, reminds you what's due |
The key insight: agents with tools are dramatically more useful on a schedule than plain LLMs. A scheduled prompt to Claude is just a fancy cron email. A scheduled agent with MCP tools can actually do things — search the web, query databases, send messages.
How It Works on Universal API
Universal API has a built-in cron system that connects to AWS EventBridge Scheduler under the hood. You don't need to set up any infrastructure — just pick an agent, write a prompt, and set a schedule.
Step 1: Create an Agent
First, you need an agent that does something useful. Here's a simple example — a daily news summarizer:
import os
from strands import Agent
from strands.models.bedrock import BedrockModel
from strands.tools.mcp import MCPClient
from strands.tools.mcp.mcp_client import StreamableHTTPTransport
def create_agent():
model = BedrockModel(
model_id="us.anthropic.claude-sonnet-4-20250514-v1:0",
region_name="us-east-1"
)
# Connect to SerpAPI MCP server for web search
transport = StreamableHTTPTransport(
url="https://mcp.api.universalapi.co/mcp/s/snowtimber/serpapi",
headers={"Authorization": f"Bearer {os.environ.get('UNIVERSALAPI_BEARER_TOKEN', '')}"}
)
mcp_client = MCPClient(transport=transport)
agent = Agent(
model=model,
system_prompt="""You are a daily news summarizer. When prompted, search for the latest
news on the given topic using google_news, then write a concise 5-bullet summary
with links. Format for Slack (use *bold* for headlines).""",
tools=[mcp_client]
)
return agent, [mcp_client]Step 2: Create a Cron Job
Once your agent exists, create a cron job via the API or the dashboard:
curl -X POST https://api.universalapi.co/cron \
-H "Authorization: Bearer $UNIVERSALAPI_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "daily-ai-news",
"agentId": "YOUR_AGENT_ID",
"schedule": "cron(0 15 * * ? *)",
"inputMessage": "Search for the top AI and MCP news from the last 24 hours. Write a 5-bullet summary."
}'Or use the MCP tool directly from Claude/Cline:
create_cron(
name="daily-ai-news",
agentId="YOUR_AGENT_ID",
schedule="cron(0 15 * * ? *)",
inputMessage="Search for the top AI news from the last 24 hours.",
bearerToken="auto"
)Step 3: That's It
Your agent now runs every day at 3pm UTC. Each execution is logged, and you can review the conversation history in the dashboard.
Schedule Formats Explained
Universal API supports two formats:
Rate Expressions (Simple)
For recurring intervals:
rate(5 minutes) # Every 5 minutes
rate(1 hour) # Every hour
rate(12 hours) # Twice daily
rate(1 day) # Daily
rate(7 days) # WeeklyCron Expressions (Precise)
For specific times (6 fields: min hour day-of-month month day-of-week year):
cron(0 9 * * ? *) # 9:00 AM UTC daily
cron(0 9 ? * MON *) # 9:00 AM UTC every Monday
cron(0 6 1 * ? *) # 6:00 AM UTC on the 1st of each month
cron(0/15 * * * ? *) # Every 15 minutes
cron(0 18 ? * MON-FRI *)# 6:00 PM UTC weekdays onlyTimezone support: Set scheduleTimezone to any IANA timezone:
{
"schedule": "cron(0 9 * * ? *)",
"scheduleTimezone": "America/New_York"
}Real-World Examples
Example 1: Reddit Lead Finder
An agent that monitors Reddit for people asking about MCP servers, AI tools, or your product category:
def create_agent():
model = BedrockModel(model_id="us.anthropic.claude-sonnet-4-20250514-v1:0", region_name="us-east-1")
# Connect to SerpAPI for Reddit search
serpapi = MCPClient(StreamableHTTPTransport(
url="https://mcp.api.universalapi.co/mcp/s/snowtimber/serpapi",
headers={"Authorization": f"Bearer {os.environ.get('UNIVERSALAPI_BEARER_TOKEN', '')}"}
))
agent = Agent(
model=model,
system_prompt="""You monitor Reddit for potential leads. Search the given subreddits
for posts where people are asking about MCP servers, AI agent tools, or hosted AI platforms.
For each relevant post, provide the title, URL, a relevance score (1-10), and a suggested reply.""",
tools=[serpapi]
)
return agent, [serpapi]Cron schedule: rate(12 hours) — twice daily Input message: "Search r/mcp, r/ClaudeAI, and r/cursor for posts from the last 12 hours about MCP server hosting, AI agent platforms, or tool integration."
Example 2: Daily Standup Generator
An agent connected to GitHub that writes your standup message:
# System prompt for a standup generator
"""You generate daily standup summaries. When prompted:
1. Check recent GitHub activity (commits, PRs, issues)
2. Summarize what was done yesterday
3. Suggest focus areas for today
4. Flag any blockers
Format as a Slack message with emoji bullets."""Cron schedule: cron(0 14 ? * MON-FRI *) (9am ET, weekdays) Input message: "Generate my daily standup for the universalapi repo. Focus on commits and PR activity from the last 24 hours."
Example 3: Competitive Intelligence
Weekly scan of competitor announcements:
Cron schedule: rate(7 days)Input message: "Search Google News and Reddit for mentions of Smithery, Glama, Composio, Vapi, and Retell from the past week. Summarize any new features, pricing changes, or notable discussions. Compare to our current capabilities."
Auto-Pause on Failures
If your cron job fails 3 times in a row, it automatically pauses (status → error) and the EventBridge schedule is disabled. This prevents runaway credit consumption from broken agents.
To resume after fixing the issue:
curl -X PUT https://api.universalapi.co/cron/YOUR_CRON_ID \
-H "Authorization: Bearer $UNIVERSALAPI_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "active"}'Billing
Cron jobs cost the same as normal agent invocations — you pay for the credits your agent uses per execution. There's no additional charge for the scheduling itself.
A typical text agent invocation costs 2-20 credits depending on complexity. So a daily agent at ~10 credits/run costs about 300 credits/month.
FAQ
Can I see the output of scheduled runs?
Yes. Every cron execution creates a conversation in the agent's history. You can review them in the dashboard or via the API:
curl https://api.universalapi.co/agent/YOUR_AGENT_ID/conversations \
-H "Authorization: Bearer $UNIVERSALAPI_BEARER_TOKEN"Can I connect the output to Slack or Discord?
Yes — use Channels alongside cron. The cron job triggers the agent, and the agent can send messages through a connected channel.
What's the minimum schedule interval?
rate(1 minute) is the technical minimum, but we recommend rate(5 minutes) or longer to avoid excessive credit usage.
Can I pass different prompts to the same agent on different schedules?
Yes — create multiple cron jobs pointing to the same agent with different inputMessage values.
Getting Started
- Create an account at universalapi.co
- Build an agent with the tools it needs (web search, databases, APIs)
- Create a cron job via the dashboard or API
- Monitor your scheduled runs in the Logs page
Your AI agent is now working 24/7. Go take a nap.
Have questions about scheduled agents? Join the conversation at r/mcp or check our documentation.