Package com.embabel.agent.api.tool
Class ReplanningTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo,com.embabel.agent.spi.support.DelegatingTool
public final class ReplanningTool implements DelegatingTool
Tool decorator that executes the wrapped tool, adds its result to the blackboard, then throws ReplanRequestedException to terminate the tool loop and trigger replanning.
This enables patterns like:
Chat routing: A routing tool classifies intent and triggers replan to switch handlers
Discovery: A tool discovers information that requires a different plan
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 ReplanningTool(Tool delegate, String reason, ReplanningToolBlackboardUpdater blackboardUpdater)ReplanningTool(Tool delegate, String reason)
-
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
-
ReplanningTool
ReplanningTool(Tool delegate, String reason, ReplanningToolBlackboardUpdater blackboardUpdater)
- Parameters:
delegate- The tool to wrapreason- Human-readable explanation of why replan is neededblackboardUpdater- Callback to update the blackboard before replanning.
-
-
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
-
-
-
-