When AI Agents Cost More Than They’re Worth: A Lesson from a Real Project
An AI agent was burning 300,000 tokens a day on a job plain code does for free. Here is how we cut the cost and time, and how to spot the same waste.
- AI
- Business
- Case Study

In short
- Two AI agents in one daily e-mail automation meant about 90 minutes of run time and over 300,000 tokens per run.
- One agent was only pouring data into an HTML template. Replacing it with plain code cut time by 80% and token cost by 47%.
- Use an AI agent where the input is messy and judgment is needed. Use ordinary code where the rules never change.
- Before you sign off on an AI project, ask why each agent is there and what it will cost per month in tokens.
Imagine paying a specialist to copy numbers into a form, every morning, at a consultant's hourly rate. That is what an AI agent costs when you give it a job that plain code can do.
I built exactly that, caught it before it hit the client's bill, and fixed it. This article shows what I saw, what I changed and what you should ask before anyone builds AI into your business.
Sometimes the best solution is not to use AI at all.
A simple request that hid an expensive mistake
A real estate agency asked me for a daily e-mail for each of their brokers, containing:
- contacted leads that need a follow-up
- new leads for the day
- questions to ask during meetings
- the 10 most common objections and how to overcome them
It sounds simple, and thousands of agencies would want it. (The part about contacted leads arrived mid-project and added a week of work, but that is a story about project management for another article.)

The first version of the automation: it extracts only the new leads and uses 1 AI agent and 1 LLM model (the language model behind the agent) to prepare the e-mail.
The design looked modern and was wasteful
As an AI enthusiast, I designed it the obvious way:
- CRM (the client list): Google Sheets, collecting leads from 7 advertising channels
- Database: Supabase, holding the broker information
- AI Agent #1 (Strategy): reads each lead and writes a personalised strategy
- AI Agent #2 (Gmail_HTML): generates the HTML code of the e-mail
- Gmail: an authorised profile that sends an individual e-mail to each broker
The flow:
- Download and filter the new leads.
- Give them to the first AI agent to create a strategy.
- Pass the strategy and the lead data to the second agent.
- The second agent builds the HTML layout.
- Gmail sends it.
- The same process repeats for contacted leads.
Elegant, modern, AI-powered. And very inefficient.
The numbers I saw on real data
When I tested with real data, the result was bad:
| What I measured | Result |
|---|---|
| Run time | about 90 minutes for a list of 12 leads |
| Token cost per run | over 300,000 |
| How often it runs | every single day |
| Monthly projection | 9,000,000+ tokens for this one project |
For the client that meant a long wait every morning, a large monthly bill for API calls, the risk of the agents inventing things (hallucination) and unpredictable errors in a business-critical process.
I could accept this as "the price of AI". I decided to step back and ask a better question.
The question that fixed it: does this step need to think?
I went through each agent and asked what it really did.
AI Agent #1 (Strategy): it analyses very different lead data, decides based on context, and every lead needs its own approach. Verdict: necessary.
AI Agent #2 (Gmail_HTML): it only places data into a ready HTML template, follows fixed rules, and needs no thinking or decisions. Code can do the same job. Verdict: redundant.
The second agent was doing work that does not require artificial intelligence. It was a classic programming task: take data, put it in a template. If a task is rule-based and repetitive with structured input, rule-based automation is the right tool.
I deleted agent #2 and replaced it with a short piece of custom JavaScript, which is simple, predictable and gives the same result every time.
| Before | After | |
|---|---|---|
| Run time | about 90 minutes | about 18 minutes (80% faster) |
| Tokens per run | over 300,000 | about 160,000 (47% less) |
| E-mail formatting | varies | identical every time |

Four reasons the difference matters to your business
1. Money
AI agents burn through tokens. Models like GPT-4.1 need more computing power for agent systems, which raises cost and slows everything down.
2. Reliability
An agent is a probabilistic system: it can sometimes decide wrongly. For formatting an e-mail you do not want "sometimes right". You want always right.
3. Maintenance
Ordinary code is easy to debug because you know what each line does, and a clear structure is simple to test with sample cases. With an agent that makes its own decisions, finding a fault is a nightmare.
4. Speed
Ordinary code runs in milliseconds. An agent needs seconds or minutes per call. Multiply that by dozens or hundreds of operations a day.
When an agent earns its price, and when it does not
Use an AI agent when the task has several decision steps and a long tail of very different inputs.
| Use an AI agent for | Do not use an AI agent for |
|---|---|
| Unstructured data: documents, e-mails, images | Repetitive, predictable operations |
| Tasks that need creativity or judgment | Tasks with clearly defined rules |
| Ambiguity and variable scenarios | Formatting and converting data |
| Personalisation from complex context | Critical operations with no room for error |
| Work that used to need a human | Cases where code is faster and more reliable |
The strongest automations are hybrid: agents for the adaptive, intelligent parts, ordinary code for the deterministic parts, and a clear border between them. This is how we approach every build, and it is why we begin with an analysis of the process before choosing any technology.
The extra week I spent, and why
Optimising this automation cost me one more week. I slept 3 to 4 hours a night to keep the deadline.
I could have delivered the first version. Technically it worked. But I am not in the business of making things merely work. I build solutions that help the client financially, operationally and over the long term.
I work by three principles:
- Efficiency before elegance. The best solution is the one that works best, not the one that looks best in a portfolio.
- The client's costs, not the developer's. I spend my time to save their money.
- Sustainability, not short-term fixes. An automation has to run well for months and years.
What to ask before you pay for AI
If you are a business owner talking to an agency, ask these four questions:
- Why are you using an AI agent for this specific task?
- Are there more efficient alternatives?
- What is the projected monthly token cost?
- How will the system scale as we grow?
A good partner explains why they chose a technology, offers alternatives with pros and cons, optimises for your costs and thinks about maintenance from day one.
If you build AI automations yourself
Five reminders I repeat to myself:
- AI agents are not a universal solution. They are a strong tool for the right tasks.
- Your client's time is valuable. 90 minutes against 18 minutes, every day, adds up.
- Tokens cost money. 300K against 160K tokens a day is a big gap.
- Reliability matters. For critical operations, deterministic systems beat probabilistic ones.
- Your convenience is not the client's value. Writing a prompt is easy, writing optimised code takes skill.
Before you add an agent, ask whether ordinary code can do it. Start with the simplest solution and complicate it only when needed. Measure and report run time, token cost and success rate, and write down why you chose each technology.
The most innovative solution is often the simplest
That week was not about proving how good an automation engineer I am. It was about putting the client's interests before my own convenience.
An AI agent is a great tool, and like any tool it has to be used with judgment. Not every problem needs a hammer, even when the hammer is the newest one on the market. The best solution balances function, cost, reliability and maintenance, and sometimes the smartest move is to say "no" to AI.
Next step for you: take the automations you already have or plan, and for each AI step ask whether it needs to think. If you are not sure, send me the process and we will look at it together.
I can only hope this effort will be appreciated. Either way, I know it was the right thing for the project, the client and the future of the system.
Questions and answers
When should a business use an AI agent instead of ordinary code?
Use an agent when the input is unstructured or variable and the task needs judgment, such as reading e-mails or personalising advice. Use ordinary code when the rules are fixed and the output must be the same every time.
What is a token and why does it matter for my bill?
A token is a small piece of text that an AI model reads or writes, and you pay for every one. An automation that runs daily and uses 300,000 tokens per run adds up to millions of tokens a month.
What should I ask an agency that proposes AI agents?
Ask why an agent is needed for each task, what the projected monthly token cost is, what the alternatives are and how the system will scale. A good partner answers these without hesitation.
Is a cheaper, simpler automation less modern?
No. In this project the simpler version ran in about 18 minutes instead of 90 and gave identical formatting every day. The best automation is the one that works reliably at the lowest cost.