Why AI agent costs grow in a loop
Why does an AI agent cost more than you planned? Param Harrison starts with a common habit. A new model comes out and the team switches. Without an eval you cannot tell if the new model is good or cheaper for your task. A cheap model works for a purpose-driven agent that only calls tools. Open-ended questions need a higher model. Token prices keep falling, but an agent loop is not a chatbot. Each turn sends the system prompt and everything gathered so far again. So the input grows much faster than the output. After this lesson you can explain where agent cost comes from and why you should watch the input.
What this covers: switching models, cheap and bigger models, and evals for accuracy. It also covers falling token prices, agent loops, and input that grows each turn.
Full session: Cut AI Agent Costs with Token Economics
#aiagents #llm #aicost
Chapters
- Switching to a new model
- Cheap model or bigger model
- Do cheaper models cut the cost?
- How an agent loop adds up
Transcript
Switching to a new model
Okay, now every time when you are releasing your new version of your AI agent, biggest problem will be you might be evaluating your output, like what is the quality of your output and so on, but oftentimes the bigger worry will be what will be the cost for that output because every time when a new frontier model comes in or a new model gets gets there, most of the teams they just switch. Okay, I have been running with Qwen, and now I am going to run with Haiku 5.5 because Haiku 5.5 becomes more cost efficient. Is that the way to do it, or is there a better way to handle that? So, this is one of the primary challenges for most of the companies. Like, if I am switching to next model, how how how do I know this model quality is going to be good and this model is going to be cost effective? That you need to measure on your evaluation process.
Cheap model or bigger model
So most of the team starts with cheaper model on their AI agent. Like, okay, I have an AI agent, and I will go with whatever open router provides as the cheapest model. I will pick a cheap model and then do it. That will work in most cases, definitely. if it is very purpose driven, then it will work. For example, if your purpose is just you know doing a tool call, then probably Gemma 4 model, and you completely know these three are the tools which I am exposed, and you can call it. But what if your it's very open-ended question where your agent needs to have a thinking process or reasoning process. Then you need to go for a higher model. How do you pick those models and what are all the strategies you can make to pick those models? Is very important when it comes to cost factor. Like you pick a cheaper model and you ship it, and everything will be fine, or even you are not picking a cheaper model, but a model which has been released, like Haiku 5.5, and you swapped it with maybe GPT Luna, probably their costs are almost like very similar, like some sense differences, and it is very similar, and you can switch it, but without having a proper evaluation in place, you can't measure whether this output is going to be good. The main challenge will come in when you are deploying your AI agent for a medical system or for a financial sector where accuracy needs to be top-notch when you have you know when you need 95 to 100% of accuracy, then it can go wrong.
Do cheaper models cut the cost?
So, one of the things as you see now the token prices are like at least the models are getting cheaper and cheaper, or that is how current progress is going on. previous Sonnet model or previous Opus model are much more costlier than the current Opus model, and the current Opus models are more capable enough. So, this is I think because of the pressure which is happening from open source models as well, the more and more open source models are getting you know developed automatically the proprietary models which is in the frontier, they are also kind of making sure their adaptation and everything is going at a fast pace, so they are reducing the cost. Does that reduce your actual development? That is a question mark. Why?
How an agent loop adds up
Because, for example, when you are building a chatbot, the cost will be more smaller, but when you are actually building an agentic loop, if we are not controlling the loop itself, then your cost, unless and until you create a clear budget and boundary, your cost you don't even know whether this is the cost or not. So let's see one of the agentic loop and where are all the cost can accumulate faster. So in a medical inquiry system, the query will be routed, and then the agentic loop will kick in, and the agentic loop will call the models, and you know, every turn it is calling first and second 10, third and it is calling, it will it will you know send the prefixed content which has been accumulating per turn, and then it will call the tools and their own data and it will start to accumulate. So, what happens is like your usage will increase even though the query is once, and on each turn, it is not going to be a linear cost, rather, it will be a geometrical cost. Why? Because your input is increasing and increasing, even though you provide only a small input in terms of your prompt, but then system prompt and each turn the agent is landing certain things, and then it will it will go to next agent. If if it is a multi-agent, then it will spin up sub-agents or it will go into the next agent along with the first agent's answer. So, what happens is like it will accumulate and accumulate. So the input will accumulate much more faster than your output.
This lesson is cut from the free Lightning session Cut AI Agent Costs with Token Economics. The Live Labs build the same system with you, free, on Thursdays: see the Live Labs.
