SimpleAgenticTool

data class SimpleAgenticTool(val definition: Tool.Definition, val metadata: Tool.Metadata = Tool.Metadata.DEFAULT, val llm: <Error class: unknown class> = LlmOptions(), val tools: List<Tool> = emptyList(), domainToolSources: List<DomainToolSource<*>> = emptyList(), autoDiscovery: Boolean = false, val systemPromptCreator: AgenticSystemPromptCreator = AgenticSystemPromptCreator { _, _ -> AgenticTool.defaultSystemPrompt(definition.description) }, val maxIterations: Int = AgenticTool.DEFAULT_MAX_ITERATIONS, val captureNestedArtifacts: Boolean = false) : AgenticTool<SimpleAgenticTool>

A simple agentic tool where all sub-tools are available immediately.

This is the most basic form of AgenticTool - all tools are available to the LLM from the start with no conditions or state requirements.

For more controlled tool availability, see:

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, given context and input

maxIterations

Maximum number of tool loop iterations

captureNestedArtifacts

Whether to capture artifacts from nested AgenticTools

Constructors

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

Create a simple agentic tool with name and description.

constructor(definition: Tool.Definition, metadata: Tool.Metadata = Tool.Metadata.DEFAULT, llm: <Error class: unknown class> = LlmOptions(), tools: List<Tool> = emptyList(), domainToolSources: List<DomainToolSource<*>> = emptyList(), autoDiscovery: Boolean = false, systemPromptCreator: AgenticSystemPromptCreator = AgenticSystemPromptCreator { _, _ -> AgenticTool.defaultSystemPrompt(definition.description) }, maxIterations: Int = AgenticTool.DEFAULT_MAX_ITERATIONS, captureNestedArtifacts: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
open override val definition: Tool.Definition
Link copied to clipboard
open override val llm: <Error class: unknown class>
Link copied to clipboard
open override val maxIterations: Int
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
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

Create a copy with different captureNestedArtifacts setting.

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
open override fun withLlm(llm: <Error class: unknown class>): SimpleAgenticTool

Create a copy with different LLM options.

Link copied to clipboard
open override fun withMaxIterations(maxIterations: Int): SimpleAgenticTool

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
open override fun withParameter(parameter: Tool.Parameter): SimpleAgenticTool

Create a copy with an additional parameter in the definition.

Link copied to clipboard

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

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

Link copied to clipboard

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

Register a class that can contribute @LlmTool methods when a single instance is retrieved. Kotlin-friendly version using reified type parameter.

inline fun <T : Any> withToolChainingFrom(noinline predicate: (T, AgentProcess?) -> Boolean): SimpleAgenticTool

Register a domain class with a predicate. Kotlin-friendly version using reified type parameter.

open override fun <T : Any> withToolChainingFrom(type: Class<T>, predicate: DomainToolPredicate<T>): SimpleAgenticTool

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
open override fun withToolObject(toolObject: Any): SimpleAgenticTool

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): SimpleAgenticTool

Create a copy with tools extracted from multiple objects with @LlmTool methods.

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

Create a copy with additional tools.