AgenticTool

A tool that uses an LLM to orchestrate sub-tools.

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

Implementations differ in how they manage tool availability:

All implementations share a consistent fluent API for configuration. The type parameter THIS enables fluent method chaining that preserves the concrete type.

Parameters

THIS

The concrete implementation type for fluent method chaining

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Tool definition for LLM

Link copied to clipboard
abstract val llm: <Error class: unknown class>

LLM options for orchestration.

Link copied to clipboard
abstract val maxIterations: Int

Maximum number of tool loop iterations.

Link copied to clipboard

Optional metadata

Functions

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

Execute the tool with JSON input.

Link copied to clipboard
inline fun <T : Any> Tool.requireType(message: String? = null): Tool

Wrap this tool to require a value of type T before execution (reified).

fun <T : Any> Tool.requireType(type: Class<T>, messageProvider: (String) -> String? = { null }): Tool

Wrap this tool to require a value of type T before execution.

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
inline fun <T : Tool> Tool.unwrapAs(): T?

Unwrap a tool to find a specific type, or return null if not found.

Link copied to clipboard

Wrap this tool to conditionally await before execution.

Link copied to clipboard
fun Tool.withConfirmation(messageProvider: (String) -> String): Tool

Wrap this tool to always require confirmation before execution.

Link copied to clipboard
open fun withDescription(newDescription: String): Tool

Create a new tool with a different description. Useful for providing context-specific descriptions while keeping the same functionality.

Link copied to clipboard
fun Tool.withEventPublication(agentProcess: AgentProcess, action: Action?, llmOptions: <Error class: unknown class>): Tool

Extension function to wrap a Tool with event publication.

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

Create a copy with different LLM options.

Link copied to clipboard
abstract fun withMaxIterations(maxIterations: Int): THIS

Create a copy with a different max iterations limit.

Link copied to clipboard
open fun withName(newName: String): Tool

Create a new tool with a different name. Useful for namespacing tools when combining multiple tool sources.

Link copied to clipboard
open fun withNote(note: String): Tool

Create a new tool with an additional note appended to the description. Useful for adding context-specific hints to an existing tool.

Link copied to clipboard
abstract fun withParameter(parameter: Tool.Parameter): THIS

Create a copy with an additional parameter in the definition.

Link copied to clipboard

Create a copy with a dynamic system prompt creator. The creator receives the execution context and input string.

open fun withSystemPrompt(prompt: String): THIS

Create a copy with a fixed system prompt. This is a convenience method that delegates to withSystemPrompt with a creator.

Link copied to clipboard
open fun <T : Any> withToolChainingFrom(type: Class<T>): THIS

Register a class whose @LlmTool methods become available as tools when a single instance of that type is returned as an artifact.

abstract fun <T : Any> withToolChainingFrom(type: Class<T>, predicate: DomainToolPredicate<T>): THIS

Register a domain class with a predicate to control when its @LlmTool methods become available as tools.

Link copied to clipboard

Enable auto-discovery of chained tools from any returned artifact.

Link copied to clipboard
abstract fun withToolObject(toolObject: Any): THIS

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