Optimizing 23 AI Agent Cron Jobs from $14/Day to $3/Day
Optimizing 23 AI Agent Cron Jobs from $14/Day to $3/Day
Fourteen dollars a day to three dollars a day is a great optimization. Here is exactly how we got there with 23 AI agent cron jobs running on macOS.
The Starting Point
We had 23 scheduled agent tasks running throughout the day:
- 8 content-related tasks (social media posts, email drafts, summaries)
- 6 monitoring tasks (log analysis, health checks, error detection)
- 5 data processing tasks (file organization, backup verification, data cleanup)
- 4 development tasks (test runs, dependency checks, code formatting)
All 23 were using the same model (Opus) with the same context window settings. Total daily cost: $14.23.
The Optimization Playbook
1. Model Routing - Saved $5.80/Day
Not every task needs the smartest model. We categorized each job by complexity:
- Simple tasks (file organization, formatting) - switched to Haiku. Cost dropped 95% per task.
- Medium tasks (email drafts, summaries) - switched to Sonnet. Cost dropped 70% per task.
- Complex tasks (code changes, debugging) - kept on Opus.
Result: 6 jobs on Haiku, 11 on Sonnet, 6 on Opus.
2. Prompt Compression - Saved $2.40/Day
Most prompts were bloated with context the agent did not need. We trimmed:
- Removed redundant instructions already in CLAUDE.md
- Cut example outputs from prompts (the agent already knew the format)
- Reduced system prompts from 2000+ tokens to under 500 tokens
3. Task Batching - Saved $1.90/Day
Instead of 8 separate content tasks, we batched them into 2 sessions. The agent processes all content tasks in a single context window instead of spinning up 8 separate ones. Fewer sessions means fewer system prompt tokens.
4. Caching - Saved $1.10/Day
For monitoring tasks that check the same systems daily, we cached the "normal" state and only sent diffs to the LLM. If nothing changed, the agent skips the LLM call entirely.
The Result
| Optimization | Daily Savings | |-------------|---------------| | Model routing | $5.80 | | Prompt compression | $2.40 | | Task batching | $1.90 | | Caching | $1.10 | | Total | $11.20 |
New daily cost: $3.03. Same 23 tasks, same quality of output.
- LLM Costs Monthly Breakdown for Agents
- LLM Model Routing for Cost Reduction
- Opus Orchestrator - Delegate to Sonnet and Haiku
Fazm is an open source macOS AI agent. Open source on GitHub.