Skip to main content

ToolPolicy

Trait ToolPolicy 

Source
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§

Source

fn evaluate_approval( &self, tool_name: &str, args: &Value, ) -> Option<ApprovalRequest>

Provided Methods§

Source

fn before_call( &self, tool_name: &str, args: &Value, ctx: &ToolContext, ) -> Result<(), AgentError>

Source

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".

Implementors§