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 new(session_id: impl Into<String>) -> BudgetEnvelope
pub fn new(session_id: impl Into<String>) -> BudgetEnvelope
Create a new budget envelope with no limits.
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<BudgetEnvelope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BudgetEnvelope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for BudgetEnvelope
impl Serialize for BudgetEnvelope
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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