记录类 StatePersistence
java.lang.Object
java.lang.Record
io.agentscope.core.state.StatePersistence
- 记录组件:
memoryManaged- whether to manage Memory component statetoolkitManaged- whether to manage Toolkit activeGroups stateplanNotebookManaged- whether to manage PlanNotebook statestatefulToolsManaged- whether to manage stateful Tool states
public record StatePersistence(boolean memoryManaged, boolean toolkitManaged, boolean planNotebookManaged, boolean statefulToolsManaged)
extends Record
Configuration for which components ReActAgent should manage state persistence.
By default, ReActAgent manages state persistence for all its components (memory, toolkit, planNotebook, stateful tools). Users can selectively disable management for specific components to handle their state independently.
Example usage:
// Default: manage all components
ReActAgent agent = ReActAgent.builder()
.name("assistant")
.model(model)
.memory(memory)
.planNotebook(planNotebook)
.build();
// Exclude PlanNotebook: user manages it independently
ReActAgent agent = ReActAgent.builder()
.name("assistant")
.model(model)
.memory(memory)
.planNotebook(planNotebook)
.statePersistence(StatePersistence.builder()
.planNotebookManaged(false)
.build())
.build();
// Only manage Memory
ReActAgent agent = ReActAgent.builder()
.name("assistant")
.model(model)
.memory(memory)
.statePersistence(StatePersistence.memoryOnly())
.build();
// Don't manage any components (user fully controls)
ReActAgent agent = ReActAgent.builder()
.name("assistant")
.model(model)
.statePersistence(StatePersistence.none())
.build();
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static classBuilder for constructing StatePersistence instances with customizable settings. -
构造器概要
构造器构造器说明StatePersistence(boolean memoryManaged, boolean toolkitManaged, boolean planNotebookManaged, boolean statefulToolsManaged) 创建StatePersistence记录类的实例。 -
方法概要
修饰符和类型方法说明static StatePersistenceall()Default configuration: manage all components.static StatePersistence.Builderbuilder()Creates a new builder for constructing StatePersistence instances.final boolean指示某个其他对象是否“等于”此对象。final inthashCode()返回此对象的哈希代码值。boolean返回memoryManaged记录组件的值。static StatePersistenceOnly manage Memory component.static StatePersistencenone()Don't manage any components (user fully controls).boolean返回planNotebookManaged记录组件的值。boolean返回statefulToolsManaged记录组件的值。boolean返回toolkitManaged记录组件的值。final StringtoString()返回此记录类的字符串表示形式。
-
构造器详细资料
-
StatePersistence
public StatePersistence(boolean memoryManaged, boolean toolkitManaged, boolean planNotebookManaged, boolean statefulToolsManaged) 创建StatePersistence记录类的实例。- 参数:
memoryManaged-memoryManaged记录组件的值toolkitManaged-toolkitManaged记录组件的值planNotebookManaged-planNotebookManaged记录组件的值statefulToolsManaged-statefulToolsManaged记录组件的值
-
-
方法详细资料
-
all
Default configuration: manage all components. -
none
Don't manage any components (user fully controls). -
memoryOnly
Only manage Memory component. -
builder
Creates a new builder for constructing StatePersistence instances.- 返回:
- A new builder instance with all components enabled by default
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用 '==' 进行比较。 -
memoryManaged
public boolean memoryManaged()返回memoryManaged记录组件的值。- 返回:
memoryManaged记录组件的值
-
toolkitManaged
public boolean toolkitManaged()返回toolkitManaged记录组件的值。- 返回:
toolkitManaged记录组件的值
-
planNotebookManaged
public boolean planNotebookManaged()返回planNotebookManaged记录组件的值。- 返回:
planNotebookManaged记录组件的值
-
statefulToolsManaged
public boolean statefulToolsManaged()返回statefulToolsManaged记录组件的值。- 返回:
statefulToolsManaged记录组件的值
-