Enum Class 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()
      Returns an array containing the constants of this enum class, in the order they are declared.
      返回:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LongTermMemoryMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - 如果参数为空值