pub struct CancelOptions {
pub message: Option<String>,
pub after_current_tools: bool,
pub cancel_background_tasks: bool,
}Expand description
Options for CancelHandle::cancel (CancelOptions).
Fields§
§message: Option<String>Final assistant message for the cancelled invocation. When several callers set one, the last write wins; a cancel without a message keeps a previously stored one.
after_current_tools: boolDefer cancellation until the running tool batch finishes, so sibling tools complete
normally instead of seeing the signal fire. Only the agent loop acts on the deferral: it
stops after the batch. Until then CancelSignal::is_cancelled stays false for every
other observer.
cancel_background_tasks: boolAlso cancel every queued, working or input-required background task of the agent
immediately, even with after_current_tools and whether or not an invocation is running
(cancelBackgroundTasks). Background tasks keep running by default, and a
cancel_signal passed into an invocation never cancels them. Their cancelled results are
delivered like a cancel the model requested. If the invocation was only waiting for its
background tasks, it ends with its natural stop reason and the results are delivered on the
next invocation. Only an agent’s own handle acts on it.
Implementations§
Source§impl CancelOptions
impl CancelOptions
Sourcepub fn builder() -> CancelOptionsBuilder
pub fn builder() -> CancelOptionsBuilder
Create an instance of CancelOptions using the builder syntax
Trait Implementations§
Source§impl Clone for CancelOptions
impl Clone for CancelOptions
Source§impl Debug for CancelOptions
impl Debug for CancelOptions
Source§impl Default for CancelOptions
impl Default for CancelOptions
impl Eq for CancelOptions
Source§impl PartialEq for CancelOptions
impl PartialEq for CancelOptions
impl StructuralPartialEq for CancelOptions
Auto Trait Implementations§
impl Freeze for CancelOptions
impl RefUnwindSafe for CancelOptions
impl Send for CancelOptions
impl Sync for CancelOptions
impl Unpin for CancelOptions
impl UnsafeUnpin for CancelOptions
impl UnwindSafe for CancelOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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