createAgentTool

inline fun <Input, Output> AIAgentService<Input, Output, *>.createAgentTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), parentAgentId: String? = null, clock: Clock = Clock.System): Tool<Input, AIAgentTool.AgentToolResult<Output>>(source)

Creates an AIAgent and converts it to a Tool that can be used by other AI Agents.

Return

A special tool that wraps the agent functionality.

A tool instance configured with the provided parameters, representing the AI agent.

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.

inputDescription

An optional description of the agent's input. Required for primitive types only!

  • If not specified for a primitive input type (ex: String, Int, ...), an empty input description will be sent to LLM.

  • Does not have any effect for non-primitive Input type with @LLMDescription annotations.

inputSerializer

Serializer to deserialize tool arguments to agent input.

outputSerializer

Serializer to serialize agent output to a tool result.

parentAgentId

Optional ID of the parent AI agent. Tool agent IDs will be generated as "parentAgentId."

clock

The clock instance used to manage time-related operations. Defaults to Clock.System.