feat: 新增 teams 目录
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
80
teams/multi_agent_plan/group_chat_notes.md
Normal file
80
teams/multi_agent_plan/group_chat_notes.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# Notes: 多智能体群聊系统研究
|
||||
|
||||
## 核心概念
|
||||
|
||||
### 群聊系统 vs 之前的 Supervisor 系统
|
||||
|
||||
| 特性 | Supervisor 系统 | 群聊系统 |
|
||||
|------|----------------|----------|
|
||||
| 流程 | 线性:规划 → 执行 → 汇总 | 多阶段循环 |
|
||||
| Agent 关系 | 层级:Supervisor 管理 Workers | 平等协作 |
|
||||
| 通信方式 | 单向:任务分发 | 多向:互相讨论 |
|
||||
| 决策方式 | Supervisor 决定 | CEO 最终决策 |
|
||||
| 用户参与 | 旁观 | 可插话 |
|
||||
|
||||
### 设计模式
|
||||
|
||||
#### 1. 流水线模式
|
||||
```
|
||||
Stage 1 (Presenter) → Stage 2 (Discusser) → Stage 3 (Summarizer)
|
||||
```
|
||||
|
||||
#### 2. 消息传递
|
||||
- 每个 Stage 维护一个消息队列
|
||||
- Agent 的输出成为下一个 Agent 的输入
|
||||
- 使用 Shared Context 存储共享状态
|
||||
|
||||
#### 3. 智能轮数
|
||||
```python
|
||||
class SmartRoundController:
|
||||
def should_continue(self, stage, round_num, messages):
|
||||
# 使用 LLM 判断是否继续
|
||||
prompt = f"""
|
||||
当前阶段: {stage}
|
||||
当前轮数: {round_num}
|
||||
讨论内容: {messages}
|
||||
|
||||
讨论是否已经充分?是否需要更多轮数?
|
||||
"""
|
||||
return llm.judge(prompt)
|
||||
```
|
||||
|
||||
## 复用现有架构
|
||||
|
||||
### 可复用的组件
|
||||
1. **LLM Factory** - 语言模型
|
||||
2. **Tool Registry** - 工具注册
|
||||
3. **Session Manager** - 会话管理
|
||||
4. **Agent Executor** - Agent 执行逻辑(部分)
|
||||
|
||||
### 需要新增的组件
|
||||
1. **GroupChatManager** - 群聊管理器
|
||||
2. **Participant** - 参与者 Agent
|
||||
3. **Stage Controller** - 阶段控制器
|
||||
4. **SmartRoundController** - 智能轮数控制器
|
||||
|
||||
## 关键数据结构
|
||||
|
||||
### GroupMessage
|
||||
```python
|
||||
class GroupMessage(BaseModel):
|
||||
id: str
|
||||
agent_id: str
|
||||
agent_name: str
|
||||
content: str
|
||||
timestamp: datetime
|
||||
stage: str # presenter/discusser/summarizer
|
||||
round: int
|
||||
replying_to: Optional[str] # 回复的消息 ID
|
||||
```
|
||||
|
||||
### GroupContext
|
||||
```python
|
||||
class GroupContext(BaseModel):
|
||||
topic: str # 讨论主题
|
||||
stage: str # 当前阶段
|
||||
round: int # 当前轮数
|
||||
messages: list[GroupMessage] # 所有消息
|
||||
user_interruptions: list[str] # 用户插话
|
||||
final_decision: Optional[str] # 最终决策
|
||||
```
|
||||
Reference in New Issue
Block a user