Package com.embabel.agent.api.tool
Class ConditionalReplanningTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.DelegatingTool,com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo
public final class ConditionalReplanningTool implements DelegatingTool
Tool decorator that executes the wrapped tool, then conditionally triggers replanning based on the result.
Unlike ReplanningTool which always triggers replanning, this tool allows the ReplanDecider to inspect the result and decide whether to replan.
Note: This tool accesses AgentProcess via thread-local at call time, which is set by the decorator chain.
-
-
Field Summary
Fields Modifier and Type Field Description private final Tool.Definitiondefinitionprivate final Tool.Metadatametadataprivate final Tooldelegate
-
Constructor Summary
Constructors Constructor Description ConditionalReplanningTool(Tool delegate, ReplanDecider decider)
-
Method Summary
Modifier and Type Method Description Tool.DefinitiongetDefinition()Tool definition for LLM Tool.MetadatagetMetadata()Optional metadata ToolgetDelegate()Tool.Resultcall(String input)Execute the tool with JSON input. -
-
Constructor Detail
-
ConditionalReplanningTool
ConditionalReplanningTool(Tool delegate, ReplanDecider decider)
- Parameters:
delegate- The tool to wrapdecider- Decider that inspects the result context and determines whether to replan
-
-
Method Detail
-
getDefinition
Tool.Definition getDefinition()
Tool definition for LLM
-
getMetadata
Tool.Metadata getMetadata()
Optional metadata
-
getDelegate
Tool getDelegate()
-
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
-
-
-
-