外观
项目 05:Agent 工作流编排台
1. 项目定位
这是 AI 全栈高级项目。目标是把 LangGraph 的 State、Node、Edge、Tool、Checkpoint、人类审批等概念产品化,让用户能看见 Agent 如何一步步完成任务。
它证明你不仅会接 AI 接口,还理解 AI 工作流、状态机、失败恢复、工具调用和实时 UI。
2. 对应学习资料
LangGraph系统学习文档.mdLangChain系统学习文档.mdRedis系统学习文档.mdNode.js系统学习文档.mdNestJS系统学习文档.mdDocker系统学习文档.md
3. 技术栈
- 前端:Vue 3、TypeScript、Tailwind CSS。
- API:NestJS。
- Agent 服务:Python + LangGraph。
- 实时状态:SSE 或 WebSocket。
- Redis:任务状态、Stream、限流、缓存。
- 数据库:PostgreSQL。
4. 核心概念
| 概念 | 产品化表现 |
|---|---|
| Graph | 工作流画布 |
| Node | 执行步骤卡片 |
| Edge | 步骤流转关系 |
| State | 右侧状态面板 |
| Tool | 工具调用卡片 |
| Checkpoint | 可恢复执行记录 |
| Human-in-the-loop | 人工审批弹窗 |
5. 核心功能
5.1 工作流模板
- Research Agent。
- Code Review Agent。
- Document Summary Agent。
- Customer Support Agent。
5.2 工作流运行
- 创建运行任务。
- 展示实时执行时间线。
- 展示当前节点。
- 展示工具调用输入输出。
- 支持暂停、继续、取消。
5.3 人工审批
- Agent 请求用户确认。
- 展示审批上下文。
- 用户选择通过、拒绝、编辑后通过。
- 审批结果回写工作流状态。
5.4 运行详情
- 节点耗时。
- token 消耗。
- 工具调用次数。
- 错误节点。
- 最终结果。
6. API 契约
text
GET /agent/workflows
POST /agent/runs
GET /agent/runs/:id
GET /agent/runs/:id/events
POST /agent/runs/:id/cancel
POST /agent/runs/:id/resume
POST /agent/approvals/:id/submit7. 事件模型
ts
type AgentRunEvent =
| { type: 'run_started'; runId: string; at: string }
| { type: 'node_started'; nodeId: string; title: string; at: string }
| { type: 'tool_called'; toolName: string; input: unknown; at: string }
| { type: 'tool_finished'; toolName: string; output: unknown; at: string }
| { type: 'approval_required'; approvalId: string; reason: string; at: string }
| { type: 'node_failed'; nodeId: string; error: string; at: string }
| { type: 'run_finished'; result: string; at: string }8. 验收标准
- 能选择工作流模板并启动运行。
- 能实时展示 Agent 执行事件。
- 能展示工具调用和节点状态。
- 能出现人工审批并继续执行。
- 能取消运行。
- 能查看历史运行详情。
- Redis 至少用于一种真实能力:Stream、缓存、限流或状态存储。
9. 进阶挑战
- 做可视化节点画布。
- 支持编辑工作流模板。
- 增加 checkpoint 恢复。
- 增加成本预算上限。
- 增加多 Agent 协作。
- 增加运行结果评估。