pub struct Budgets {
pub max_total_tokens: Option<u64>,
pub max_total_usd: Option<f64>,
pub pricing: HashMap<String, ModelPricing>,
}Expand description
Cost-tracking budgets and per-model pricing.
Either limit being Some activates budget enforcement: before every
agent dispatch the runner totals crate::state::RunState::token_usage
and halts with crate::runner::HaltReason::BudgetExceeded when usage
already meets or exceeds the configured cap. Both limits can be set
independently — the first to fire wins.
USD costs are computed from pricing: each role’s accumulated tokens are
multiplied by the per-model rate associated with that role’s model in
ModelRoles. Roles whose model is missing from pricing contribute zero
USD (and a tracing::warn is emitted on the first dispatch); the tokens
budget still applies. The default pricing table covers the Claude models
pitboss ships defaults for; .pitboss/config.toml may override or extend it.
Fields§
§max_total_tokens: Option<u64>Hard cap on total tokens (input + output, summed across roles). None
disables the token-budget check.
max_total_usd: Option<f64>Hard cap on total cost in USD computed from pricing.
None disables the USD-budget check.
pricing: HashMap<String, ModelPricing>Per-model price points. Keyed by the same model identifier strings
used in ModelRoles (e.g., "claude-opus-4-7").
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Budgets
impl<'de> Deserialize<'de> for Budgets
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Budgets
Auto Trait Implementations§
impl Freeze for Budgets
impl RefUnwindSafe for Budgets
impl Send for Budgets
impl Sync for Budgets
impl Unpin for Budgets
impl UnsafeUnpin for Budgets
impl UnwindSafe for Budgets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more