pub enum BeforeToolDecision {
Allow,
ModifyInput {
arguments: ToolCallArguments,
},
Deny {
message: String,
},
ShortCircuit {
output: ToolOutput,
},
StopTurn {
reason: String,
final_output: Option<String>,
},
}Expand description
Decision returned by a before_tool_call hook.
Variants§
Allow
Proceed with the tool call unchanged.
ModifyInput
Replace the tool call arguments before execution (re-validated against schema).
Fields
§
arguments: ToolCallArgumentsReplacement JSON object arguments.
Deny
Skip execution and record a failed tool result so the model can recover.
ShortCircuit
Skip execution and record a synthetic succeeded tool output.
Fields
§
output: ToolOutputSynthetic tool output recorded as the call’s durable result.
StopTurn
Skip this call and all remaining calls in the batch, settling them cleanly and stopping the turn.
Implementations§
Source§impl BeforeToolDecision
impl BeforeToolDecision
Sourcepub fn modify_input(arguments: ToolCallArguments) -> Self
pub fn modify_input(arguments: ToolCallArguments) -> Self
Replaces tool call arguments before execution.
Sourcepub fn deny(message: impl Into<String>) -> Self
pub fn deny(message: impl Into<String>) -> Self
Denies the tool call and returns message to the model.
Sourcepub fn short_circuit(output: ToolOutput) -> Self
pub fn short_circuit(output: ToolOutput) -> Self
Skips execution and returns output as a succeeded tool result.
Trait Implementations§
Source§impl Clone for BeforeToolDecision
impl Clone for BeforeToolDecision
Source§impl Debug for BeforeToolDecision
impl Debug for BeforeToolDecision
Source§impl<'de> Deserialize<'de> for BeforeToolDecision
impl<'de> Deserialize<'de> for BeforeToolDecision
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for BeforeToolDecision
Source§impl PartialEq for BeforeToolDecision
impl PartialEq for BeforeToolDecision
Source§impl Serialize for BeforeToolDecision
impl Serialize for BeforeToolDecision
impl StructuralPartialEq for BeforeToolDecision
Auto Trait Implementations§
impl Forget for BeforeToolDecision
impl Freeze for BeforeToolDecision
impl Move for BeforeToolDecision
impl RefUnwindSafe for BeforeToolDecision
impl Send for BeforeToolDecision
impl Sync for BeforeToolDecision
impl Unpin for BeforeToolDecision
impl UnsafeUnpin for BeforeToolDecisionwhere
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for BeforeToolDecision
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.