# `PhoenixAI.Store.Guardrails.CostBudget`
[🔗](https://github.com/franciscpd/phoenix-ai-store/blob/v0.1.0/lib/phoenix_ai/store/guardrails/cost_budget.ex#L1)

Guardrail policy that enforces cost budgets scoped to conversations or users.

This is a **stateful** policy that reads accumulated cost from the store
adapter. The adapter must implement the
`PhoenixAI.Store.Adapter.CostStore` sub-behaviour (specifically `sum_cost/2`).

## Options

  * `:max` (required) — maximum allowed cost as a `Decimal` or string
  * `:scope` — `:conversation` (default) or `:user`

## Assigns

The policy expects `request.assigns` to contain:

  * `:adapter` — the adapter module
  * `:adapter_opts` — keyword options for the adapter

These are injected by `PhoenixAI.Store.check_guardrails/3`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
