枚举类 LongTermMemoryMode

java.lang.Object
java.lang.Enum<LongTermMemoryMode>
io.agentscope.core.memory.LongTermMemoryMode
所有已实现的接口:
Serializable, Comparable<LongTermMemoryMode>, Constable

public enum LongTermMemoryMode extends Enum<LongTermMemoryMode>
Defines how long-term memory is integrated with agent behavior.

This enum controls whether memory management is handled automatically by the framework, actively by the agent through tool calls, or both. The mode affects:

  • When memory recording and retrieval occur
  • Whether memory management tools are registered in the agent's toolkit
  • How much control the agent has over its own memory

Choosing the Right Mode:

  • AGENT_CONTROL: Use when you want the agent to have full autonomy over memory decisions. Good for advanced agents that understand when information is important.
  • STATIC_CONTROL: Use when you want automatic, framework-managed memory without agent involvement. Good for simpler agents or when memory should be comprehensive.
  • BOTH: Recommended default. Combines automatic background memory with agent control, providing the best of both approaches.

Usage Example:


 ReActAgent agent = ReActAgent.builder()
     .name("Assistant")
     .model(model)
     .longTermMemory(memory)
     .longTermMemoryMode(LongTermMemoryMode.BOTH)  // Recommended
     .build();
 
另请参阅:
  • 枚举常量详细资料

    • AGENT_CONTROL

      public static final LongTermMemoryMode AGENT_CONTROL
      Agent actively controls memory through tool calls.
    • STATIC_CONTROL

      public static final LongTermMemoryMode STATIC_CONTROL
      Framework automatically manages memory without agent involvement.
    • BOTH

      public static final LongTermMemoryMode BOTH
      Combines both agent control and automatic framework management.
  • 方法详细资料

    • values

      public static LongTermMemoryMode[] values()
      返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同
      返回:
      包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
    • valueOf

      public static LongTermMemoryMode valueOf(String name)
      返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - 如果该枚举类没有带有指定名称的常量
      NullPointerException - 如果参数为空值