mixle.spend module

Unified budget ledger for subsystem and query-level spending.

One cost total is summed across query paths: cascade or router tiers (frontier_calls), oracle-scored search loops (oracle_calls), and wall-clock or dollar cost wherever those are tracked. System.answer carries the incremental Spend of the current call plus the running total_spend on every receipt, and treats budget as a hard ceiling.

class Spend(frontier_calls=0, oracle_calls=0, wall_ms=0.0, dollars=0.0)[source]

Bases: object

A summable cost total. total_units() is the scalar figure budget= is checked against.

Parameters:
total_units()[source]

The scalar cost a budget= integer is measured against.

Currently frontier_calls + oracle_calls – the two countable, per-call costs the existing routes measure budget in. wall_ms and dollars are carried and reported on every receipt but are not yet priced into the hard-ceiling check; extend this method when a concrete dollar cost model is introduced.

Return type:

float

to_dict()[source]

Serialize the spend ledger into primitive numeric fields.

Return type:

dict[str, float | int]