Security, Skills & Agentic Workflows
Cron Jobs & the SWIFT Framework for Workflows
An agent you have to remember to trigger is a command-line tool with extra steps. Every agent that ends up mattering crosses one line: it starts acting on a clock rather than on your attention. That crossing is also where agents start failing quietly — a task that runs at 6 AM has no one watching it, so the failure you find is the report that never arrived. Cron gives your agent the clock. The rest of this lesson is about not getting burned by it.
Cron Jobs: Scheduled Agent Automation
Cron is a time-based scheduler available on Linux and macOS systems. It runs commands at specified intervals — every minute, every hour, every day at 3 AM, every Monday at noon. For agent systems, cron turns reactive agents into proactive ones.
Cron Syntax
A cron expression has five fields:
┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-6, where 0 = Sunday)
│ │ │ │ │
* * * * *
Common patterns:
| Schedule | Cron Expression | Use Case |
|---|---|---|
| Every hour | 0 * * * * | Check for new messages or alerts |
| Daily at 8 AM | 0 8 * * * | Generate morning briefing |
| Every Monday at 9 AM | 0 9 * * 1 | Create weekly summary report |
| Every 15 minutes | */15 * * * * | Monitor service health |
| First day of month at midnight | 0 0 1 * * | Generate monthly analytics report |
Setting Up Agent Cron Jobs
To schedule an agent task, you create a cron entry that triggers the agent with a specific instruction:
# Edit your crontab
crontab -e
# Daily morning briefing at 8 AM
0 8 * * * /usr/local/bin/agent-cli run "Generate my daily briefing with calendar events, priority emails, and task list"
# Weekly content performance report every Monday at 9 AM
0 9 * * 1 /usr/local/bin/agent-cli run "Create a weekly content performance report and send it to my Telegram"
# Hourly website health check
0 * * * * /usr/local/bin/agent-cli run "Check if mywebsite.com is responding and alert me if it is down"
Each cron entry triggers the agent with a natural language instruction. The agent uses its configured skills, MCP connections, and memory to execute the task.
Cron Best Practices
- Log output: Redirect cron output to log files so you can debug failures. Append
>> /var/log/agent-cron.log 2>&1to each entry - Avoid overlap: If a task takes 10 minutes, do not schedule it every 5 minutes. Use lock files or check if a previous instance is still running
- Use absolute paths: Cron runs with a minimal environment. Always use full paths for commands and scripts
- Test manually first: Run the exact command from the terminal before adding it to crontab
The SWIFT Framework
Cron handles the "when." SWIFT handles the "how."
A note on the name, because it matters for how you use this. SWIFT here is a mnemonic this course uses to sequence the work — it is not a published framework with a maintainer, a specification, or a canonical site, and you should not cite it in a design review as though it were one. (There is unrelated academic work using the same acronym; it is not this.) The value is in the order of the five steps, which is the order people get wrong: almost everyone jumps from Setup straight to Trigger, schedules something they have run manually once, and then debugs a cron job at 6 AM.
Use it as a checklist, call it whatever you like, and treat any framework presented to you with a tidy acronym and no source the same way.
The five steps:
S — Setup
Define the goal and identify the tools needed.
- What is the desired outcome?
- What data sources does the agent need access to?
- What MCP servers, skills, or APIs are required?
- What permissions does the agent need?
Example: "I want a weekly YouTube channel report delivered to my email every Monday morning."
Setup checklist:
- YouTube MCP server configured with channel access
- Email MCP server configured for sending
- Agent has a skill for formatting analytics data
- Read-only YouTube access, send-only email access
W — Workflow
Design the step-by-step process the agent will follow.
Map out each action in sequence:
- Connect to YouTube MCP and retrieve channel statistics for the past 7 days
- Compare current metrics against the previous week
- Identify the top-performing video and the lowest-performing video
- Note any significant changes in subscriber count or watch time
- Format the data into a structured report with sections for overview, highlights, and recommendations
- Send the report via email MCP to the specified address
Each step should be specific enough that the agent can execute it without ambiguity.
I — Iterate
Test the workflow and refine based on results.
- Run the workflow manually and review the output
- Is the report format useful? Does it include the right metrics?
- Are there edge cases? What happens when the channel has no new videos that week?
- Does the agent handle API errors gracefully?
- Adjust the workflow steps, skill instructions, or formatting based on feedback
Expect to iterate multiple times. The first version of any workflow is a draft.
F — Formalize
Document the final process so it is reproducible and maintainable.
Create a workflow definition file:
name: weekly-youtube-report
description: Generates and sends a weekly YouTube channel performance report
version: 1.2
last_updated: 2026-03-20 # bump this on every edit — a stale date here is a lie about maintenance
trigger:
type: cron
schedule: "0 9 * * 1" # Every Monday at 9 AM
requirements:
mcp_servers:
- youtube # Channel read access
- email # Send access
skills:
- format-analytics-report
steps:
- retrieve YouTube channel stats for the past 7 days
- compare against previous week metrics
- identify top and bottom performing videos
- note significant subscriber and watch time changes
- format structured report with overview, highlights, recommendations
- send report via email to owner
constraints:
- do not share raw API data, only formatted summaries
- if YouTube API is unavailable, retry once then send a notification
- report should be under 500 words
T — Trigger
Set the activation method — how and when the workflow starts.
Triggers fall into three categories:
| Trigger Type | Description | Example |
|---|---|---|
| Manual | User explicitly requests execution | "Run my YouTube report now" |
| Scheduled | Cron job runs at specified times | Every Monday at 9 AM |
| Event-driven | Triggered by an external event | New video published, subscriber milestone reached |
For the YouTube report, we use a scheduled trigger (cron), but we also allow manual triggering so the user can request the report anytime.
Putting It All Together
Here is the full flow from ad-hoc usage to a formalized workflow:
- Ad-hoc: You manually ask the agent "How did my YouTube channel do this week?" every Monday
- Setup: You configure YouTube and email MCP servers, create an analytics formatting skill
- Workflow: You design a six-step process from data retrieval to report delivery
- Iterate: You run it three times, adjusting the report format and adding error handling
- Formalize: You document the workflow in a definition file with constraints and requirements
- Trigger: You add a cron job for Monday 9 AM and keep manual triggering available
The result: a task that used to take you 20 minutes of manual work now runs automatically, produces consistent output, and is documented well enough that you could hand it to someone else.
Key takeaway: Cron jobs transform your agent from reactive to proactive. The SWIFT framework ensures your workflows are not just automated but also designed, tested, documented, and maintainable. Start with one workflow you repeat weekly, apply SWIFT, and build from there.
Next module: Real-world builds — putting everything together to create complete agent systems you can deploy and monetize. :::
Sign in to rate