Class AgenticTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo
@Deprecated(message = "Use SimpleAgenticTool for flat tool orchestration, or PlaybookTool/StateMachineTool for controlled disclosure", replaceWith = @ReplaceWith(imports = {"com.embabel.agent.api.tool.agentic.simple.SimpleAgenticTool"}, expression = "SimpleAgenticTool")) public final class AgenticTool implements 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAgenticTool.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Tool.Definitiondefinitionprivate final Tool.Metadatametadataprivate final LlmOptionsllmprivate final List<Tool>toolsprivate final Function1<AgentProcess, String>systemPromptCreatorprivate final BooleancaptureNestedArtifactspublic final static AgenticTool.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description AgenticTool(String name, String description)Create an agentic tool that will need to be customized to add tools (and possibly specify an LLM) to be useful. AgenticTool(Tool.Definition definition, Tool.Metadata metadata, LlmOptions llm, List<Tool> tools, Function1<AgentProcess, String> systemPromptCreator, Boolean captureNestedArtifacts)
-
Method Summary
Modifier and Type Method Description Tool.DefinitiongetDefinition()Tool.MetadatagetMetadata()final LlmOptionsgetLlm()final List<Tool>getTools()final Function1<AgentProcess, String>getSystemPromptCreator()final BooleangetCaptureNestedArtifacts()Tool.Resultcall(String input)Execute the tool with JSON input. final AgenticToolwithLlm(LlmOptions llm)Create a copy with different model. final AgenticToolwithParameter(Tool.Parameter parameter)final AgenticToolwithTools(Tool additionalTools)Create a copy with additional tools. final AgenticToolwithSystemPrompt(String prompt)Create a copy with fixed syste prompt. final AgenticToolwithSystemPromptCreator(Function1<AgentProcess, String> promptCreator)final AgenticToolwithCaptureNestedArtifacts(Boolean capture)Create a copy with different captureNestedArtifacts setting. final AgenticToolwithToolObject(Object toolObject)Create a copy with tools extracted from an object with @LlmTool methods. final AgenticToolwithToolObjects(Object toolObjects)Create a copy with tools extracted from multiple objects with @LlmTool methods. -
-
Constructor Detail
-
AgenticTool
AgenticTool(String name, String description)
Create an agentic tool that will need to be customized to add tools (and possibly specify an LLM) to be useful.
-
AgenticTool
AgenticTool(Tool.Definition definition, Tool.Metadata metadata, LlmOptions llm, List<Tool> tools, Function1<AgentProcess, String> systemPromptCreator, 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.captureNestedArtifacts- Whether to capture artifacts from nested AgenticTools.
-
-
Method Detail
-
getDefinition
Tool.Definition getDefinition()
-
getMetadata
Tool.Metadata getMetadata()
-
getLlm
final LlmOptions getLlm()
-
getSystemPromptCreator
final Function1<AgentProcess, String> getSystemPromptCreator()
-
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
final AgenticTool withLlm(LlmOptions llm)
Create a copy with different model.
-
withParameter
final AgenticTool withParameter(Tool.Parameter parameter)
-
withTools
final AgenticTool withTools(Tool additionalTools)
Create a copy with additional tools.
-
withSystemPrompt
final AgenticTool withSystemPrompt(String prompt)
Create a copy with fixed syste prompt. The system prompt describes the supervisor behavior.
-
withSystemPromptCreator
final AgenticTool withSystemPromptCreator(Function1<AgentProcess, String> promptCreator)
-
withCaptureNestedArtifacts
final AgenticTool withCaptureNestedArtifacts(Boolean capture)
Create a copy with different captureNestedArtifacts setting. When false (default), artifacts from nested AgenticTools are not captured. When true, all artifacts are captured including those from nested agentic sub-tools.
-
withToolObject
final AgenticTool 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.
-
withToolObjects
final AgenticTool withToolObjects(Object toolObjects)
Create a copy with tools extracted from multiple objects with @LlmTool methods. Objects without @LlmTool methods are silently ignored.
-
-
-
-