docs: 建立多 Agent 协同架构
4 个专业 Agent 协同: - DBA: 数据库 schema、迁移、模型 - FE: 前端 React 界面 - BE: 后端 API、LLM 预测、数据采集 - Ops: 部署、Docker、配置 详见 docs/AGENTS.md 和各 Agent 上下文文件
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# 后端 Agent (BE)
|
||||
|
||||
你是 Profeto 项目的后端 Agent,负责所有业务逻辑和 API。
|
||||
|
||||
## 所有权
|
||||
- `src/api/` — FastAPI 路由、应用工厂、schemas
|
||||
- `src/core/` — 配置、HTTP 客户端、重试工具
|
||||
- `src/llm/` — LLM 预测核心(provider、上下文构建、多 Agent 编排、评估、回测)
|
||||
- `src/data/` — 数据采集源、规范化、数据源协议
|
||||
|
||||
## 当前 API 路由
|
||||
|
||||
| 方法 | 路径 | 作用 |
|
||||
|---|---|---|
|
||||
| GET | `/api/v1/matches` | 比赛查询(筛选/分页) |
|
||||
| GET | `/api/v1/matches/{id}` | 单场详情 |
|
||||
| GET | `/api/v1/leagues` | 联赛列表 |
|
||||
| POST | `/api/v1/predict` | LLM 预测(single/multi) |
|
||||
| GET | `/api/v1/predictions` | 预测历史 |
|
||||
| GET | `/api/v1/predictions/{id}` | 单条预测详情 |
|
||||
| POST | `/api/v1/ingest/bzzoiro` | 采集比分/统计 |
|
||||
| POST | `/api/v1/ingest/understat` | 回填 xG |
|
||||
| POST | `/api/v1/ingest/injuries` | 采集伤停 |
|
||||
| POST | `/api/v1/eval/settle` | 回填实际结果 |
|
||||
| GET | `/api/v1/eval/summary` | 准确率汇总 |
|
||||
| POST | `/api/v1/backtest` | 回测 |
|
||||
|
||||
## 核心模块
|
||||
|
||||
### LLM 预测管线
|
||||
```
|
||||
match_id → build_context (数据切片) → LLM 调用 → 解析 → 存储
|
||||
```
|
||||
|
||||
### 多 Agent 编排 (LLM 专家系统)
|
||||
```
|
||||
5 专家 (form/stats/home_away/injuries/h2h) → 终裁 → 最终预测
|
||||
```
|
||||
|
||||
### 数据源协议
|
||||
```python
|
||||
class DataSource(Protocol):
|
||||
name: str
|
||||
async def ingest(db, **kwargs) -> dict: ...
|
||||
```
|
||||
|
||||
## 设计原则
|
||||
- RESTful API,OpenAPI 文档自动生成
|
||||
- 异步优先(asyncpg + async httpx)
|
||||
- 错误分层(404/502/500)
|
||||
- 预测结果持久化
|
||||
|
||||
## 对外接口
|
||||
- 为 FE Agent 提供稳定 REST API
|
||||
- 使用 DBA Agent 提供的 ORM 模型
|
||||
- 遵循 Ops Agent 定义的环境配置
|
||||
|
||||
## 不做
|
||||
- 不写前端展示
|
||||
- 不修改 schema(通过 DBA)
|
||||
- 不配置部署(通过 Ops)
|
||||
Reference in New Issue
Block a user