#[non_exhaustive]pub struct ExecuteToolContext {
pub agent: ToolAgent,
pub tool: Option<Arc<dyn Tool>>,
pub tool_use: ToolUse,
pub invocation_state: InvocationState,
/* private fields */
}Expand description
What tool-stage handlers receive (ExecuteToolContext). tool_use is a copy of the model’s
request; invocation_state is shared.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.agent: ToolAgentThe agent, as tools see it (an escape hatch).
tool: Option<Arc<dyn Tool>>The tool that runs, or None when the name is not registered.
tool_use: ToolUseThe tool use request.
invocation_state: InvocationStatePer-invocation state, shared.
Implementations§
Source§impl ExecuteToolContext
impl ExecuteToolContext
Sourcepub fn cancel_signal(&self) -> &CancelSignal
pub fn cancel_signal(&self) -> &CancelSignal
The executor’s cancellation signal for this call; observe it, it cannot be replaced.
Sourcepub fn interrupt(
&self,
params: impl Into<InterruptParams>,
) -> Result<MiddlewareInterruptResult, InterruptError>
pub fn interrupt( &self, params: impl Into<InterruptParams>, ) -> Result<MiddlewareInterruptResult, InterruptError>
Requests a human-in-the-loop interrupt (interrupt).
Returns the response on resume (or the preemptive params.response); otherwise the
interrupt, which ? turns into MiddlewareError::Interrupt so
the agent stops with StopReason::Interrupt and the tool does not run. The id is
middleware:executeTool:<toolUseId>:<name>.
§Errors
The unanswered interrupt.
Trait Implementations§
Source§impl Clone for ExecuteToolContext
impl Clone for ExecuteToolContext
Auto Trait Implementations§
impl !RefUnwindSafe for ExecuteToolContext
impl !UnwindSafe for ExecuteToolContext
impl Freeze for ExecuteToolContext
impl Send for ExecuteToolContext
impl Sync for ExecuteToolContext
impl Unpin for ExecuteToolContext
impl UnsafeUnpin for ExecuteToolContext
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
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<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> ⓘ
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 moreCreates a shared type from an unshared type.