接口 ToolkitAware

所有已知实现类:
DynamicSkillMiddleware

public interface ToolkitAware
Implemented by middleware (or other components) that hold a reference to a Toolkit.

During ReActAgent.Builder.build(), the builder deep-copies the toolkit to isolate agent state. Any externally-constructed component that was handed the original toolkit will hold a stale reference after the copy. The builder detects components that implement this interface and calls rebindToolkit(Toolkit) with the deep-copied instance, so they transparently switch to the correct toolkit without requiring a factory method on the builder.

  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Replace this component's toolkit reference with the given instance.
  • 方法详细资料

    • rebindToolkit

      void rebindToolkit(Toolkit toolkit)
      Replace this component's toolkit reference with the given instance.

      Called by the agent builder after deep-copying the toolkit. Implementations should update their internal toolkit reference and, if necessary, re-register any tools they had previously registered on the old toolkit.

      参数:
      toolkit - the deep-copied toolkit that the agent will actually use; never null