pub struct TurnBudget {
pub max_provider_rounds: u32,
pub max_tool_calls: u32,
pub max_elapsed: Duration,
pub max_accumulated_tool_result_bytes: usize,
pub max_context_tokens: Option<u64>,
pub max_cost_usd: Option<f64>,
pub max_round_renewals: u32,
}Expand description
Per-turn limits (spec §8.1).
Fields§
§max_provider_rounds: u32§max_tool_calls: u32§max_elapsed: Duration§max_accumulated_tool_result_bytes: usize§max_context_tokens: Option<u64>§max_cost_usd: Option<f64>§max_round_renewals: u32Bounded auto-renewals of the provider-round allowance (spec §8.1).
On exhaustion the stream loop may reset the round counter this many
times so a long, legitimate task continues instead of hard-failing.
Wall-clock is NEVER renewed, so total turn time is still bounded; a
value of 0 means no graceful continuation (immediate hard stop).
Implementations§
Source§impl TurnBudget
impl TurnBudget
Sourcepub fn for_role(role: TurnRole) -> Self
pub fn for_role(role: TurnRole) -> Self
Compiled per-role defaults. Foreground is the most generous (a human is watching); autonomous is the tightest (nobody is); workers sit between (bounded delegation with a supervising turn).
Sourcepub fn from_config(role: TurnRole, config: &TurnBudgetsConfig) -> Self
pub fn from_config(role: TurnRole, config: &TurnBudgetsConfig) -> Self
Role defaults overlaid with the typed config (unset fields keep the compiled defaults).
Trait Implementations§
Source§impl Clone for TurnBudget
impl Clone for TurnBudget
Source§fn clone(&self) -> TurnBudget
fn clone(&self) -> TurnBudget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TurnBudget
impl Debug for TurnBudget
Source§impl PartialEq for TurnBudget
impl PartialEq for TurnBudget
impl StructuralPartialEq for TurnBudget
Auto Trait Implementations§
impl Freeze for TurnBudget
impl RefUnwindSafe for TurnBudget
impl Send for TurnBudget
impl Sync for TurnBudget
impl Unpin for TurnBudget
impl UnsafeUnpin for TurnBudget
impl UnwindSafe for TurnBudget
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.