Carry ISO 4217 currency with cost and value so multi-currency customers aren't silently priced in USD
Carry ISO 4217 currency with cost and value so multi-currency customers aren't silently priced in USD
Problem statement
botanu's pitch is "the real cost of your AI features per customer" and outcome-based pricing, but the cost and value model is USD-only by naming convention, with no ISO 4217 currency carried anywhere.
- Cost attributes are denominated by a
_usdsuffix:resource_enricher.pyprices non-LLM spans intocost_infra_usd(and LLM pricing goes throughpricing_model_tokens), so the cost worker's whole rate-card model is USD-denominated with no currency field. RunOutcome.value_amount(the quantified business value of an outcome, e.g. tickets resolved) is a barefloatwith no currency —run_context.pyemits it asbotanu.outcome.value_amountwith no denomination.RunContext/RunOutcomecarrycost_centerandregionbut no currency, so a multi-currency customer (EU billing in EUR, JP in JPY) has no way to represent cost or value in their own currency.
The result: a customer whose provider bills in EUR or JPY gets cost and value figures that are silently treated as US dollars — wrong in denomination, which is exactly the kind of error that undermines "real cost per customer".
Proposed solution
Additive, no behavior change for USD-only users:
- Add an optional
currency(ISO 4217, default"USD") to the cost/value model:RunOutcomegainsvalue_currency: str = "USD";run_context.pyemitsbotanu.outcome.value_currencyalongsidevalue_amount.- The cost worker's rate cards and the emitted cost attributes (
cost_infra_usd, etc.) gain an optional companion currency attribute, defaulting to"USD".
- Keep the
_usdnames for backward compatibility (or addcost_infra_currencyas the companion) so existing dashboards don't break. - Document that cost/value are USD unless a
*_currencyattribute says otherwise.
Why it matters
botanu correlates every run to an event_id and customer_id to give per-event cost attribution and outcome tracking — the foundation for outcome-based pricing. If cost and value are USD-only by convention, a non-USD customer's numbers are wrong in denomination, which breaks the "real cost per customer" promise. Carrying the currency makes the number honest without requiring conversion.
Alternatives considered
- Currency conversion to USD in the SDK: rejected — conversion is a backend/collector concern and would add drift; the ask is only to carry the currency so the denomination is explicit.
- A global
BOTANU_CURRENCYenv var: insufficient — different customers/providers within one deployment can price in different currencies, so the currency belongs on the per-run cost/value attributes.
This is a small, additive change to run_context.py, span_helpers.py, and the resource enricher's cost attributes, plus tests in tests/unit/. Happy to open a PR if this direction is welcome.