Package com.embabel.agent.tools.agent
Class AgentTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo
public final class AgentTool<I extends Object> implements Tool
Tool that can be used to execute an agent. Supports "Subagent" or "handoff" style usage.
This is the framework-agnostic version that implements Embabel's Tool interface.
-
-
Field Summary
Fields Modifier and Type Field Description private final Tool.Definitiondefinitionprivate final Tool.Metadatametadataprivate final Agentagentprivate final TextCommunicatortextCommunicatorprivate final ObjectMapperobjectMapperprivate final Class<I>inputTypeprivate final Function1<AgentProcess, ProcessOptions>processOptionsCreator
-
Constructor Summary
Constructors Constructor Description AgentTool(Autonomy autonomy, Agent agent, TextCommunicator textCommunicator, ObjectMapper objectMapper, Class<I> inputType, Function1<AgentProcess, ProcessOptions> processOptionsCreator)
-
Method Summary
Modifier and Type Method Description Tool.DefinitiongetDefinition()Tool definition for LLM Tool.MetadatagetMetadata()Optional metadata final AgentgetAgent()final TextCommunicatorgetTextCommunicator()final ObjectMappergetObjectMapper()final Class<I>getInputType()final Function1<AgentProcess, ProcessOptions>getProcessOptionsCreator()Tool.Resultcall(String input)Execute the tool with JSON input. StringtoString()-
-
Constructor Detail
-
AgentTool
AgentTool(Autonomy autonomy, Agent agent, TextCommunicator textCommunicator, ObjectMapper objectMapper, Class<I> inputType, Function1<AgentProcess, ProcessOptions> processOptionsCreator)
-
-
Method Detail
-
getDefinition
Tool.Definition getDefinition()
Tool definition for LLM
-
getMetadata
Tool.Metadata getMetadata()
Optional metadata
-
getTextCommunicator
final TextCommunicator getTextCommunicator()
-
getObjectMapper
final ObjectMapper getObjectMapper()
-
getInputType
final Class<I> getInputType()
-
getProcessOptionsCreator
final Function1<AgentProcess, ProcessOptions> getProcessOptionsCreator()
-
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
-
-
-
-