Security, Skills & Agentic Workflows
Cron Jobs & the SWIFT Framework for Workflows
Until now, your agent acts when you tell it to. But the real power of an autonomous agent is doing work without being asked — monitoring, reporting, maintaining, and responding on a schedule. Cron jobs give your agent a clock. The SWIFT framework gives it a blueprint for turning ad-hoc tasks into repeatable, documented workflows.
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." The SWIFT framework is a structured approach to designing agentic workflows that are repeatable, documented, and maintainable.
SWIFT stands for:
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: 2025-01-15
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. :::