My company runs on a handful of scheduled jobs on a Mac, one true agent in the cloud, and a few scripts that refuse to do dangerous things twice. Each job has its own identity, checks before it acts, catches up on what it missed, and waits for the network. One September morning taught me all four rules at once. This is what runs, honestly.
Part of the Always-on agents series, post 33 of 33.
There are two people at my company. Most mornings the first things I read are two logs. At 09:05 a job on my Mac publishes whatever blog post is due, and for the last thirty-three days that has been a post in this series. At 09:40 a second job reads the whole site, checks that a list of things is still true, and emails me only when one of them is not. Then there is Leo, the product, which has been running its own hourly loop for brands the whole time. This post is the honest account of all of it: what runs, what each job may touch, the morning it failed, and what I have learned.
What runs
| Job | When | What it does | Agent by my tests? |
|---|---|---|---|
| The publisher | Daily, 09:05 | Publishes every post whose date has arrived, re-renders the series hub, updates the sitemap and blog index, flushes the cache | No. A list I wrote, executed carefully. |
| The watchdog | Daily, 09:40 | Asserts the site invariants, checks every scheduled post and email in two content series, emails on failure | Narrowly. It holds a goal and acts, but every decision is a rule. |
| The schedulers | When I run them | Create newsletter sends and refuse to double-book; one of them moved sixteen emails in a day | No. Tools with guardrails. |
| Leo | Hourly, for every connected channel | Finds a trend, matches a clip from the brand's footage, edits it, books it. No match, no post | Yes. The only one. |
Five other scheduled jobs run on the same Mac under the same mechanism: an error bot, a trend report, two prospecting jobs and a follow-up job. I am not describing them here, because this post only covers what I can quote from the files, and those deserve their own write-up. The point of the table is the last column. By the three tests I set out in the first post, almost nothing I run is an agent, and I think that is the right shape for a company this size. The judgement sits in the product. Everything around it is plumbing, and plumbing should be boring.
What each one may touch
The publisher may upload. Before it does, it asks the storage bucket whether the object already exists, so running it twice does nothing. It takes a lock file that the watchdog also honours, so the two can never edit the sitemap or the blog index at the same moment; a lock older than thirty minutes is treated as stale and cleared. A single empty file on disk pauses both jobs. Every cloud call it makes is pinned to a service account made for these jobs rather than my own login, because that login expires and cannot be renewed without a person at the keyboard, a lesson I wrote up in the permissions post.
The watchdog may read everything and delete nothing. Before it edits a file it copies it into a dated backup folder; after it edits, it parses the result (the sitemap as XML, the blog index as JSON) and counts what changed against what it expected, and if either check fails nothing is uploaded and I get an email instead. The things it asserts every morning: the safety guard is still inside the script that once produced 107 identical posts, all 107 still carry their noindex tag, no new duplicate has appeared, at least 27 hand-written posts still exist, and every post and email scheduled in the two running series is live or still queued where it should be. On 17 October it emailed me a false alarm because one request to the newsletter service timed out; it now retries, and only treats a client error as final.
Leo may post, on accounts connected through OAuth, on the schedule the brand set, and only when a clip matches a signal. It never holds a password. That rule is older than this series and it is the reason I wrote the publishing post the way I did.
The morning it failed
On Sunday 21 September the Mac was asleep at 09:05. launchd, which is honest about this in its own manual, runs a missed calendar job the next time the machine wakes. It woke at 09:29, and the job fired before Wi-Fi had come back. This is the log, with the path shortened:
account-risk-launchd.log, 21 September 2026===== 2026-09-21 09:29:01 EDT =====
2026-09-21 09:29:01 run: date=2026-09-21 dry=False
2026-09-21 09:29:03 publishing own-the-footage-rent-the-feed (scheduled 2026-09-21)
2026-09-21 09:29:04 FAILED: gcloud failed: gcloud storage cp .../own-the-footage-rent-the-feed.svg
gs://leo-ai.io/blog-cards/own-the-footage-rent-the-feed.svg ...
ERROR: (gcloud.storage.cp) There was a problem refreshing your current auth tokens:
HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded
(Caused by NameResolutionError("Failed to resolve 'oauth2.googleapis.com'
([Errno 8] nodename nor servname provided, or not known)"))Three seconds from start to failure, on the very first network call, which happened to be the token refresh. The post went out at 18:55 that evening, by hand, after I happened to look. Nothing had told me. The job had done exactly what I built it to do, which was to try once at the scheduled time; I had simply never imagined the scheduled time arriving with no network.
The three rules, and the fourth
The fix was small and it has shaped everything since. The wrapper that launchd runs now looks like this, again with paths shortened:
run-account-risk-publish.sh, the part that mattersnet_up() {
python3 -c 'import socket; [socket.getaddrinfo(h, 443)
for h in ("oauth2.googleapis.com", "storage.googleapis.com")]' 2>/dev/null
}
for i in {1..20}; do
net_up && break
echo "network not up yet (try $i/20), waiting 30s"
sleep 30
done
python3 publish-account-risk.py "$@" && exit 0
echo "publisher failed; retrying once in 5 minutes"
sleep 300
python3 publish-account-risk.py "$@"- Idempotent. Check whether the action already happened before doing it. The publisher asks the bucket; the schedulers ask the newsletter service whether a send with that name exists. A second run must be harmless, because the retry above depends on it.
- Catch-up. Act on everything due on or before today, not only what is due today. A day the Mac is asleep heals itself the next morning, and the log shows the catch-up as a plain skip of what is already live.
- Wait for the world. Twenty tries, thirty seconds apart, for the two hosts every upload needs, then one retry five minutes later. Ten minutes of patience is cheaper than one lost day.
- Its own identity. A service account for the job, never my login. The fourth rule is the one that costs nothing until the night it saves you.
The jobs around the jobs
Two scripts I do not run on a schedule turned out to matter as much as the ones I do. The newsletter scheduler creates a send and refuses if one with that name already exists or if anything is already queued that day; then it reads the send back and checks nine things, including that the unsubscribe tag survived. On 20 October, when I cleared the calendar for this series, a second script moved sixteen scheduled emails by five weeks. Before it changed anything it fetched every one of the sixteen and asserted that each was still scheduled at the time I expected; one mismatch would have stopped the whole run. Afterwards it read each one back and saved before-and-after snapshots. That is not an agent. It is the discipline an agent would need, applied to a tool.
What I would do differently
- A heartbeat from the first day. The watchdog's silence is now a signal I trust, but for the first month the only signal was a log nobody read. Build the check before the job.
- A machine that does not sleep. Our jobs run on a laptop. A Mac mini on a shelf would have made the September morning impossible, and I covered why in the Mac post.
- Fewer places for a date to live. Until this month the watchdog carried its own copy of the publishing schedule and drifted from it. The series schedule now lives in one file that the publisher, the watchdog and the post generator all import.
- The pause switch earlier. One empty file that stops every job is the cheapest safety feature I have, and I added it last.
What this series taught me
I wrote thirty-three posts in thirty-three days and the same 09:05 job published every one of them, re-rendering the hub page each morning so it never linked to a post that was not live yet. The post generator refused to stage anything that was not in my first person, anything with a banned word, anything too similar to another page, or anything that linked forward to a page that did not exist yet. Those gates refused more than one draft of mine. The series was, in other words, produced by the kind of system it describes: a goal, a clock, checks before acting, and a human reading the log.
If I had to compress a month into a sentence for a marketing team, it is the one I used in the marketing post: hand the agents the jobs with a clock and a definition of done, keep the judgement about what the brand says, and keep a person on anything that cannot be undone. And if you would rather see the one job in my company that is a real agent than build any of this, it is here. Thank you for reading along. The log says this one went out on time.
Sources
- Apple Developer Documentation, Scheduling timed jobs (launchd calendar intervals and missed jobs) (accessed October 20, 2026)
- Leo AI, Always-on: a channel that runs itself (accessed October 20, 2026)
- Leo AI, The Always-on agents series hub (accessed October 20, 2026)
Written by Lera Leonteva. Every log line and configuration excerpt above is quoted from the files on my own machine, with paths shortened.