agentscope-extensions-memory-bailian integrates with Alibaba Cloud Bailian’s long-term memory service. It is fully managed and supports advanced retrieval features such as rerank, judge, and rewrite.
When to use
- You are already on Alibaba Cloud Bailian and want to reuse memory libraries from the platform.
- You care about retrieval quality and want to use Bailian’s rerank / judge / rewrite pipeline.
- You need three-level isolation via
userId+memoryLibraryId+projectId.
Add the dependency
Quickstart
BailianLongTermMemory implements AutoCloseable — try-with-resources is recommended so the underlying HTTP connections get released.
Retrieval feature switches
On top of basic recall, Bailian supports three pipeline switches:Message filtering
Bailian memory only stores natural user/assistant exchanges:- Only
MsgRole.USERandMsgRole.ASSISTANTmessages are written. - Assistant messages containing
ToolUseBlock(tool-call requests) are skipped. - Messages with the
<compressed_history>marker are skipped to avoid storing duplicated compressed history.
record(...).