asTool

inline fun <Input, Output> AIAgentBase<Input, Output>.asTool(agentName: String, agentDescription: String, inputDescriptor: ToolParameterDescriptor, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), json: Json = Json.Default): Tool<AIAgentTool.AgentToolArgs, AIAgentTool.AgentToolResult>(source)

Converts the current AI agent into a tool to allow using it in other agents as a tool.

Return

A special tool that wraps the agent functionality.

Parameters

agentName

Agent name that would be a tool name for this agent tool.

agentDescription

Agent description that would be a tool description for this agent tool.

inputDescriptor

Descriptor for the agent input.

inputSerializer

Serializer to deserialize tool arguments to agent input.

outputSerializer

Serializer to serialize agent output to tool result.

json

Optional Json instance to customize de/serialization behavior.