Kkarthik.dev
All posts

14 November 2026

My AI agent was burning money on every single message.

The model wasn't the problem.

My own code was ๐Ÿ‘‡

I run Career-Agents, an open-source MCP server with 167 AI agents used inside Claude Desktop, Cursor and VS Code.

Everything worked.

But every conversation got slower and more expensive the longer it went.

So I looked at what was actually being sent to the model.

What I found was embarrassing:

โŒ Tool responses returned full JSON objects, when the agent needed 3 fields
โŒ Old conversation turns were resent in full, every time
โŒ The same context was repeated across tools

The model was reading paragraphs to answer a one-line question.

Here's what I changed:

โœ… Minified tool responses: return only what the agent needs to decide its next step
โœ… Compressed older turns: summarise them and keep recent turns in full
โœ… Treated context like a budget: every token has to earn its place

Result: up to 85% fewer tokens, with no drop in the quality of answers.

The lesson nobody tells you about AI engineering:

โ†’ Your prompt isn't your only prompt.
โ†’ Every tool response is also a prompt.
โ†’ Your agent's cost is a design decision, not a model problem.

Before you switch to a cheaper model, check what you're actually feeding the one you have.

What's the biggest token-waster you've found in an AI app? ๐Ÿ‘‡

#AIEngineering #AIAgents #LLM #MCP #BuildInPublic

Discuss this on LinkedIn