Skip to content

Contact

Mexico City, Mexico
Available for remote and on-site projects.

Professional networks

LinkedIn · GitHub · Email
Applied engineering, measurable results.

The memory that eats the budget

· 4 min read · Samuel Torres

I am Samuel Torres Pichardo, an engineer in Computing and Telecommunications Technologies, based in Mexico City. I have worked at Conqr Digital Agency since July 2025 and as a freelancer since January 2023, with more than 23 sites in production. I went to Cloud Native CDMX on Thursday, November 26, 2026, at Torre Manacar, and in the second talk, about the path from the GPU to the agent, the speaker explained what I think is the biggest hidden cost of artificial intelligence: memory. Not the server's memory. The agent's memory: the history, the instructions and the guardrails. That memory drives up token usage per turn. And if it is not designed, it eats the budget quietly.

First you have to understand what an agent's memory is. It is not a file that gets saved and forgotten. It is three things that travel in every turn. The history: everything that has been said in the conversation so far. The instructions: the rules you gave the agent about how it should behave, what tone to use, what it can and cannot do. And the guardrails: the limits it must not cross, like not sharing sensitive data or not giving discounts without authorization. Every time the user writes something, the agent does not receive only the new message. It receives the new message plus all of that. And all of that is billed in tokens.

That is where the problem is. Tokens are not billed per conversation. They are billed per turn. And in every turn the whole context is sent again. A short conversation, of three messages, is cheap. A long conversation, of fifty messages, with detailed instructions and several guardrails, is expensive in every turn, because every turn carries everything before it. Memory grows with every message and the cost per turn grows with it. It is not a fixed cost. It is a cost that goes up while the user keeps talking. And that is exactly what happens in production: real users talk much more than test users.

That is why pilots overflow. A pilot is done with few users, short conversations and controlled cases. In that scenario, memory is small and the cost looks manageable. When the pilot moves to production, more users arrive, with longer conversations, unexpected questions and contexts nobody had planned for. Each agent's memory grows, token usage per turn shoots up and the budget that looked enough for a year runs out in months. The speaker gave the example of Uber, which used up a year's budget in four months, and I already wrote about that case in another article. What matters here is the mechanism behind it: it was not a one-line calculation error. It was memory growing turn by turn, without anyone measuring it.

I translate it into something I know well: hosting. When I quote a site, I do not quote only the design. I quote the traffic, the storage and the growth. If a client tells me they expect one hundred visits a month, I size for one hundred. If ten thousand arrive later, the server goes down or the bill goes up. With AI it is the same, but with one difference: with hosting you can see the traffic coming. With agents, the cost of memory grows quietly, inside each conversation, and when you notice, the bill has already arrived. That is why memory is not a technical detail. It is a budget line.

What can you do? The first thing is to measure. You need to know how much an average turn costs, how much a long conversation costs and how much usage grows with each message. Without those numbers, any budget is a guess. Observability with OpenTelemetry, which the talk also mentioned, is useful for this: seeing the inputs, the outputs, the tool calls and the tokens of each agent. The second thing is to limit. Not all the history has to travel in every turn. You can summarize the old parts and keep only what matters. You can define which instructions are permanent and which only apply at a certain moment. You can decide what is kept and what is discarded. The third thing is to set a ceiling: a budget per agent, alerts when usage goes up and a point where the agent asks for help or closes the conversation instead of continuing to spend.

This is how I apply it when I quote an AI project for a client. I do not promise a fixed price without knowing the usage. I ask how many users will use the agent, how much they will talk and how much the agent needs to remember about each one. With those three pieces of data, I size the memory usage the way I size a server: with a real number, not with a hope. And I put a ceiling on the budget, with alerts, so the cost is not discovered at the end of the month. An agent that remembers everything is an expensive agent. An agent that remembers what matters is a profitable agent.

Memory is what makes an agent feel intelligent. It is also what eats the budget if nobody designs it. A cheap pilot is not a promise of cheap production. It is a pilot. And the difference between one and the other is called memory, and it is measured in tokens per turn. Get a quote on WhatsApp in 2 min

Samuel Torres Pichardo

Samuel Torres Pichardo
Software and cloud engineer in Mexico City, with about 3 years of professional experience.
About me · LinkedIn · GitHub · Contact

Got a project in mind?

Hire me: I'll help you build it.

Websites, online stores, custom systems and cloud. Tell me what you need and I'll tell you how I'd build it, what it costs and how long it takes.

  • Mexico City · remote

Menu

Español

[email protected]