← manishpande.in Contents
Reference architecture · 2026 The Agentic Platform by Manish Pande
© 2026 Manish Pande Mumbai, India Set in Space Grotesk · Source Serif 4 · JetBrains Mono
OPS · FinOps Chapter 20

Cost, Metering & FinOps

Agentic systems have an economic structure unlike any software before them: their marginal cost per request is real, variable, and potentially unbounded. An agent in a reasoning loop, fanning out to sub-agents, can quietly spend orders of magnitude more than a simple query — and a bug or an attack can turn that into catastrophe. Cost is not a finance concern to reconcile monthly; it is an engineering constraint to design for and enforce in real time.

20.1 The token economics of agents

Recall Chapter 2's multipliers: an agentic task costs many times a single completion because every loop iteration re-sends growing context, reasoning strategies multiply calls, and multi-agent fans out across many models. The dominant cost driver is tokens, and context length is the lever — which is why the context engineering of Chapter 7 (compaction, caching, selective retrieval) and the gateway caching of Chapter 6 are also your primary cost-control mechanisms. Cheaper models for easy steps (gateway routing, Ch. 6) and avoiding gratuitous multi-agent designs (Ch. 12) round out the levers.

20.2 Metering: you cannot control what you cannot measure

Every model call has a measurable cost (input + output tokens × price), already captured per span by observability (Ch. 18). Metering aggregates this into the dimensions the business needs: cost per run, per user, per tenant, per feature. This serves two ends — internal unit economics (is feature X profitable? which tenant is unprofitable?) and external billing (charging customers for usage). Dedicated metering and usage-billing systems such as Lago and OpenMeter ingest usage events and turn them into accurate per-customer cost and revenue, which is essential the moment you bill for consumption.

Where the money goes · one complex agentic request LLM input tokens (context, re-sent each turn) output tokens tools infra Levers, in order of impact: ① prompt + semantic caching (Ch.6) → discount the repeated input prefix ② context compaction + selective retrieval (Ch.7) → shrink tokens per turn ③ route easy steps to cheaper models (Ch.6) · ④ avoid needless sub-agents (Ch.12) ⑤ hard budget ceiling per run + per tenant (enforced outside the model)
Fig 20.1 · Cost anatomy of a complex agentic request. Re-sent input context typically dominates — which is why caching and context discipline are the highest-leverage savings, ahead of model choice. Output and tool costs follow; raw infra is usually the smallest slice.

20.3 Budget enforcement

Measurement without enforcement is an autopsy. The platform must impose hard limits the model cannot exceed: a per-run budget (tokens/cost/iterations — the loop counter of Ch. 5 and the iteration ceiling of Ch. 2), and per-user/per-tenant quotas over time. These are checked in the control path — at the gateway (Ch. 6) and orchestrator — and tripping one halts or degrades the run rather than letting it spend without bound. This is the same control-plane discipline as guardrails and authorization: the model proposes work; the platform decides whether the budget permits it.

~75%
of spend often sits in re-sent input context — the first place to optimize
per-run
hard budget ceiling, enforced outside the model's control
per-tenant
granularity needed to find unprofitable usage and bill accurately
First principle · Cost is a runtime constraint, not a monthly report

Meter every token at the point of use, attribute it to run/user/tenant/feature, and enforce hard budgets in real time. An agent without a spending ceiling is a financial incident waiting to happen; unit economics you compute only after the invoice arrives are unit economics you cannot manage.

Hazard · The runaway loop

The signature cost failure is an agent that loops — retrying, re-reasoning, re-spawning — without converging, or one driven into expensive behavior by injection (Ch. 16). Without an enforced iteration and budget ceiling, a single run can incur unbounded cost. The ceiling of Chapter 2 is not a nicety; it is the circuit breaker that makes autonomy financially survivable.

· · ·