asTool
Deprecated
Please use `AIAgentService.createAgentTool(...)`, instead.Converting an instance of `AIAgent` into a tool is error-prone because `AIAgent` is essentially a single-use instance,while tools can be run multiple times, and moreover - in parallel - by another `AIAgent`. That would cause an error.
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
Agent name that would be a tool name for this agent tool.
Agent description that would be a tool description for this agent tool.
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.
Serializer to deserialize tool arguments to agent input.
Serializer to serialize agent output to tool result.
Optional Json instance to customize de/serialization behavior.