The Deployment Cliff: Making It Run While You Sleep
Building an agent that works on your laptop is one thing. Having it work at 3 AM when you're asleep is a different thing. This is the deployment cliff.
A piece of software that runs on demand (you start it, it does the thing, you stop it) is a script. A piece of software that runs 24/7, survives reboots, recovers from crashes, and produces logs you can read when something goes wrong is a service.
The difference matters when you're running an agent for a small business. The customer who emails at 11 PM doesn't want their reply at 9 AM tomorrow when you start the agent. They want it tonight. That requires a service.
THE BASIC SERVICE STACK:
A PROCESS MANAGER. The thing that keeps your agent running.
- macOS: launchd (built in) or
pm2for Node-based agents. - Linux: systemd (built in).
- Cross-platform: Docker with a restart policy
(
restart: unless-stopped).
A LOG FILE. Every agent action writes to a log. When something goes wrong, the log tells you what.
- Where: a known location like
/var/log/your-agent/agent.logon Linux or~/Library/Logs/your-agent/on macOS. - Rotation: the log file grows; rotate it (start a new file when the old one hits a size or age limit) or it'll fill the disk.
A HEALTH CHECK. A simple way to verify the agent is running.
- Easiest: a heartbeat file that the agent updates every minute. A separate script reads the timestamp, alerts if it's stale.
- Better: an HTTP endpoint that returns "OK" if the agent is healthy, "ERROR" otherwise. A monitoring service (UptimeRobot, Pingdom, even a simple cron job) hits the endpoint every five minutes.
AN ALERTING CHANNEL. When the health check fails, somebody has to know.
- Easiest: a Twilio script that sends you a text.
- Slightly fancier: a webhook to a Slack channel.
- Pre-built: UptimeRobot, Healthchecks.io.
POWER MANAGEMENT. If the Mac mini in the closet is the host, configure it not to sleep, and configure it to auto-start after a power outage. On macOS, this is in System Settings → Energy. On Linux, it's a BIOS setting.
A practical setup for a roofer's Mac mini:
- Mac mini, plugged into a UPS (backup battery, $80) so a 30-second power blip doesn't take you offline.
- Configured to auto-start on power restoration.
- Ollama running as a launchd service.
- Your CrewAI agent running as a launchd service, restarting on crash.
- A shell script that writes "alive" to a heartbeat file every 60 seconds.
- Healthchecks.io (free) pinging your agent's heartbeat URL every five minutes; sends you a text if it goes silent.
- A weekly cron job that emails you the log file summary.
Total recurring cost: $0. Total setup time: 2-4 hours, mostly waiting for things to install.
This is what production looks like for a small business. It's not fancy. It works.
================================================================================ PART 7 — REAL-WORLD APPLICATIONS
Something wrong on this page? →
Curriculum last updated 2026-04-30