Class SimpleAgenticTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo,com.embabel.agent.api.tool.agentic.AgenticTool,com.embabel.agent.api.tool.agentic.ToolChaining
public final class SimpleAgenticTool implements 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:
com.embabel.agent.api.tool.agentic.playbook.PlaybookTool: Progressive unlock via conditions
com.embabel.agent.api.tool.agentic.state.StateMachineTool: State-based availability
-
-
Field Summary
Fields Modifier and Type Field Description private final Tool.Definitiondefinitionprivate final Tool.Metadatametadataprivate final LlmOptionsllmprivate final List<Tool>toolsprivate final AgenticSystemPromptCreatorsystemPromptCreatorprivate final IntegermaxIterationsprivate final BooleancaptureNestedArtifacts
-
Constructor Summary
Constructors Constructor Description SimpleAgenticTool(String name, String description)Create a simple agentic tool with name and description. SimpleAgenticTool(Tool.Definition definition, Tool.Metadata metadata, LlmOptions llm, List<Tool> tools, List<DomainToolSource<?>> domainToolSources, Boolean autoDiscovery, AgenticSystemPromptCreator systemPromptCreator, Integer maxIterations, Boolean captureNestedArtifacts)
-
Method Summary
Modifier and Type Method Description Tool.DefinitiongetDefinition()Tool.MetadatagetMetadata()LlmOptionsgetLlm()final List<Tool>getTools()final AgenticSystemPromptCreatorgetSystemPromptCreator()IntegergetMaxIterations()final BooleangetCaptureNestedArtifacts()Tool.Resultcall(String input)Execute the tool with JSON input. SimpleAgenticToolwithLlm(LlmOptions llm)Create a copy with different LLM options. SimpleAgenticToolwithSystemPrompt(AgenticSystemPromptCreator creator)Create a copy with a dynamic system prompt creator. SimpleAgenticToolwithMaxIterations(Integer maxIterations)Create a copy with a different max iterations limit. SimpleAgenticToolwithParameter(Tool.Parameter parameter)Create a copy with an additional parameter in the definition. SimpleAgenticToolwithToolObject(Object toolObject)Create a copy with tools extracted from an object with @LlmTool methods. final SimpleAgenticToolwithTools(Tool additionalTools)Create a copy with additional tools. final SimpleAgenticToolwithToolObjects(Object toolObjects)Create a copy with tools extracted from multiple objects with @LlmTool methods. final SimpleAgenticToolwithCaptureNestedArtifacts(Boolean capture)Create a copy with different captureNestedArtifacts setting. <T extends Any> SimpleAgenticToolwithToolChainingFrom(Class<T> type, DomainToolPredicate<T> predicate)Register a domain class with a predicate to control when its @LlmTool methods become available as tools. final <T extends Any> SimpleAgenticToolwithToolChainingFrom(Function2<T, AgentProcess, Boolean> predicate)Register a domain class with a predicate. final <T extends Any> SimpleAgenticToolwithToolChainingFrom()Register a class that can contribute @LlmTool methods when a single instance is retrieved. SimpleAgenticToolwithToolChainingFromAny()Enable auto-discovery of chained tools from any returned artifact. -
Methods inherited from class com.embabel.agent.api.tool.agentic.AgenticTool
withSystemPrompt -
Methods inherited from class com.embabel.agent.api.tool.agentic.ToolChaining
withToolChainingFrom -
Methods inherited from class com.embabel.agent.api.tool.Tool
withDescription, withName, withNote -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SimpleAgenticTool
SimpleAgenticTool(String name, String description)
Create a simple agentic tool with name and description.
-
SimpleAgenticTool
SimpleAgenticTool(Tool.Definition definition, Tool.Metadata metadata, LlmOptions llm, List<Tool> tools, List<DomainToolSource<?>> domainToolSources, Boolean autoDiscovery, AgenticSystemPromptCreator systemPromptCreator, Integer maxIterations, Boolean captureNestedArtifacts)
- Parameters:
definition- Tool definition (name, description, input schema)metadata- Optional tool metadatallm- LLM to use for orchestrationtools- Sub-tools available for the LLM to orchestratesystemPromptCreator- Create prompt for the LLM to use, given context and inputmaxIterations- Maximum number of tool loop iterationscaptureNestedArtifacts- Whether to capture artifacts from nested AgenticTools
-
-
Method Detail
-
getDefinition
Tool.Definition getDefinition()
-
getMetadata
Tool.Metadata getMetadata()
-
getLlm
LlmOptions getLlm()
-
getSystemPromptCreator
final AgenticSystemPromptCreator getSystemPromptCreator()
-
getMaxIterations
Integer getMaxIterations()
-
getCaptureNestedArtifacts
final Boolean getCaptureNestedArtifacts()
-
call
Tool.Result call(String input)
Execute the tool with JSON input.
- Parameters:
input- JSON string matching inputSchema- Returns:
Result to send back to LLM
-
withLlm
SimpleAgenticTool withLlm(LlmOptions llm)
Create a copy with different LLM options.
-
withSystemPrompt
SimpleAgenticTool withSystemPrompt(AgenticSystemPromptCreator creator)
Create a copy with a dynamic system prompt creator. The creator receives the execution context and input string.
-
withMaxIterations
SimpleAgenticTool withMaxIterations(Integer maxIterations)
Create a copy with a different max iterations limit.
-
withParameter
SimpleAgenticTool withParameter(Tool.Parameter parameter)
Create a copy with an additional parameter in the definition.
-
withToolObject
SimpleAgenticTool withToolObject(Object toolObject)
Create a copy with tools extracted from an object with @LlmTool methods. If the object has no @LlmTool methods, returns this unchanged.
-
withTools
final SimpleAgenticTool withTools(Tool additionalTools)
Create a copy with additional tools.
-
withToolObjects
final SimpleAgenticTool withToolObjects(Object toolObjects)
Create a copy with tools extracted from multiple objects with @LlmTool methods.
-
withCaptureNestedArtifacts
final SimpleAgenticTool withCaptureNestedArtifacts(Boolean capture)
Create a copy with different captureNestedArtifacts setting.
-
withToolChainingFrom
<T extends Any> SimpleAgenticTool withToolChainingFrom(Class<T> type, DomainToolPredicate<T> predicate)
Register a domain class with a predicate to control when its @LlmTool methods become available as tools.
When a single artifact of the specified type is returned, any @LlmTool annotated methods on that instance become available as tools, provided the predicate is satisfied.
When multiple artifacts of the same type are returned, "last wins" - only the most recent artifact that passes the predicate will have its tools exposed.
- Parameters:
type- The domain class that may contribute @LlmTool methodspredicate- Predicate to filter which instances contribute tools
-
withToolChainingFrom
final <T extends Any> SimpleAgenticTool withToolChainingFrom(Function2<T, AgentProcess, Boolean> predicate)
Register a domain class with a predicate. Kotlin-friendly version using reified type parameter.
-
withToolChainingFrom
final <T extends Any> SimpleAgenticTool withToolChainingFrom()
Register a class that can contribute @LlmTool methods when a single instance is retrieved. Kotlin-friendly version using reified type parameter.
-
withToolChainingFromAny
SimpleAgenticTool withToolChainingFromAny()
Enable auto-discovery of chained tools from any returned artifact.
When enabled, any artifact with @LlmTool methods will automatically have its tools exposed, replacing ALL previous bindings.
-
-
-
-