SafeTool
data class SafeTool<TArgs : Tool.Args, TResult : ToolResult>(tool: Tool<TArgs, TResult>, environment: AIAgentEnvironment)(source)
A wrapper class designed to safely execute a tool within a given AI agent environment. It provides mechanisms for handling tool execution results and differentiating between success and failure cases.
Parameters
TArgs
The type of arguments accepted by the underlying tool. Must extend Tool.Args.
TResult
The type of result produced by the underlying tool. Must extend ToolResult.
Types
Functions
Link copied to clipboard
Executes the tool with the provided arguments and returns the result.
Link copied to clipboard
Executes a raw tool call with the given arguments, returning the resulting content as a string.
Link copied to clipboard
Executes a tool with the provided arguments in an unsafe manner. This method does not enforce type safety for the arguments provided to the tool.