pub struct Budgets {
pub max_steps: Option<u64>,
pub max_tokens: Option<u64>,
pub max_cost_usd: Option<f64>,
pub max_wall_time: Option<Duration>,
}Expand description
The limits an agent declares. Every dimension is optional; an absent dimension is never checked.
Fields§
§max_steps: Option<u64>Maximum loop iterations, counted as completed model calls.
max_tokens: Option<u64>Maximum total recorded tokens (input plus output) across the run.
max_cost_usd: Option<f64>Maximum cost in US dollars, computed from recorded usage and the
agent’s Pricing. Declaring this without pricing is a build-time
error on the agent builder.
max_wall_time: Option<Duration>Maximum wall time, measured between recorded ctx.now()
observations, never against the ambient clock.
Implementations§
Source§impl Budgets
impl Budgets
Sourcepub fn any_declared(&self) -> bool
pub fn any_declared(&self) -> bool
Whether any dimension is declared at all.
Sourcepub fn first_crossing(
&self,
extensions: &BudgetExtensions,
pricing: Option<&Pricing>,
observations: &BudgetObservations,
) -> Option<(Budget, f64)>
pub fn first_crossing( &self, extensions: &BudgetExtensions, pricing: Option<&Pricing>, observations: &BudgetObservations, ) -> Option<(Budget, f64)>
The first crossing, if any, in the fixed check order (steps, tokens,
cost, wall time). Returns the crossed Budget (whose limit is
the effective limit: declared plus extensions) and the observed
value, both exactly as they will be recorded.