pub trait ToolPolicy: Send + Sync {
// Required method
fn evaluate_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Option<ApprovalRequest>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
// Provided methods
fn before_call(
&self,
tool_name: &str,
args: &Value,
ctx: &ToolContext,
) -> Result<(), AgentError> { ... }
fn after_call(
&self,
tool_name: &str,
args: &Value,
result: &ToolOutput,
ctx: &ToolContext,
) -> Result<(), AgentError> { ... }
}Required Methods§
fn evaluate_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Option<ApprovalRequest>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Provided Methods§
fn before_call( &self, tool_name: &str, args: &Value, ctx: &ToolContext, ) -> Result<(), AgentError>
fn after_call( &self, tool_name: &str, args: &Value, result: &ToolOutput, ctx: &ToolContext, ) -> Result<(), AgentError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".