Files
knowledge-base/2 - Projects/Smart Support/Phase 2 - 多 Agent + 安全.md
2026-04-06 16:23:54 +02:00

75 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
created: 2026-03-29
updated: 2026-04-06
type: project
status: COMPLETED (2026-03-30)
parent: "[[Smart Support]]"
phase: 2
timeline: 第 3-4 周
tags:
- phase-2
- multi-agent
- agent-orchestration
- intent-routing
- webhook
- escalation
- interrupt
- ttl-timeout
- industry-template
- security
---
# Phase 2多 Agent + 安全
> Status: COMPLETED (2026-03-30)
## 目标
让 Supervisor 具备真正的多 Agent 路由能力,能根据用户意图选择正确的 Agent。同时完善安全机制中断超时处理、Webhook 升级通知。
## 阶段产出
- Intent 分类器LLM 结构化输出,支持单意图/多意图/模糊检测
- Discount Agentapply_discountwrite + interrupt+ generate_couponread
- 中断管理器30 分钟 TTL 自动过期register/check/resolve/cleanup
- Webhook 升级HTTP POST + 指数退避重试(最多 3 次)
- 增强 Supervisor 路由:动态 Agent 描述、多意图提示注入
- 垂直行业模板电商、SaaS、金融科技
- 模板加载load_template() / list_templates()
## 新增文件
| 文件 | 用途 |
|------|------|
| `app/intent.py` | 意图分类模型 + LLM 分类器 |
| `app/agents/discount.py` | 折扣 Agent 工具 |
| `app/interrupt_manager.py` | 中断 TTL 管理 |
| `app/escalation.py` | Webhook 升级 + 重试 |
| `templates/e-commerce.yaml` | 电商模板 |
| `templates/saas.yaml` | SaaS 模板 |
| `templates/fintech.yaml` | 金融科技模板 |
## 测试覆盖
- 总测试153Phase 1: 87 + Phase 2: 66
- 覆盖率90.18%
- 新模块覆盖intent 100%, discount 96%, interrupt_manager 100%, escalation 100%
## 与计划的偏差
- 多意图处理用 Supervisor 提示注入而非自定义预路由节点(更简单)
- Webhook 升级已接入 app.state 但未连接到具体 Agent 工具(模块就绪,集成推迟)
- `escalate_to_human` 工具未创建(升级模块可独立触发)
## 技术债务
- SaaS/Fintech 模板工具名称无实现(配置蓝图)
- 中断清理未定时调度
- main.py 覆盖率 44%(需真实 DB
## Related
- [[Smart Support/Phase 1 - 核心框架]]
- [[Smart Support/Phase 3 - OpenAPI 自动发现]]
- [[Smart Support]]