Class ReplanningTool

  • All Implemented Interfaces:
    com.embabel.agent.api.tool.DelegatingTool , com.embabel.agent.api.tool.Tool , com.embabel.agent.api.tool.ToolInfo

    
    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.

    • Constructor Detail

      • ReplanningTool

        ReplanningTool(Tool delegate, String reason, ReplanningToolBlackboardUpdater blackboardUpdater)
        Parameters:
        delegate - The tool to wrap
        reason - Human-readable explanation of why replan is needed
        blackboardUpdater - Callback to update the blackboard before replanning.
      • ReplanningTool

        ReplanningTool(Tool delegate, String reason)
        Parameters:
        delegate - The tool to wrap
        reason - Human-readable explanation of why replan is needed