Why AI Agent Cost Attribution Has to Be Per Task
AI agent cost attribution at the event level hides which multi-step tasks run at a loss. Agentic tasks can consume up to 1,000 times more tokens than a chat message, and the same task can cost 30 times more on one run than the next . The task, not the token or the customer, is the unit where cost and value meet, which makes per-task attribution the prerequisite for defending agentic margins.
The dashboard that tells you nothing useful
You can instrument every API call, log every token, and chart your daily model spend to the cent, and still have no idea which agent tasks are losing you money. That is the uncomfortable gap teams discover the first time they ship an agent into production.
The reason is structural. A good engineer’s instinct is to measure at the event level, because that is where the data is clean: one call, one latency number, one token count. But the event is not the thing that costs you money or earns you revenue. The task is.
A task is one user intent carried out across many model calls, tool invocations, retries, and providers. Some tasks finish in two calls. Some spiral into four hundred. Your per-event dashboard reports the average of all of them and calls it a day.
Averages are exactly where margins go to hide. This is the same problem the case for real-time economic control keeps running into: visibility that arrives after the cost is already incurred, aggregated to a level too coarse to act on.
The stakes are rising fast. Gartner projects that 40% of enterprise applications will embed task-specific AI agents by the end of 2026, up from under 5% in 2025. The same firm forecasts that more than 40% of agentic AI projects will be canceled by the end of 2027, citing unclear ROI and runaway unit costs. The bridge between those two numbers is whether teams can see their economics at the task level. Few can today.
The evidence: why per-event AI agent cost attribution fails
Event-level cost tracking breaks for agentic products in three ways, each visible in recent data.
The fan-out problem
One agent task does not cost one API call. It costs hundreds. A 2026 study from the Stanford Digital Economy Lab, co-authored by Erik Brynjolfsson and Alex Pentland, measured token consumption across eight frontier models on agentic coding tasks (Bai et al., arXiv, April 2026). Agentic tasks consumed roughly 1,000 times more tokens than ordinary chat and reasoning. Worse for anyone trying to price the work, the same task run twice on the same model varied in cost by up to 30 times. OpenAI’s own Chief Economist reported that average reasoning-token consumption per organization grew about 320 times year over year through late 2025.
When one task can cost 30 times what an identical task cost an hour ago, a per-event dashboard is not telling you about margin. It is telling you about the weather. A single runaway loop can turn into a $4,000 overnight API bill from runaway agents before anyone sees a chart move.
Uber learned the enterprise version of this lesson. After rolling Claude Code out across its engineering organization, the company spent its entire full-year 2026 AI budget in four months (Fortune, May 2026). Its COO admitted he could not draw a direct line from the spend to the features shipped. The spend was visible. The per-task return was not.
Flat pricing cannot absorb task variance
If your tasks vary by 30 times in cost and your price is flat, you are subsidizing your heaviest users by design. This is the most common failure mode.
GitHub Copilot’s usage-based billing economics started as the canonical example. At launch, Copilot charged $10 per month while Microsoft reportedly lost about $20 per user per month on average, and up to $80 per month on heavy user). The subscription price was a single number; the cost to serve was a distribution, and the right tail was deep underwater.
Cursor hit the same wall harder. In mid-2025 the company had to reprice its flat plan after discovering it was absorbing the cost of long-horizon agent tasks that consumed more frontier-model compute than the subscription covered. The migration to a credit model came with a public apology and a wave of refunds.
Replit went further into the red: its gross margin swung from 36% to negative 14% as its agent consumed more LLM resources than its pricing recovered (analysis by Aakash Gupta, February 2026). In every case the flat price did its job perfectly, which was to make sure nobody could tell which sessions were running at a loss.
The margin math leaves no room
These are not rounding errors against a comfortable gross margin. AI-native products do not have a comfortable gross margin to begin with. Bessemer’s 2025 State of AI put the early-stage AI-native floor at 25% gross margin. ICONIQ’s panel of roughly 300 software executives reported 45% actual gross margin in 2025, projected to reach 52% in 2026. Burkland’s CFO practice sees 50% to 60% as the working range for AI startups. Classical SaaS ran at 80% and up.
The SaaS CFO’s blunt translation: an AI company has to be six times the revenue size of a comparable SaaS company to throw off the same EBITDA. Model inference alone runs at around 23% of revenue for scaling-stage AI B2B companies, per ICONIQ. When inference is a quarter of your revenue and your tasks vary by 30 times, you cannot afford to be blind to which tasks are unprofitable.
Averages hide the tail
The cruelest part is that aggregate margin can look fine while specific tasks bleed. Intercom’s Fin support agent bills anywhere from $50 to $30,000 per month for a single customer on the same plan, depending entirely on how hard the agent works. A power user can be profitable at the median and underwater at the 90th percentile of usage, as Todd Gagne’s worked contribution-margin analysis showed (Wildfire Labs, March 2026). The familiar shape is that a small fraction of tasks consumes a large share of the cost.
Treat that as a principle rather than a precise statistic; the exact split varies by product. The direction is consistent: the mean is profitable, the tail is not, and the tail is invisible until you attribute cost per task.
Put together, the four failure modes look like this:
| Failure mode | Mechanism | Named evidence |
|—-|—-|—-|
| Fan-out variance | One task fans into hundreds of calls; the same task can cost 30 times more run to run | Stanford Digital Economy Lab, 2026 |
| Flat-price absorption | Price is one number; cost to serve is a distribution with a deep tail | GitHub Copilot: $10 price vs up to $80 compute |
| Thin AI margins | Inference alone is ~23% of revenue at scale, leaving no cushion | ICONIQ, 2026 |
| Invisible tail | Aggregate margin looks healthy while specific tasks bleed | Intercom Fin: $50 to $30,000/month, same plan |
The task is the unit of margin
The fix is the right granularity, not more of it. The event is too small to be meaningful, and the customer is too large. One customer runs profitable tasks and unprofitable ones in the same hour; a per-customer number averages them back together and hands you the same blindness in a nicer wrapper. The task is the unit where cost and value actually meet, and it is the right level for AI agent cost attribution.
That means cost and revenue have to be observed together, at the task boundary. Few stacks can do this today. Fewer than half of companies can attribute AI cost to a customer at all, and only about 22% can attribute it to a single transaction (CloudZero, May 2025). At the task level, spanning multiple models, multiple vendors, and stateful intermediate steps, the attribution gap is close to universal. This is the practical content of what agents actually need from billing infrastructure: a system that knows where one task ends and the next begins, and ties the revenue for that task to the compute it burned.
Pricing doubles as a compute risk management tool, as Ridgeway Financial put it in early 2026. You cannot manage a compute risk you cannot measure, and for agentic products the measurable unit of compute risk is the task.
When per-task attribution does not matter
Per-task attribution is not always worth the wiring. If your product makes a single model call with a stable prompt, the call already is the task, and per-event tracking gives you per-task economics for free. Very high-margin products are a second exception: ICONIQ projects AI gross margins reaching 52% in 2026, and a product comfortably above that line can carry a fat tail without bleeding. Enterprise contracts are a third: when you sell on negotiated minimums and usage caps, the customer has absorbed the cost variance contractually, and the task-level risk lives on their side of the table.
There is also a real cost to the instrumentation itself. Defining task boundaries, correlating events across asynchronous vendor calls, and handling retries and partial failures is genuine engineering work, not a config flag. The honest framing is a trade: weigh the cost of building task-level attribution against the margin you have at risk without it. For a single-call product with 70% margins, skip it. For a multi-step agent with 40% margins and a long tail, it is not optional.
You cannot defend a margin you cannot see
You cannot govern what you cannot see. You cannot set a task-level budget or cut off an abusive workload if you cannot see cost and revenue at the task level in the first place. Every margin decision an agentic product makes is downstream of that one capability.
The market is already moving toward task-priced economics. Cognition repriced Devin from a $500 per month flat plan to $2.25 per Agent Compute Unit, where one ACU is roughly 15 minutes of autonomous work. You cannot price per task if you cannot account per task. The pricing model is downstream of the attribution model, and the teams that build AI agent cost attribution at the task level first will be the ones still standing when the agentic-project cancellations Gartner predicted start landing.
Doing this well means recording cost and revenue together as each task runs, not reconciling them weeks later. That is the gap how Credyt approaches billing for AI products is built to close: real-time usage-based billing that attributes cost and revenue per customer, per agent, and per multi-step task. The margin on each one becomes a number you can see while it still matters. It is one approach among the infrastructure now forming around per-task economics, and the specific tool matters less than the discipline. Measure the task, or keep flying on an average that already lied to you.