pub struct BudgetEnvelope {
pub session_id: String,
pub max_steps: Option<u32>,
pub steps_used: u32,
pub max_revisions: Option<u32>,
pub revisions_used: u32,
pub max_cost_usd: Option<f64>,
pub cost_used_usd: f64,
}Expand description
Budget envelope for plan execution.
Tracks cost, step, and revision budgets for a session. The governance layer checks these limits before allowing further execution.
Fields§
§session_id: StringSession ID.
max_steps: Option<u32>Maximum number of node execution steps allowed.
steps_used: u32Steps consumed so far.
max_revisions: Option<u32>Maximum number of plan revisions allowed.
revisions_used: u32Revisions consumed so far.
max_cost_usd: Option<f64>Maximum total cost in USD.
cost_used_usd: f64Cost consumed so far.
Implementations§
Source§impl BudgetEnvelope
impl BudgetEnvelope
Sourcepub fn steps_exhausted(&self) -> bool
pub fn steps_exhausted(&self) -> bool
Whether the step budget is exhausted.
Sourcepub fn revisions_exhausted(&self) -> bool
pub fn revisions_exhausted(&self) -> bool
Whether the revision budget is exhausted.
Sourcepub fn cost_exhausted(&self) -> bool
pub fn cost_exhausted(&self) -> bool
Whether the cost budget is exhausted.
Sourcepub fn any_exhausted(&self) -> bool
pub fn any_exhausted(&self) -> bool
Whether any budget limit has been exceeded.
Sourcepub fn record_step(&mut self)
pub fn record_step(&mut self)
Record a step.
Sourcepub fn record_revision(&mut self)
pub fn record_revision(&mut self)
Record a plan revision.
Sourcepub fn record_cost(&mut self, usd: f64)
pub fn record_cost(&mut self, usd: f64)
Record cost.
Trait Implementations§
Source§impl Clone for BudgetEnvelope
impl Clone for BudgetEnvelope
Source§fn clone(&self) -> BudgetEnvelope
fn clone(&self) -> BudgetEnvelope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BudgetEnvelope
impl Debug for BudgetEnvelope
Source§impl<'de> Deserialize<'de> for BudgetEnvelope
impl<'de> Deserialize<'de> for BudgetEnvelope
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BudgetEnvelope
impl RefUnwindSafe for BudgetEnvelope
impl Send for BudgetEnvelope
impl Sync for BudgetEnvelope
impl Unpin for BudgetEnvelope
impl UnsafeUnpin for BudgetEnvelope
impl UnwindSafe for BudgetEnvelope
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
Mutably borrows from an owned value. Read more