# My AI agent's scheduled jobs used a third of my subscription. Now they cost about $1 a month.

At home I run an AI agent on a small server ([Hermes](https://github.com/NousResearch/hermes-agent)). Besides chatting with me on Telegram, it runs 25 scheduled jobs: a sports digest, local events, a weekly TV-series check, a news early-warning summary, a weekly Home Assistant audit, a morning briefing and so on.

Every job was a prompt. At the set time the agent woke up, searched the web, opened pages, retried, wrote a message and sent it. It worked well. It ran on my ChatGPT subscription (about **$125 a month**), which I also used for chatting with the agent and for coding.

Now I am moving to a smaller Claude subscription, and I need it for programming. Routine jobs should not eat it. So I rewrote them.

## How much the agent really used

The agent logs every run. In seven weeks the scheduled jobs used about **1.17 billion tokens**. The most expensive one, a daily news early-warning summary, used about 6 million tokens per run.

On a subscription you do not see that. So I compared it with everything else on the same subscription in those weeks: my chats with the agent and my coding agent. The scheduled jobs were **about 26–34 %** of all tokens, depending on how you count cached tokens. That is **roughly $33–43 of the $125** every month.

At API prices the same jobs would cost **roughly $170–330 a month**. That range is rough: the agent does not log prices on a subscription, so I estimated them from a run of my [AI newsletter](https://github.com/romanzdk/ai-newsletter) that I had priced before ($2.71 for one run).

Most of those tokens were not thinking. They were the agent reading the same pages again, finding out what day it is, retrying a blocked site, and saying "nothing new" at the end. Two jobs ended with "nothing new" in more than 90 % of runs.

## Fixed code for the routine, a model only for the judgement

![Before: a general agent per job. After: fixed code, a small model step only when needed.](/img/blog/agent-to-workflows.svg)

Each job is now a small Python program:

1. **Fetch fixed sources.** RSS feeds, public JSON APIs, or event data that websites already publish for search engines (schema.org JSON-LD). For search I use the free Google News RSS feed.
2. **Filter and compare with last time.** Dates, duplicates and "already sent" are plain code with a small state file.
3. **Call a model only if something is new.** One call with all new items together, a strict output format, and a hard price cap per run ([Pydantic AI](https://ai.pydantic.dev), DeepSeek V4.1 Flash through OpenRouter).
4. **Print the message.** Hermes still runs the schedule and sends the output to Telegram. Empty output means no message.

Some jobs need no model at all. The sports digest is just APIs and a template. The TV-series check compares a public API with last week.

## The result

| | Before | Now |
|---|---:|---:|
| Share of the subscription | about $33–43 a month (about a third of $125) | — |
| At API prices | roughly $170–330 a month | about $1 a month (estimate) |
| Tokens per run | up to millions | a few thousand, often zero |
| The formerly most expensive job | ~6 M tokens per run | about $0.008 per run |

The $1 is my estimate from the cost of each job's first real runs multiplied by how often it runs. I will know the real number after a month.

Out of 25 jobs, 7 were already simple scripts, 14 were rewritten, 3 I dropped and 1 seasonal job I now do by hand until it ends in December.

## What I lost

Not everything fits a fixed program.

- **Repairs.** The old Home Assistant audit and server audit could fix small problems by themselves. Now they only report, and I do the repair myself. I dropped the server audit completely, because simple health checks already cover it.
- **Coverage.** The agent could search anywhere. The program reads only the sources I listed. Local events from villages without a machine-readable calendar are gone. Facebook and Instagram need a login, so the program does not read them.
- **Flexibility.** Changing a prompt was one line. Now a change means code, tests and a review.

For routine jobs that is a good trade. For open-ended work I would still use an agent.

## What the reviews caught

I built this with coding agents in about a day. Every batch went through tests, a real run on the server, an independent "tester" agent and two rounds of review. They found real problems:

- One job writes rows into a Google Sheet. Text from a web page went in as "user entered", so a title starting with `=` would run as a formula when I open the sheet, and could send data out. Now values are written as plain text.
- Links come from the web. A URL with `)` in it could break the Telegram message or slip in a different link. All links now go through one function that encodes them.
- The news job sent a "no change" message, because it trusted the model's own "changed" flag. Now the code compares the level with yesterday and decides.
- My own security fix (checking every redirect) decoded gzip twice, so every source failed. The tester found it before any job was switched.

None of these were in the first version.

## Takeaways

- **Look at token logs**, even on a flat subscription. The waste is invisible until you count it.
- **Let code do what code can do**: fetching, dates, duplicates, "what is new". Give the model only the part that needs judgement, once per run, with a price cap.
- **Silence is a feature.** Most runs should end with no model call and no message.
- **Review it like production code.** Even a hobby job that writes to your own spreadsheet can be attacked through the data it reads.
