Normandy.Behaviours.BudgetTracker behaviour (normandy v1.0.0)

View Source

Contract for budget gating and accounting around tool calls.

check/2 is an optional pre-spend gate (returns :ok to proceed or {:error, reason} to deny before executing); record/2 accounts for actual usage after the call. scope identifies the budget owner (e.g. %{agent: name, model: model}); est/usage are the planned/actual cost carriers. The default impl NoOp preserves current (untracked) behavior.

Summary

Types

scope()

@type scope() :: term()

Callbacks

check(scope, est)

@callback check(scope(), est :: term()) :: :ok | {:error, term()}

record(scope, usage)

@callback record(scope(), usage :: term()) :: :ok