pub trait ToolPolicy: Send + Sync {
// Required method
fn evaluate_approval(
&self,
tool_name: &str,
args: &Value,
) -> Option<ApprovalRequest>;
// 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( &self, tool_name: &str, args: &Value, ) -> Option<ApprovalRequest>
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".