AgenticTool

data class AgenticTool(val definition: Tool.Definition, val metadata: Tool.Metadata = Tool.Metadata.DEFAULT, val llm: <Error class: unknown class> = LlmOptions(), val tools: List<Tool> = emptyList(), val systemPromptCreator: SystemPromptCreator = { defaultSystemPrompt(definition.description) }) : Tool

An agentic tool that uses an LLM to orchestrate other tools.

Unlike a regular Tool which executes deterministic logic, an AgenticTool tool uses an LLM to decide which sub-tools to call based on a prompt.

Parameters

definition

Tool definition (name, description, input schema)

metadata

Optional tool metadata

llm

Llm to use for orchestration

tools

Sub-tools available for the LLM to orchestrate

systemPromptCreator

Create prompt for the LLM to use. Specify to customize behavior

Constructors

Link copied to clipboard
constructor(name: String, description: String)

Create an agentic tool that will need to be customized to add tools (and possibly specify an LLM) to be useful.

constructor(definition: Tool.Definition, metadata: Tool.Metadata = Tool.Metadata.DEFAULT, llm: <Error class: unknown class> = LlmOptions(), tools: List<Tool> = emptyList(), systemPromptCreator: SystemPromptCreator = { defaultSystemPrompt(definition.description) })

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val definition: Tool.Definition
Link copied to clipboard
val llm: <Error class: unknown class>
Link copied to clipboard
open override val metadata: Tool.Metadata
Link copied to clipboard

Functions

Link copied to clipboard
open override fun call(input: String): Tool.Result

Execute the tool with JSON input.

Link copied to clipboard
fun Tool.toSpringToolCallback(): <Error class: unknown class>

Extension function to convert an Embabel Tool to a Spring AI ToolCallback.

Link copied to clipboard
fun withLlm(llm: <Error class: unknown class>): AgenticTool

Create a copy with different model.

Link copied to clipboard
Link copied to clipboard

Create a copy with fixed syste prompt. The system prompt describes the supervisor behavior.

Link copied to clipboard
Link copied to clipboard
fun withToolObject(toolObject: Any): AgenticTool

Create a copy with tools extracted from an object with @LlmTool methods. If the object has no @LlmTool methods, returns this unchanged.

Link copied to clipboard
fun withToolObjects(vararg toolObjects: Any): AgenticTool

Create a copy with tools extracted from multiple objects with @LlmTool methods. Objects without @LlmTool methods are silently ignored.

Link copied to clipboard
fun withTools(vararg additionalTools: Tool): AgenticTool

Create a copy with additional tools.