AS AgentScopeAPI 手册 / API Reference

ConflictPolicy

public enum ConflictPolicy
源码Source io/agentscope/core/state/ConflictPolicy.java:34–46

定义Conflict 策略相关取值的枚举。位于 io.agentscope.core.state 包。核心成员包括 OVERWRITE、FAIL、APPEND_MERGE。

Policy applied when an optimistic-concurrency save of agent session state conflicts with another writer's update.

CAS failures occur at the end of a turn — the reply may already have been streamed and tool side effects may already have run — so the policy cannot roll those back. Choose explicitly:

  • #OVERWRITE — unconditional last-writer-wins (default; matches pre-versioning behaviour).

  • #FAIL — throw ConcurrentSessionModificationException and skip the write. Recommended when a distributed session turn gate is enabled.

  • #APPEND_MERGE — reload the latest baseline, append this turn's new messages, and retry CAS. Reasonable for ordinary chat turns; unsafe for compaction/summary turns.

枚举常量摘要Enum Constant Summary

常量Constant说明Description
OVERWRITE
执行 `OVERWRITE` 方法。
Unconditional overwrite (default; preserves legacy last-writer-wins semantics).
FAIL
执行 `FAIL` 方法。
Fail the save and surface `ConcurrentSessionModificationException`.
APPEND_MERGE
追加MERGE。
Reload the latest baseline, append this turn's newly added messages, and retry CAS.

枚举常量详情Enum Constant Detail

OVERWRITE

OVERWRITE
staticfinal

执行 OVERWRITE 方法。

Unconditional overwrite (default; preserves legacy last-writer-wins semantics).

源码Source io/agentscope/core/state/ConflictPolicy.java:36

FAIL

FAIL
staticfinal

执行 FAIL 方法。

Fail the save and surface ConcurrentSessionModificationException.

源码Source io/agentscope/core/state/ConflictPolicy.java:39

APPEND_MERGE

APPEND_MERGE
staticfinal

追加MERGE。

Reload the latest baseline, append this turn's newly added messages, and retry CAS.

源码Source io/agentscope/core/state/ConflictPolicy.java:45
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.