Interface ToolInjectionStrategy

  • All Implemented Interfaces:

    
    public interface ToolInjectionStrategy
    
                        

    Strategy for dynamically injecting tools during a conversation.

    Implementations examine tool call results and conversation state to determine if tools should be added or removed.

    This interface is designed for extensibility. Strategies include:

    • Conditional unlocks based on agent performance

    • Phase-based tools (planning vs execution)

    • Skill acquisition patterns

    • MatryoshkaTool progressive disclosure

    New implementations should override evaluate instead of evaluateToolResult. The evaluate method supports both adding and removing tools.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • evaluate

         ToolInjectionResult evaluate(ToolInjectionContext context)

        Called after each tool execution to determine tool changes.

        Default implementation bridges to legacy evaluateToolResult for backward compatibility. Override this method for new implementations that need to add/remove tools.

        Parameters:
        context - The current state of the tool loop
        Returns:

        Result containing tools to add and/or remove

      • evaluateToolResult

        @Deprecated(message = "Use evaluate() which supports both adding and removing tools", replaceWith = @ReplaceWith(imports = {}, expression = "evaluate(context)")) List<Tool> evaluateToolResult(ToolInjectionContext context)

        Legacy method for backward compatibility. Override evaluate instead for new implementations.

        Parameters:
        context - The current state of the tool loop
        Returns:

        Tools to add, or empty list if none