What This Example Shows
- A
ConcurrentWorkflowswarm with three search-enabled agents running in parallel — News Curator, Market Watcher, Calendar Briefer - How to fan a swarm’s outputs into a Slack
blockspayload via an incoming webhook - A real cron schedule —
0 7 * * 1-5— that ships a useful briefing to your team channel before standup - The full pipeline in roughly 55 lines of Python with
requestsandpython-dotenvonly - A genuine ship-it-before-coffee pattern: 60 seconds to set up env vars, 5 minutes to install the cron
Get a free Swarms API key in 1 minute at swarms.world. Get a free Slack incoming webhook URL in 2 minutes from your workspace’s app directory (“Incoming Webhooks” → “Add to Slack” → pick a channel → copy the URL). Drop the cron line on any always-on box in 5 minutes. Total time-to-first-briefing: under 10 minutes.
Why You’ll Actually Use This
The briefing has the three sections you actually want before coffee: how the market opened in red or green, the top stories that touch your world, and what’s already booked on your calendar. It lands in Slack so you can’t miss it, your team sees the same context you do, and once Monday’s briefing shows up your morning quietly depends on it. That’s the whole pitch — useful enough that you forget it’s running.The Output
Here’s what shows up in your Slack channel at 7:00:01 every weekday:The Architecture
Step 1: Setup (60 seconds)
.env next to your script:
CALENDAR_TODAY is a simple string you can pipe in from icalBuddy, a Google Calendar export, or a quick gcalcli agenda call. The Calendar Briefer agent reformats whatever you hand it — no calendar API integration required for v1.Step 2: Define Three Concurrent Agents
Each agent is search-enabled where it needs to be, and each system prompt is under four sentences. Tight prompts keep the output Slack-shaped instead of essay-shaped.Step 3: Run the Concurrent Swarm
One POST to/v1/swarm/completions with swarm_type: "ConcurrentWorkflow". All three agents execute in parallel; you get an output array back keyed by role.
Step 4: Synthesize Into a Slack Block
A tiny synthesizer function turns the three agent outputs into a Slackblocks payload. No LLM call here — just string assembly. Cheap, fast, deterministic.
Step 5: Post to Slack
The webhook accepts JSON. One line.Step 6: Schedule It for 7AM Every Weekday
Save the script to/opt/briefing/brief.py on any always-on Linux box and add one line to your crontab (crontab -e):
On macOS (no cron) — use launchd
On macOS (no cron) — use launchd
Create
~/Library/LaunchAgents/com.you.briefing.plist with a StartCalendarInterval block for Hour=7, Minute=0, Weekday=1..5, point ProgramArguments at /usr/bin/python3 /Users/you/briefing/brief.py, then launchctl load it. macOS handles wake-on-schedule for you.On a Linux server — prefer a systemd timer
On a Linux server — prefer a systemd timer
Create
briefing.service (Type=oneshot, ExecStart=python brief.py) and briefing.timer (OnCalendar=Mon..Fri 07:00). systemctl enable --now briefing.timer. You get logs in journalctl -u briefing.service, no cron mail noise, and persistent timer state across reboots.On a serverless platform — easier still
On a serverless platform — easier still
Drop the script into a GitHub Actions workflow with
on: schedule: cron: '0 7 * * 1-5', or use a Vercel/Modal/Render cron job. No box to maintain.The Full Script (~55 lines)
Copy this intobrief.py, set the two env vars, and you’re done.
Variations
- Swap News Curator for a Hacker News Curator — change the system prompt to “Top 3 HN front-page stories from the last 24h with comment counts” and keep
search_enabled: True. - Add a Weather Briefer — fourth concurrent agent,
search_enabled: True, prompt: “One-line forecast and high/low for ”. - Post to Discord instead of Slack — Discord webhooks accept the same JSON shape with
contentinstead ofblocks; swap the synthesizer. - Send via email — replace the Slack POST with
smtplib.SMTPand render the same string as plain text. - Post at end-of-day with a wrap-up — flip the cron to
0 17 * * 1-5, retarget the prompts to “today’s closing recap” and “what shipped on HN today”.
Real Cost
Three agents, one run per weekday, ~21 runs/month. Each run uses roughly 1,500 input tokens and 600 output tokens across the swarm, plus two web-search calls. At current pricing, that’s about $0.012 per briefing × 21 runs = ~$0.25/month. Under $0.30/month for a deployment your team will notice if it ever fails.Next Steps
- Concurrent Workflow — the full pattern for parallel agents and when to reach for it
- Search-Enabled Agents — every option on the
search_enabledflag, including how to inspect the citations - Batch Processing — when one briefing isn’t enough and you want a briefing per team, per region, or per portfolio company on one cron tick