The Cost Problem of AI Agents and How to Fix It
This article examines why subscription-based LLM quotas collapse under automated agent frameworks, traces the root cause to context bloat rather than token pricing, and lays out engineering practices—context budgets, cache reuse, summarization, fewer wasted calls, and full observability—for keeping agent workloads sustainable.
Background: Why Subscription Quotas Get Burned Through
A major model provider recently announced a change to its subscription policy: subscription quotas can no longer be used by third-party automated agent frameworks. Continued use requires switching to usage-based API billing. The stated reason is that the pricing model was designed around the intensity of normal individual usage, while automated agents consume far more than expected—some heavy users pay a subscription fee of roughly two hundred dollars a month yet generate compute costs in the thousands of dollars.
The community split into two camps. One argues that subscriptions have lost their value for money; the other sees this as clearing out inefficient calls to keep the platform sustainable. Setting emotion aside, the conclusion that actually matters to developers is this: coarse-grained billing by the token can no longer describe what an agent really consumes.
Root Cause: The Problem Is Dirty Context, Not Expensive Tokens
A judgment from a leader of a large model team is representative here: subscription plans like this are most likely unprofitable on their own, unless the API business carries a very high margin. The reason third-party frameworks become cost black holes is not the unit price but the way they call the model:
- A single user request is amplified into many tool calls: one natural language instruction is split into multiple low-value actions, each sent as a separate request.
- Every call carries an oversized context: a single request’s context often exceeds one hundred thousand tokens, with conversation history, tool returns, and retrieval results retransmitted repeatedly.
- Low or mutually polluting cache hit rates: even on a cache hit, repeated transmission still wastes bandwidth and compute; in the worst case, long contexts raise the cache miss rate for other requests.
- No budget constraints or termination conditions: loops have no upper bound, failed retries lack backoff, and useless tokens keep accumulating.
All told, the real cost of one user request can be dozens of times the subscription price. This is not a matter of being “a little more expensive”—it is a structural trap.
The Fix: Write Engineering Discipline into Agent Design
Short-term pain is unavoidable, but over time it will force engineering progress. Third-party frameworks can still call the API normally; they simply can no longer ride for free. Developers should turn the following principles into engineering discipline:
- Context budgeting: set a token ceiling and a tool-call ceiling for each session, and converge once either is exceeded.
- Maximize cache reuse: place the stable prefix (system prompt, tool definitions, long-term knowledge) first and keep it byte-for-byte unchanged, with dynamic content placed after it, to improve prefix cache hit rates.
- Context compression and summarization: produce structured summaries of historical tool returns, keeping only the fields needed for decisions instead of feeding whole blocks back in.
- Cut wasted calls: merge tool actions that can run in parallel, add retry backoff and idempotency keys, and eliminate loop amplification.
- Full-chain observability: record input/output tokens, cache hit status, tool call counts, and latency for every request, and build cost dashboards and alerts on top.
Illustrative budget control logic:
class Budget:def __init__(self, max_tokens=120_000, max_calls=8):self.max_tokens = max_tokensself.max_calls = max_callsself.used_tokens = 0self.calls = 0def allow(self, next_tokens):if self.calls >= self.max_calls:return Falseif self.used_tokens + next_tokens > self.max_tokens:return Falseself.used_tokens += next_tokensself.calls += 1return True
A Note for Model Providers: Avoid the Low-Price Trap
For the supply side, competing blindly on price—selling tokens cheaply while letting third-party tools consume without restraint—is a classic trap: revenue grows linearly while costs can rise exponentially. A healthier approach is tiered billing, combining subscription with usage, applying risk controls to abnormal calls, and productizing cache reuse.
What Cloud Platforms Need to Provide
From the perspective of a platform like Baidu AI Cloud, sustainable compute use can be built on general-purpose capabilities: container platforms to host elastic agent runtimes, object storage for session and knowledge snapshots, message queues to smooth out task spikes, and logging plus monitoring and alerting to form a cost observability system. The core is not cheaper tokens but smarter engineering design.
