Agentic delivery that survives the bill.
Token prices collapsed and AI budgets grew anyway, because an agent is a loop that re-reads its context on every turn. We compress that context, layer the memory behind it, and budget the path on cost per successful outcome.
The cheap era was a pricing decision.
Per-token prices really did fall — roughly 280-fold for GPT-3.5-level inference in under two years. Enterprise bills went up anyway, because cheap tokens made agentic workloads viable and agentic workloads consume orders of magnitude more of them.
The subsidy was a pilot budget
Vendors absorbed GPU and token costs to win adoption. Unmetered, complimentary and included were pricing strategies, not permanent states.
Per-seat pricing hid per-token reality
A flat seat licence concealed a workload whose cost varies by an order of magnitude with the context each request carries.
Prototype defaults became architecture
Frontier model, full-context prompt, tool call every turn. Right for a demo, never revisited before the pilot was promoted.
An agent is a loop around a model
Framing draws on Harvard Business Review, Snowflake and Microsoft Azure. Price figures originate with the Stanford HAI AI Index. Full credits on our research page.
Pick the unit before you pick the lever.
Optimise cost per call and you can halve spend, double the failure rate, and still show a win on the dashboard. The unit has to include whether the work got done.
Infrastructure health
Cost per 1,000 calls
Catches regressions in batching, cache hit rate and serving efficiency. An engineering metric, not a business one.
Capacity planning
Cost per agent run
The unit a path can be budgeted against — reported as a distribution, because variance across identical tasks is the norm.
The number that decides
Cost per successful outcome
Spend divided by runs that passed the gates. A cheaper run that fails is the most expensive thing in the system.
Six places the money sits
Inference is the only line most teams can see, and rarely the largest.
Cost-component structure adapted from Google Cloud and its FinOps for generative AI guidance.
budget:
unit: cost_per_successful_run # not per call, not per token
target: 1.00
ceiling: 2.50 # path fails closed above this
context:
max_input_tokens: 48000
compressors: [select, abstract, densify]
handoff: structured # artefact, never transcript
memory:
layers: [user, team, domain]
read_order: narrowest_first
routing:
default: small
escalate_when: [low_confidence, gate_rejection]
cache:
prompt: true # stable content first
semantic: { enabled: true, similarity_threshold: 0.94 }
gates:
quality_regression_tolerance: 0.02
on_breach: revert_last_leverCost belongs in the path definition
Sequence matters more than technique.
Savings compose, and they compose in one direction. Compression shrinks what you cache, caching reduces what you route, routing changes which model is worth right-sizing. Run it backwards and you distil a model to serve context you should have deleted.
Model routing
Small model first, escalate on low confidence. Reported routers cut large-model calls by up to 40%; cascades up to 60% with under 1% quality loss.
Prompt & semantic caching
Stable content first, volatile last, so identical prefixes bill once. Semantic caching answers near-duplicate intent — around two thirds fewer upstream calls.
Continuous batching
Paged KV-cache scheduling has been reported at two to four times the throughput on the same hardware.
Quantisation
16-bit to 4-bit cuts memory roughly fourfold; activation-aware schemes protect the weights that carry accuracy.
Prefill optimisation
Long agent contexts inflate prefill. Published work reports about half the prefill compute at double the throughput.
Commitment & placement
Predictable volume on provisioned throughput, latency-tolerant work on batch endpoints at roughly half the price.
Published figures belong to their original authors and are summarised for orientation, not as guarantees. Technique inventory from Snowflake's research survey and Azure's runtime levers. Measure on your own workload.
Send less, not worse.
Input dominates the bill and the loop pays for it again every turn. A compressor reduces what the model reads while preserving what it needs — which is why each one ships with an eval attached.
selectRelevance selection
Retrieve against the bounded context, dedupe, drop boilerplate. The cheapest token is the one you never send.
largest single reduction, and lossless
abstractHierarchical summarisation
Transcripts and file history collapse into rolling digests with drill-down. The original is fetched only when the digest falls short.
turns history growth into a conditional cost
densifyToken-level compression
Learned compressors strip low-information tokens from what must still be read closely. LLMLingua-class results report up to twentyfold.
up to 20× on the passages it touches
structureStructured handoff
Agents pass artefacts, not conversations. One published domain-specific encoding reports 31% fewer input tokens and 34–63% lower latency.
removes context re-establishment per handoff
constrainSchema-constrained output
Output tokens are generated one forward pass each. A tight response schema deletes preamble nobody parses.
shortens decode, which dominates latency
Every compressor is a bet
Recall is cheaper than re-reading.
Most context is not new information — it is the same information, resent. Layering memory by scope turns that repetition into a lookup, and the narrowest layer that can answer is the only one that gets read.
User memory
scope: one personttl: rollingPreferences, recurring intent, how this engineer works.
Removes the orientation paragraph that opens every session.
Team memory
scope: one squadttl: release cyclesConventions, review standards, decisions still in flight.
Stops five engineers paying to rediscover the same convention.
Domain memory
scope: bounded contextttl: versionedOntology, specs, ADRs, incidents — provenance on every fact.
Replaces broad retrieval with precise recall.
Four rules that keep layers from becoming cost
Narrowest layer first
Stop at the first layer that answers. Reading all three every turn recreates the problem the layers exist to solve.
Write on a schedule, not per turn
The Context Curator promotes what recurred and expires what went stale. Per-turn writes build a second transcript.
Memory is a security boundary
Layer reads are scoped by identity at the tool gateway. Cross-layer promotion is explicit and audited.
Provenance or it does not persist
A fact without a source cannot be corrected when it turns out to be wrong.
layers:
user:
engine: supermemory
container: user/{subject}
ttl: 90d
read: [self]
budget_tokens: 1200
team:
engine: supermemory
container: team/{squad}
ttl: 2_release_cycles
read: [squad, squad_agents]
budget_tokens: 4000
domain:
engine: cognee + hindsight
container: domain/{bounded_context}
ttl: versioned # expires by release, not by clock
read: [domain_agents]
requires_provenance: true
budget_tokens: 18000
assembly:
order: narrowest_first
stop_when: sufficient
total_budget_tokens: 24000
consolidation:
owner: phaiai/agents/context-curator
schedule: nightly
promote_after: 3_recurrencesThe Domain Context Engine, priced
A cost programme, not a cost cut.
We instrument what you actually spend, sequence the levers against your own workload, and leave the measurement behind — because this quarter's levers will be wrong the moment your model mix changes.
Baseline
Tag every model and tool call. Produce cost per run and cost per successful outcome, per path. No changes yet.
Sequence
Compress, then cache, then route, then right-size. One lever at a time, each measured before the next is allowed.
Gate
Budgets and quality gates move into the path definitions, so a regression fails the path instead of the invoice.
Operate
A FinOps practice for agentic spend: allocation by domain, forecast against roadmap, standing review.
Know what a successful outcome costs you today.
Most teams can say what last month's AI bill was and cannot say what one delivered feature cost. The baseline engagement answers the second question, which makes every lever after it obvious.