COST ATTRIBUTION · RECONCILE THE BILL
Cost attribution: trace a tenant invoice to meter events
Trace a $100 provider bill to tenant invoices, including sub-agent calls, retried attempts and a shared vector database.
Your experiment
The provider bill for one day is $100: $80 of model tokens and $20 of shared vector database. acme should pay $70 and globex $30. Start with the default tagging and add one attribution rule at a time until every dollar lands on the right tenant.
Play replays the computed run over sixty inspection seconds; Next event steps, Restart rewinds, Speed changes the pace and Inspection time scrubs. Any input change recomputes the run and rewinds it without autoplay.
Event trace
Computed data
Final metrics
Fictional bill and tenants. Failed attempts are assumed to consume billable tokens, as many providers charge for tokens processed even when the caller retries. Query count is the only usage signal for the shared database. No billing or metering system is queried.
A bill that does not add up
The provider bill for one day is $100.00: $80.00 of model tokens and $20.00 for a shared vector database. acme should pay $70.00 and globex $30.00. With the opening rules only acme’s root agent calls and globex’s calls carry a tenant tag, so acme is invoiced $30.00, globex $25.00, and $45.00 is unattributed: UNRECONCILED. Unattributed cost is still paid by someone, usually the platform team’s budget.
Sub-agents inherit the tenant
acme’s root agent calls a research sub-agent through AgentTool, which runs in its own session. With Sub-agent model calls set to Tagged with the sub-agent’s own session, the $20.00 of calls it makes stays unattributed. Choose Inherit the parent invocation’s tenant tag: those calls land on acme, which rises to $50.00 and leaves $25.00 unattributed. Tenant identity must travel with the invocation, not with the session that happens to make the call.
Retried attempts are billed too
Failed attempts that were retried still processed tokens, and the provider charges for them. Setting Tokens of failed attempts that were retried to Attributed to the tenant adds the $5.00 to acme, now $55.00, with $20.00 unattributed: exactly the shared database. Excluding retries makes per-request cost look cheaper than it is and hides a retry storm in the bill.
Split shared cost by usage
Setting Shared vector database cost to Split evenly between tenants allocates every dollar, $65.00 to acme and $35.00 to globex, but globex pays for queries acme ran: MISALLOCATED. Split by query count gives acme 300 of 400 queries, $15.00, and globex $5.00, so acme’s invoice is $70.00, globex’s $30.00 and the result is RECONCILED. Full allocation is a bookkeeping property; fair allocation needs a usage signal.
Reading the run and its limits
Play, Next event, Restart, Speed and Inspection time step through each meter source and the reconciliation across sixty seconds; the table compares where each cost belongs with where it was attributed. The bill is fictional and small; real attribution also handles cached tokens, batch discounts, idle capacity and commitments, and needs a policy for shared cost that both tenants accept.