pub struct Limits {
pub max_turns: u32,
pub max_tokens: Option<u64>,
pub max_tool_calls: Option<u32>,
pub timeout: Option<Duration>,
pub tool_timeout: Duration,
pub max_tool_output_chars: usize,
pub max_idle_continuations: u32,
pub hook_timeout: Duration,
}Expand description
Hard budgets for one run. Turns, tokens and tool calls are checked at the
top of every turn; tool calls and wall-clock time are also checked before
every call in a batch, and the model call and each tool are bounded by the
remaining wall-clock budget. max_turns cannot be switched off: it is
clamped to HARD_TURN_CAP.
Fields§
§max_turns: u32§max_tokens: Option<u64>Billable tokens for this run (cached input excluded).
max_tool_calls: Option<u32>§timeout: Option<Duration>Wall-clock budget for the whole run, summed across resumes.
tool_timeout: DurationPer-call timeout for tools.
max_tool_output_chars: usizeTool output beyond this many characters is cut to head + tail.
max_idle_continuations: u32How many times in a row on_stop hooks may send the model back with
no new successful tool call in between. Counting progress rather than
turns stops a hook and a refusing model from circling forever while
leaving long, productive runs alone.
hook_timeout: DurationHow long one hook call may take (see crate::Hook::timeout).
Trait Implementations§
impl StructuralPartialEq for Limits
Auto Trait Implementations§
impl Forget for Limits
impl Freeze for Limits
impl Move for Limits
impl RefUnwindSafe for Limits
impl Send for Limits
impl Sync for Limits
impl Unpin for Limits
impl UnsafeUnpin for Limits
impl UnwindSafe for Limits
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