AIAgentTool
class AIAgentTool<Input, Output>(agent: AIAgentBase<Input, Output>, agentName: String, agentDescription: String, inputDescriptor: ToolParameterDescriptor, inputSerializer: KSerializer<Input>, outputSerializer: KSerializer<Output>, json: Json = Json.Default) : Tool<AIAgentTool.AgentToolArgs, AIAgentTool.AgentToolResult> (source)
AIAgentTool is a specialized tool that integrates an AI agent for processing tasks by leveraging input arguments and producing corresponding results.
This class extends the generic Tool interface with custom argument and result types.
Parameters
agent
The AI agent that implements the AIAgentBase interface and handles task execution.
agentName
A name assigned to the tool that helps identify it.
agentDescription
A brief description of what the tool does.
Constructors
Link copied to clipboard
constructor(agent: AIAgentBase<Input, Output>, agentName: String, agentDescription: String, inputDescriptor: ToolParameterDescriptor, inputSerializer: KSerializer<Input>, outputSerializer: KSerializer<Output>, json: Json = Json.Default)
Creates an instance of AIAgentTool with the specified AI agent, its name, description, and an optional description for the request parameter.
Types
Link copied to clipboard
Represents the arguments required for the execution of an agent tool. Wraps raw arguments.
Link copied to clipboard
data class AgentToolResult(val successful: Boolean, val errorMessage: String? = null, val result: JsonElement? = null) : ToolResult.JSONSerializable<AIAgentTool.AgentToolResult>
Represents the result of executing an agent tool operation.
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun execute(args: AIAgentTool.AgentToolArgs, enabler: DirectToolCallsEnabler): AIAgentTool.AgentToolResult
Link copied to clipboard