Class AbstractToolkit<T extends AbstractTool<?,?>>

java.lang.Object
uno.anahata.asi.agi.tool.spi.AbstractToolkit<T>
Type Parameters:
T - The specific type of AbstractTool contained in this toolkit.
Direct Known Subclasses:
JavaObjectToolkit

public abstract class AbstractToolkit<T extends AbstractTool<?,?>> extends Object
Represents a collection of related tools, parsed from a single Java class. This is the core domain model for a "toolkit".
Author:
anahata-gemini-pro-2.5
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The default maximum depth policy for tools in this toolkit.
    protected String
    A description of the toolkit's purpose.
    protected boolean
    Whether the toolkit is currently enabled.
    protected String
    The name of the toolkit.
    protected final @NonNull ToolManager
    The parent ToolManager that manages this toolkit.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractToolkit(@NonNull ToolManager toolManager)
    Constructs a new AbstractToolkit.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets a list of tools that are allowed to be presented to the model.
    abstract List<T>
    Gets all tools declared within this toolkit, regardless of their permission status.
    If this toolkit provides additional context.
    Gets a list of tools that are allowed to be presented to the model.
    int
    Calculates the total token count of this toolkit on-the-fly by aggregating the cached token counts of all its contained tools.
    void
    Performs one-time setup after the toolkit is registered.
    void
    Performs logic after the session has been activated and bound to the environment.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • toolManager

      @NonNull protected final @NonNull ToolManager toolManager
      The parent ToolManager that manages this toolkit.
    • name

      protected String name
      The name of the toolkit.
    • description

      protected String description
      A description of the toolkit's purpose.
    • defaultMaxDepth

      protected int defaultMaxDepth
      The default maximum depth policy for tools in this toolkit.
    • enabled

      protected boolean enabled
      Whether the toolkit is currently enabled.
  • Constructor Details

    • AbstractToolkit

      protected AbstractToolkit(@NonNull @NonNull ToolManager toolManager)
      Constructs a new AbstractToolkit.
      Parameters:
      toolManager - The parent ToolManager.
  • Method Details

    • getAllTools

      public abstract List<T> getAllTools()
      Gets all tools declared within this toolkit, regardless of their permission status.
      Returns:
      The complete list of tools.
    • getAllowedTools

      public List<T> getAllowedTools()
      Gets a list of tools that are allowed to be presented to the model. This filters out tools that have a permanent ToolPermission.DENY permission and also returns an empty list if the entire toolkit is disabled.
      Returns:
      A filtered list of allowed tools.
    • getDisabledTools

      public List<T> getDisabledTools()
      Gets a list of tools that are allowed to be presented to the model. This filters out tools that have a permanent ToolPermission.DENY permission and also returns an empty list if the entire toolkit is disabled.
      Returns:
      A filtered list of allowed tools.
    • getTokenCount

      public int getTokenCount()
      Calculates the total token count of this toolkit on-the-fly by aggregating the cached token counts of all its contained tools.
      Returns:
      The total token count for the entire toolkit.
    • getContextProvider

      public abstract ContextProvider getContextProvider()
      If this toolkit provides additional context.
      Returns:
      the context provider if any.
    • initialize

      public void initialize()
      Performs one-time setup after the toolkit is registered.
    • postActivate

      public void postActivate()
      Performs logic after the session has been activated and bound to the environment. Subclasses should override this to perform one-time setup that requires the entire session graph to be available.