Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/10-agentscope-compat-single-agent/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PlanNoteBook / SubTask / TruncatedFormatterBase / Knowledge / HttpStatefulClient
- Memory: `dare_framework/memory/in_memory_stm.py`
- Knowledge: `dare_framework/knowledge/kernel.py`
- Plan: `dare_framework/plan_v2/types.py`, `dare_framework/plan_v2/tools.py`
- Compression: `dare_framework/compression/core.py`
- Compression: `dare_framework/compression/moving_compression.py`
- MCP: `dare_framework/mcp/client.py`, `dare_framework/mcp/transports/http.py`

## 4. 能力差异矩阵(详细版)
Expand All @@ -60,7 +60,7 @@ PlanNoteBook / SubTask / TruncatedFormatterBase / Knowledge / HttpStatefulClient
| 循环结构 | `_reasoning() → _acting() → repeat` | `assemble() → generate() → tool calls → repeat` | 等价 |
| 最大迭代 | `max_iterations=20` | `max_tool_rounds=10` | 等价(值不同) |
| 并行 tool 执行 | `parallel_tool_calls=True` → `asyncio.gather` | 仅串行 | **Gap-R1** |
| 自动内存压缩 | `_compress_memory_if_needed()` 每轮触发 | 无自动压缩 | **Gap-R5** |
| 自动内存压缩 | `_compress_memory_if_needed()` 每轮触发 | 仅有 moving compression,未接入 ReAct 自动触发 | **Gap-R5** |
| 超时 fallback | 超 max_iterations 做 summarization | 返回"未收敛"文本 | Gap-R2 |
| Plan 注入 | `plan_to_hint()` 生成 `<system-hint>` | `critical_block` 注入 | 接近等价 |
| Hook 粒度 | pre/post_reasoning, pre/post_acting | session/milestone/plan/tool 级 | Gap-R4 |
Expand Down Expand Up @@ -162,8 +162,8 @@ PlanNoteBook / SubTask / TruncatedFormatterBase / Knowledge / HttpStatefulClient
| 维度 | AgentScope | DARE | 差距 |
|------|-----------|------|------|
| 截断单位 | Token 数 | 消息条数 | **Gap-F2** |
| Tool pair 安全 | 成对删除 | 无保护 | **Gap-F1** |
| 自动触发 | 每次 `_reasoning()` 前 | 手动调用 | **Gap-F4** |
| Tool pair 安全 | 成对删除 | framework 无 formatter 级保护,由 Example 兼容层补齐 | **Gap-F1** |
| 自动触发 | 每次 `_reasoning()` 前 | moving compression 需显式接线,无 formatter 自动触发 | **Gap-F4** |
| Provider 格式化 | OpenAI/Anthropic/Gemini/... formatter 子类 | 无 | Gap-F3 |
| 标签感知 | 跳过 important 消息 | 无标签概念 | 依赖 Gap-M1 |

Expand Down Expand Up @@ -218,7 +218,7 @@ PlanNoteBook / SubTask / TruncatedFormatterBase / Knowledge / HttpStatefulClient
### P1(高优先)
- **Gap-M1**: Message 无 tag/mark
- **Gap-Mem1/2/5**: InMemorySTM 无 mark/summary/tool-pair-safe compress
- **Gap-F1/F4**: compress_context 无 tool pair 安全/无自动触发
- **Gap-F1/F4**: framework 仅提供 moving compression;无 formatter 级 tool pair 安全/无自动触发
- **Gap-R5**: ReactAgent 无自动内存压缩
- **Gap-LM4**: Usage 不规范化 reasoning_tokens
- **Gap-S1/S2**: 无 StateModule/ISessionStore
Expand Down
2 changes: 1 addition & 1 deletion examples/10-agentscope-compat-single-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| 6 | `ChatModelBase` | `CompatFormattedModelAdapter` | E0/E2 | **Gap-LM1(P0)**(thinking), Gap-LM2(stream) |
| 7 | `PlanNoteBook` | `CompatPlanNotebook` + 6 tools | E1 | Gap-P1(status), Gap-P5(序列化) |
| 8 | `SubTask` | `CompatSubTask` | E1 | 合并于 Gap-P1 |
| 9 | `TruncatedFormatterBase` | `CompatTruncatedFormatter` | E1 | **Gap-F1**(tool pair safe), Gap-F2(token) |
| 9 | `TruncatedFormatterBase` | `CompatTruncatedFormatter` | E1 | **Gap-F1**(example 层补齐 tool pair safe), Gap-F2(token) |
| 10 | `Knowledge` | `create_knowledge(rawdata)` | E0 | Gap-K1(embedding adapter) |
| 11 | `HttpStatefulClient` | `HttpStatefulClientShim` | E1 | Gap-H3(缓存) |
| 12 | `Session` | `JsonSessionBridge` | E2 | **Gap-S1**(StateModule), **Gap-S2**(ISessionStore) |
Expand Down
9 changes: 5 additions & 4 deletions examples/10-agentscope-compat-single-agent/compat_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def to_framework_message(self) -> Message:
# ===========================================================================
# Capability 9: TruncatedFormatterBase — 截断格式化器
# AgentScope: token 级截断 + tool pair 安全 + provider-specific 格式化
# DARE: compress_context() 按消息条数截断,无 tool pair 安全 [Gap-F1]
# DARE: 仅提供 moving compression;formatter 级 tool pair 安全需 Example 补齐 [Gap-F1]
# ===========================================================================


Expand Down Expand Up @@ -290,9 +290,10 @@ def _drop_with_tool_pair(
) -> int:
"""删除消息时保护 tool call/result 配对完整性。

这是 Gap-F1 的 Example 层补齐:框架的 compress_context() 不具备此能力。
当框架补齐 Gap-F1 (compress_context(tool_pair_safe=True)) 后,
此方法应迁移到框架层。
这是 Gap-F1 的 Example 层补齐:当前框架只有 moving compression,
并没有 formatter 级 tool pair 安全截断入口。
如果后续框架在公开 formatter/compression API 中补齐这层能力,
此方法再考虑下沉到框架层。
"""
removed_count = 0
removed_tool_ids: set[str] = set()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_base_agent_transport_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,14 @@ async def test_transport_loop_flag_is_task_local_for_concurrent_execute_calls()

polled_task = asyncio.create_task(
agent._execute_polled_message(
"loop-task",
Message(role="user", text="loop-task"),
channel=channel,
envelope_id="req_1",
)
)
await agent.loop_execution_started.wait()

await agent.execute("direct-task", transport=channel)
await agent.execute(Message(role="user", text="direct-task"), transport=channel)
agent.allow_loop_execution_finish.set()
await polled_task

Expand Down
251 changes: 0 additions & 251 deletions tests/unit/test_context_compression.py

This file was deleted.

Loading
Loading