Struct Limits
pub struct Limits {
pub max_turns: u32,
pub max_tool_calls: u32,
pub max_output_tokens: u32,
pub max_history_tokens: u32,
}Expand description
Bounds on one run. A run that reaches max_turns or max_tool_calls gets one closing model
call in which it may call no tool, and ends with that answer marked limited (the output’s
limited and limit); if the closing call says nothing the run fails with a message naming the
limit (RunView::error). The history limit shortens old tool outputs instead (see
max_history_tokens).
Fields§
§max_turns: u32Most model calls that may be followed by tools in one run. The call after them is the closing turn: one more, with the tools offered but none callable.
max_tool_calls: u32Most tool calls in one run, counted when the model requests them. A model turn whose calls would go over the limit has none of them run (each is answered “not run”), and the next call is the closing turn.
max_output_tokens: u32Passed to the model as max_output_tokens; 0 leaves it to the model. The assembly
resolves it per model from the agent’s folder, its model_preset, the model’s profile and
the 128,000 fallback, then clamps it to the model’s limit and window (ADR 0064); a host that
builds an agent by hand gets this default, 4,096, and no resolution or clamp.
max_history_tokens: u32Budget for the history sent to the model, estimated as characters / 4.
Over it, old tool outputs are truncated in the stored history, with an explicit marker,
down to three quarters of the budget (so that it happens rarely and each request starts with
the one before: Conversation::shortenings says when); the results the model has not seen
yet are never touched, and the journal still holds the original outputs. 0 disables
truncation.
Trait Implementations§
impl Copy for Limits
impl Eq for Limits
impl StructuralPartialEq for Limits
Auto Trait Implementations§
impl Freeze 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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].