Skip to content

Commit f0cc70f

Browse files
feat: add 'none' memory backend to disable long memory system (agentscope-ai#5732)
1 parent f0d2279 commit f0cc70f

7 files changed

Lines changed: 76 additions & 9 deletions

File tree

console/src/constants/backendMappings.test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,24 @@ describe("CONTEXT_MANAGER_BACKEND_OPTIONS", () => {
7676
});
7777

7878
describe("MEMORY_MANAGER_BACKEND_OPTIONS", () => {
79-
it("is derived from MEMORY_MANAGER_BACKEND_MAPPINGS", () => {
79+
it("includes all mappings plus the 'none' (disabled) option", () => {
8080
expect(MEMORY_MANAGER_BACKEND_OPTIONS.length).toBe(
81-
Object.keys(MEMORY_MANAGER_BACKEND_MAPPINGS).length,
81+
Object.keys(MEMORY_MANAGER_BACKEND_MAPPINGS).length + 1,
8282
);
8383
});
84+
85+
it("contains the 'none' disabled option", () => {
86+
const noneOption = MEMORY_MANAGER_BACKEND_OPTIONS.find(
87+
(o) => o.value === "none",
88+
);
89+
expect(noneOption).toBeDefined();
90+
expect(noneOption!.label).toContain("disabled");
91+
});
92+
93+
it("each option has value and label", () => {
94+
for (const opt of MEMORY_MANAGER_BACKEND_OPTIONS) {
95+
expect(opt).toHaveProperty("value");
96+
expect(opt).toHaveProperty("label");
97+
}
98+
});
8499
});

console/src/constants/backendMappings.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ export const MEMORY_MANAGER_BACKEND_MAPPINGS: Record<
4040
},
4141
};
4242

43+
/** Valid memory backend keys (includes "none" which disables memory). */
44+
export const MEMORY_MANAGER_BACKEND_OPTIONS = [
45+
...Object.entries(MEMORY_MANAGER_BACKEND_MAPPINGS).map(
46+
([value, { label }]) => ({ value, label }),
47+
),
48+
{ value: "none", label: "none (disabled)" },
49+
];
50+
4351
export const CONTEXT_MANAGER_BACKEND_OPTIONS = Object.entries(
4452
CONTEXT_MANAGER_BACKEND_MAPPINGS,
4553
).map(([value, { label }]) => ({ value, label }));
46-
47-
export const MEMORY_MANAGER_BACKEND_OPTIONS = Object.entries(
48-
MEMORY_MANAGER_BACKEND_MAPPINGS,
49-
).map(([value, { label }]) => ({ value, label }));

console/src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@
18431843
"llmAcquireTimeoutGtPauseJitter": "Slot acquire timeout must be greater than rate limit pause + jitter",
18441844
"contextManagementTitle": "Context Management",
18451845
"memoryManagerBackend": "Memory Manager Backend",
1846-
"memoryManagerBackendTooltip": "Backend for the memory manager. Choose remelight (local files) or adbpg (cloud database).",
1846+
"memoryManagerBackendTooltip": "Backend for the memory manager. Choose remelight (local files), adbpg (cloud database), or none (disable memory).",
18471847
"memoryManagerBackendRestartWarning": "Switching the memory manager backend does not support hot reload. Save and restart QwenPaw for changes to take effect.",
18481848
"maxIters": "Max Iterations",
18491849
"maxItersTooltip": "Maximum number of reasoning-acting iterations for ReAct agent",

console/src/locales/zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@
17011701
"llmAcquireTimeoutGtPauseJitter": "槽位获取超时必须大于限流暂停时长与抖动范围之和",
17021702
"contextManagementTitle": "上下文管理",
17031703
"memoryManagerBackend": "记忆管理后端",
1704-
"memoryManagerBackendTooltip": "记忆管理器的后端类型,可选 remelight(本地文件)adbpg(云端数据库)",
1704+
"memoryManagerBackendTooltip": "记忆管理器的后端类型,可选 remelight(本地文件)adbpg(云端数据库)或 none(关闭记忆",
17051705
"memoryManagerBackendRestartWarning": "切换记忆管理后端不支持热更新,保存后需要重启 QwenPaw 才能生效",
17061706
"maxIters": "最大迭代次数",
17071707
"maxItersTooltip": "ReAct 智能体的最大推理-行动迭代次数",

console/src/pages/Agent/Config/useAgentConfig.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useAgentStore } from "../../../stores/agentStore";
88
import {
99
CONTEXT_MANAGER_BACKEND_MAPPINGS,
1010
MEMORY_MANAGER_BACKEND_MAPPINGS,
11+
MEMORY_MANAGER_BACKEND_OPTIONS,
1112
} from "../../../constants/backendMappings";
1213
import type { ToolExecutionLevel } from "./components/ToolExecutionLevelCard";
1314

@@ -45,7 +46,10 @@ export function useAgentConfig() {
4546
? config.context_manager_backend
4647
: "light";
4748
const memoryBackend =
48-
config.memory_manager_backend in MEMORY_MANAGER_BACKEND_MAPPINGS
49+
config.memory_manager_backend in MEMORY_MANAGER_BACKEND_MAPPINGS ||
50+
MEMORY_MANAGER_BACKEND_OPTIONS.some(
51+
(o) => o.value === config.memory_manager_backend,
52+
)
4953
? config.memory_manager_backend
5054
: "remelight";
5155
form.setFieldsValue({

src/qwenpaw/agents/memory/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
from .adbpg_memory_manager import (
1010
ADBPGMemoryManager,
1111
) # registers "adbpg" backend
12+
from .dummy import (
13+
NoopMemoryManager,
14+
) # registers "none" backend
1215

1316
# Proactive symbols are lazily re-exported via __getattr__ at runtime to
1417
# avoid circular imports (proactive -> react_agent -> agents.memory loop).
@@ -32,6 +35,7 @@
3235
"BaseMemoryManager",
3336
"ReMeLightMemoryManager",
3437
"ADBPGMemoryManager",
38+
"NoopMemoryManager",
3539
# proactive symbols resolved lazily at runtime via __getattr__
3640
"ProactiveConfig",
3741
"ProactiveTask",

src/qwenpaw/agents/memory/dummy.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- coding: utf-8 -*-
2+
"""No-op memory manager – disables all memory functionality."""
3+
from collections.abc import Callable
4+
5+
from agentscope.middleware import MiddlewareBase
6+
from agentscope.tool import ToolChunk
7+
8+
from .base_memory_manager import BaseMemoryManager, memory_registry
9+
10+
11+
@memory_registry.register("none")
12+
class NoopMemoryManager(BaseMemoryManager):
13+
"""A no-op memory manager that disables all memory features.
14+
15+
All tool/prompt/middleware methods return empty results. Use this
16+
backend when you want to run QwenPaw without any memory system.
17+
"""
18+
19+
async def start(self) -> None:
20+
"""No-op: nothing to initialize."""
21+
22+
async def close(self) -> bool:
23+
"""No-op: nothing to release."""
24+
return True
25+
26+
def get_memory_prompt(self) -> str:
27+
"""Return empty prompt – no memory guidance needed."""
28+
return ""
29+
30+
def list_memory_tools(self) -> list[Callable[..., ToolChunk]]:
31+
"""Return empty list – no memory tools exposed."""
32+
return []
33+
34+
def build_middlewares(self) -> list[MiddlewareBase]:
35+
"""Return empty list – no memory middlewares."""
36+
return []
37+
38+
def get_auto_memory_interval(self) -> int:
39+
"""Return 0 – disable auto-memory."""
40+
return 0

0 commit comments

Comments
 (0)