Files
X-Agents/plan/task_plan.md
2026-03-11 16:26:22 +08:00

3.2 KiB

Task Plan: 智能体系统设计与实现

Goal

设计和实现一个支持单智能体独立工作 + 多智能体协作的混合型智能体系统,具备长短时记忆、多种技能调用能力。

Phases

  • Phase 1: 数据库设计与迁移
  • Phase 2: 后端 Agent Engine 核心实现
  • Phase 3: 记忆系统实现
  • Phase 4: 技能路由与执行器实现
  • Phase 5: 多智能体 Supervisor 实现
  • Phase 6: API 接口对接
  • Phase 7: 前端页面集成
  • Phase 8: 测试与优化

Key Questions

  1. 如何设计长短时记忆的存储和检索?
  2. 如何实现灵活的技能路由?
  3. 如何支持多智能体协作?

Decisions Made

  • 单智能体工作流: 用户输入 → 智能体思考 → 调用技能 → 返回结果
  • 多智能体模式: Supervisor 主智能体调度子智能体
  • 记忆分层: Working → Session → Persistent 三层结构
  • 技能全支持: 内置 + 自定义代码 + MCP + API

Errors Encountered

  • (无)

Status

Currently in Phase 8 - 测试与优化

完成项

  • Phase 1: 数据库设计与迁移

    • 扩展 Agent 模型 (增加角色描述、模型配置、协作模式)
    • 新增 AgentSkill, AgentKnowledgeBase, AgentMemory, AgentTeam, AgentTask 模型
    • 扩展 AgentRepository 添加新方法
    • 创建 SQL 迁移脚本 (server/migrations/agent_system.sql)
  • Phase 2: 后端 Agent Engine 核心实现

    • AgentCore 单智能体核心类
    • Supervisor 多智能体调度器
    • LLM 适配器 (OpenAI/Anthropic)
    • FastAPI 服务入口 (app/main.py)
    • requirements.txt
  • Phase 3: 记忆系统实现

    • Working Memory (内存)
    • Session Memory (Redis/内存模拟)
    • Persistent Memory (向量库/内存模拟)
    • MemoryManager 统一接口
  • Phase 4: 技能路由与执行器

    • SkillRouter 技能路由器
    • SkillExecutor 技能执行器
  • Phase 5: Go API 对接

    • AgentService (调用 Python)
    • AgentHandler (HTTP 接口)
    • MemoryService (记忆服务)
    • MemoryHandler (记忆接口)
    • 路由注册 (/api/agent/chat, /api/agent/team/chat, /api/agent/:id/memories)
  • Phase 7: 前端页面集成

    • agentApi.ts API 服务
    • Agents.vue 添加聊天按钮和弹窗

技术决策

  • 通信协议: HTTP REST (暂定)
  • 后续可根据需要改造为 gRPC

完成项

  • Phase 1: 数据库设计与迁移

    • 扩展 Agent 模型 (增加角色描述、模型配置、协作模式)
    • 新增 AgentSkill, AgentKnowledgeBase, AgentMemory, AgentTeam, AgentTask 模型
    • 扩展 AgentRepository 添加新方法
    • 创建 SQL 迁移脚本 (server/migrations/agent_system.sql)
  • Phase 2: 后端 Agent Engine 核心实现

    • AgentCore 单智能体核心类
    • Supervisor 多智能体调度器
    • LLM 适配器 (OpenAI/Anthropic)
    • FastAPI 服务入口 (app/main.py)
    • requirements.txt
  • Phase 3: 记忆系统实现

    • Working Memory (内存)
    • Session Memory (Redis/内存模拟)
    • Persistent Memory (向量库/内存模拟)
    • MemoryManager 统一接口
  • Phase 4: 技能路由与执行器

    • SkillRouter 技能路由器
    • SkillExecutor 技能执行器
  • Phase 5: Go API 对接

    • AgentService (调用 Python)
    • AgentHandler (HTTP 接口)
    • 路由注册 (/api/agent/chat, /api/agent/team/chat)