pub struct Approval<F> { /* private fields */ }Expand description
Approval gate interceptor for tool calls.
Runs a check function before each tool execution. The function can:
- Allow the call to proceed unchanged
- Deny the call with an error message
- Modify the arguments before proceeding
§Example
ⓘ
use llm_stack::intercept::{InterceptorStack, ToolExec, Approval, ApprovalDecision};
let stack = InterceptorStack::<ToolExec<()>>::new()
.with(Approval::new(|req| {
if req.name == "delete_file" {
ApprovalDecision::Deny("Destructive operations not allowed".into())
} else {
ApprovalDecision::Allow
}
}));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for Approval<F>where
F: Freeze,
impl<F> RefUnwindSafe for Approval<F>where
F: RefUnwindSafe,
impl<F> Send for Approval<F>where
F: Send,
impl<F> Sync for Approval<F>where
F: Sync,
impl<F> Unpin for Approval<F>where
F: Unpin,
impl<F> UnwindSafe for Approval<F>where
F: UnwindSafe,
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