🚀 端到端研发自动化系统

基于 OpenClaw + Claude Code 的全流程自动化研发平台 | 系统架构设计报告

生成时间:2026-03-15 | 版本:v1.0.0

系统概述

本系统是一个革命性的全流程自动化研发平台,整合了 OpenClawClaude Code 两大 AI 编程助手,实现从需求分析到自动部署的完整研发流程自动化。系统采用多角色 AI Agents 协同工作模式, 支持人机协同,大幅提升软件研发效率和质量。

10
核心处理阶段
6
专业 AI Agents
21
系统组件
16
数据库实体

核心特性

📋 全流程自动化

覆盖需求→设计→开发→测试→部署全生命周期,无缝衔接各研发环节

🤖 多 Agent 协同

产品、架构、后端、前端、测试、运维六大专业 Agent 分工协作

👥 人机协同

关键节点支持人工审核与干预,实时进度跟踪与状态可视化

⚡ 智能图表生成

自动生成系统架构图、数据库 ER 图、时序图等多种技术图表

研发流程

从需求输入到自动部署的完整研发流程

1 需求分析
2 PRD 设计
3 架构设计
4 API 设计
5 图表生成
6 后端开发
7 前端开发
8 测试生成
9 CI/CD
10 自动部署

系统架构图

展示系统整体架构,包含表现层、网关层、应用层、服务层和数据层五个层次

graph TB subgraph 表现层_Presentation[表现层 Presentation] user[用户 User] web_ui[Web UI
React + TS] cli[CLI Tool] end subgraph 网关层_Gateway[网关层 Gateway] api_gw[API Gateway
Nginx + Auth] end subgraph 应用层_Application[应用层 Application] orchestrator[Agent Orchestrator
智能体协调器] product_agent[Product Agent
产品 Agent] architect_agent[Architect Agent
架构 Agent] backend_agent[Backend Agent
后端 Agent] frontend_agent[Frontend Agent
前端 Agent] test_agent[Test Agent
测试 Agent] devops_agent[DevOps Agent
运维 Agent] end subgraph 服务层_Services[服务层 Services] openclaw[OpenClaw Engine] claude_code[Claude Code Engine] diagram_svc[Diagram Service
图表服务] code_gen[Code Generator
代码生成] ci_cd[CI/CD Pipeline
Jenkins] k8s[Kubernetes
KubeSphere] end subgraph 数据层_Data[数据层 Data] postgres[(PostgreSQL
主数据库)] redis[(Redis
缓存)] minio[(MinIO
文件存储)] es[(Elasticsearch
日志检索)] end user -->|HTTPS| web_ui user -->|CLI| cli web_ui -->|REST/WebSocket| api_gw cli -->|REST| api_gw api_gw -->|gRPC| orchestrator orchestrator -->|Task| product_agent orchestrator -->|Task| architect_agent orchestrator -->|Task| backend_agent orchestrator -->|Task| frontend_agent orchestrator -->|Task| test_agent orchestrator -->|Task| devops_agent product_agent -->|API| openclaw product_agent -->|API| claude_code architect_agent -->|API| openclaw architect_agent -->|API| claude_code backend_agent -->|API| openclaw backend_agent -->|API| claude_code frontend_agent -->|API| openclaw frontend_agent -->|API| claude_code test_agent -->|API| openclaw test_agent -->|API| claude_code devops_agent -->|API| ci_cd ci_cd -->|kubectl| k8s orchestrator -->|Generate| diagram_svc orchestrator -->|Generate| code_gen product_agent -->|SQL| postgres architect_agent -->|SQL| postgres backend_agent -->|SQL| postgres test_agent -->|SQL| postgres orchestrator -->|Cache| redis backend_agent -->|S3| minio ci_cd -->|S3| minio k8s -->|Logs| es style user fill:#fff3e0,stroke:#f57c00,stroke-width:2px style web_ui fill:#e1f5fe,stroke:#0288d1,stroke-width:2px style cli fill:#e1f5fe,stroke:#0288d1,stroke-width:2px style api_gw fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style orchestrator fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style product_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style architect_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style backend_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style frontend_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style test_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style devops_agent fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style openclaw fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style claude_code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style diagram_svc fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style code_gen fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style ci_cd fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style k8s fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style postgres fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style redis fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style minio fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style es fill:#e8f5e9,stroke:#388e3c,stroke-width:2px

架构说明

表现层 (Presentation)

  • Web UI: React + TypeScript 构建的现代化界面
  • CLI Tool: 命令行工具,支持脚本化操作
  • 用户交互: HTTPS 加密通信

网关层 (Gateway)

  • API Gateway: Nginx 反向代理 + 认证授权
  • 负载均衡: 请求分发到多个服务实例
  • 限流熔断: 保护后端服务

应用层 (Application)

  • Orchestrator: 智能体协调器,负责任务分解和调度
  • 6 大 Agent: 各司其职的专业 AI 助手
  • 人机协同: 支持人工审核节点

服务层 (Services)

  • OpenClaw: 自主 AI 虚拟助理,执行复杂任务
  • Claude Code: AI 编程助手,代码理解和生成
  • CI/CD: Jenkins 流水线自动化

数据层 (Data)

  • PostgreSQL: 主数据库,存储结构化数据
  • Redis: 分布式缓存,加速访问
  • MinIO: 对象存储,存放文件和图表
  • Elasticsearch: 日志检索和分析
sequenceDiagram title 需求到部署完整数据流 participant user as 用户 participant product as Product Agent participant architect as Architect Agent participant backend as Backend Agent participant frontend as Frontend Agent participant test as Test Agent participant devops as DevOps Agent participant k8s as K8s Cluster user->>product: 输入需求描述 product->>product: 需求分析 product-->>user: PRD 文档 + 用户故事 product->>architect: 传递 PRD architect->>architect: 架构设计 architect-->>user: 技术方案 + 架构图 architect->>backend: 传递架构设计 architect->>frontend: 传递架构设计 backend->>backend: 后端代码生成 backend-->>user: API 代码 + 数据库脚本 frontend->>frontend: 前端代码生成 frontend-->>user: UI 组件 + 样式 backend->>test: 传递代码 frontend->>test: 传递代码 test->>test: 测试用例生成 test->>test: 执行测试 test-->>user: 测试报告 + 覆盖率 test->>devops: 测试通过 devops->>devops: CI/CD配置 devops->>k8s: 部署应用 k8s-->>user: 运行中的应用
graph TB subgraph CI_CD[CI/CD Pipeline] jenkins[Jenkins Master] agent1[Jenkins Agent 1] agent2[Jenkins Agent 2] docker_reg[Docker Registry] end subgraph K8S_Cluster[Kubernetes Cluster] subgraph NS_App[Application Namespace] deploy[Deployment
3 replicas] svc[Service
ClusterIP] ingress[Ingress
Nginx] cm[ConfigMap] secret[Secret] end subgraph NS_DB[Database Namespace] pg_stateful[PostgreSQL
StatefulSet] pg_svc[PostgreSQL Service] end subgraph NS_Cache[Cache Namespace] redis_stateful[Redis Cluster
3 nodes] redis_svc[Redis Service] end end jenkins -->|Build| agent1 jenkins -->|Build| agent2 agent1 -->|Push| docker_reg agent2 -->|Push| docker_reg jenkins -->|Deploy| k8s k8s -->|Pull Image| docker_reg ingress -->|Route| svc svc -->|Balance| deploy deploy -->|Connect| pg_svc deploy -->|Connect| redis_svc

数据库 ER 图

系统核心数据库实体关系图,包含 16 个主要实体和它们之间的关系

erDiagram USERS { UUID id PK VARCHAR(50) username VARCHAR(100) email VARCHAR(255) password_hash UUID role_id FK TIMESTAMPTZ created_at } ROLES { UUID id PK VARCHAR(50) name JSONB permissions } PROJECTS { UUID id PK VARCHAR(200) name UUID owner_id FK VARCHAR(20) status INTEGER progress TIMESTAMPTZ created_at } REQUIREMENTS { UUID id PK UUID project_id FK VARCHAR(500) title VARCHAR(20) priority VARCHAR(20) status } PRD_DOCUMENTS { UUID id PK UUID project_id FK VARCHAR(20) version JSONB content VARCHAR(20) status } ARCHITECTURE_DESIGNS { UUID id PK UUID project_id FK JSONB tech_stack JSONB components } API_SPECIFICATIONS { UUID id PK UUID project_id FK JSONB openapi_spec } CODE_REPOSITORIES { UUID id PK UUID project_id FK TEXT remote_url VARCHAR(100) branch } TEST_PLANS { UUID id PK UUID project_id FK VARCHAR(50) test_type VARCHAR(20) status } TEST_CASES { UUID id PK UUID plan_id FK VARCHAR(500) title JSONB steps TEXT expected_result } DEPLOYMENT_CONFIGS { UUID id PK UUID project_id FK VARCHAR(50) environment VARCHAR(50) platform JSONB k8s_manifests } DEPLOYMENT_HISTORY { UUID id PK UUID config_id FK VARCHAR(50) version VARCHAR(20) status TIMESTAMPTZ completed_at } TASKS { UUID id PK UUID project_id FK UUID assigned_agent FK VARCHAR(50) type VARCHAR(20) status INTEGER progress } AGENTS { UUID id PK VARCHAR(100) name VARCHAR(50) type VARCHAR(50) model_provider BOOLEAN is_active } DIAGRAMS { UUID id PK UUID project_id FK VARCHAR(50) type TEXT diagram_code VARCHAR(20) format } MODEL_CALLS { UUID id PK UUID model_id FK UUID task_id FK INTEGER input_tokens INTEGER output_tokens DECIMAL total_cost } USERS ||--o{ ROLES : has_role USERS ||--o{ PROJECTS : owns PROJECTS ||--o{ REQUIREMENTS : contains PROJECTS ||--o{ PRD_DOCUMENTS : generates PROJECTS ||--o{ ARCHITECTURE_DESIGNS : produces PROJECTS ||--o{ API_SPECIFICATIONS : defines PROJECTS ||--o{ CODE_REPOSITORIES : links PROJECTS ||--o{ TEST_PLANS : requires PROJECTS ||--o{ DEPLOYMENT_CONFIGS : deploys PROJECTS ||--o{ TASKS : executes PROJECTS ||--o{ DIAGRAMS : creates TEST_PLANS ||--o{ TEST_CASES : includes DEPLOYMENT_CONFIGS ||--o{ DEPLOYMENT_HISTORY : records AGENTS ||--o{ TASKS : executes TASKS ||--o{ MODEL_CALLS : invokes AGENTS ||--o{ MODEL_CALLS : uses

核心实体说明

实体名称 说明 关键字段 关系
users 系统用户表,存储用户基本信息和权限 id, username, email, role_id N:1 → roles, 1:N → projects
projects 项目核心表,所有研发活动的中心 id, name, owner_id, status, progress 1:N → 所有业务表
requirements 需求表,存储原始需求和用户故事 id, project_id, title, priority N:1 → projects
prd_documents PRD 文档表,存储产品需求文档 id, project_id, version, content N:1 → projects
architecture_designs 架构设计表,存储技术方案 id, project_id, tech_stack, components N:1 → projects
tasks 任务表,追踪所有 AI 任务的执行 id, project_id, assigned_agent, status N:1 → projects, agents
agents Agent 配置表,定义各 AI 助手 id, name, type, model_provider 1:N → tasks
model_calls 模型调用审计表,追踪 AI 使用成本 id, model_id, task_id, tokens, cost N:1 → tasks, agents

AI Agents 介绍

六大专业 AI Agent,覆盖软件研发全流程

📊 Product Agent (产品 Agent)

职责: 需求分析与 PRD 生成

模型: Claude-3.5-Sonnet

能力:

  • 需求分析和功能提取
  • 用户故事生成
  • PRD 文档编写
  • 验收标准定义
输出:PRD 文档、用户故事

🏗️ Architect Agent (架构 Agent)

职责: 系统架构设计与技术选型

模型: Claude-3.5-Sonnet

能力:

  • 系统架构设计
  • 技术栈选型
  • 数据库设计
  • API 规范设计
  • 图表自动生成
输出:架构图、技术方案

⚙️ Backend Agent (后端 Agent)

职责: 后端代码生成与 API 实现

引擎: OpenClaw + Claude Code

能力:

  • RESTful API 开发
  • 数据库建模
  • 业务逻辑实现
  • 认证授权
  • 单元测试编写
输出:API 代码、数据库脚本

🎨 Frontend Agent (前端 Agent)

职责: 前端界面开发与交互实现

引擎: OpenClaw + Claude Code

能力:

  • React/Vue组件开发
  • 状态管理
  • 响应式设计
  • 无障碍访问
  • UI 测试编写
输出:UI 组件、样式文件

🧪 Test Agent (测试 Agent)

职责: 测试用例生成与自动化测试

模型: Claude-3.5-Sonnet

能力:

  • 测试计划制定
  • 单元测试生成
  • 集成测试生成
  • E2E 测试生成
  • 测试执行与报告
输出:测试用例、测试报告

🚀 DevOps Agent (运维 Agent)

职责: CI/CD 配置与自动部署

模型: Claude-3.5-Sonnet

能力:

  • Jenkins 流水线配置
  • Docker 容器化
  • K8s 部署编排
  • 监控日志设置
  • 安全加固
输出:部署配置、K8s 清单

技术栈

后端技术

核心框架

  • Python 3.12+ - 主要编程语言
  • FastAPI - 高性能 Web 框架
  • SQLAlchemy 2.0 - ORM 框架
  • Pydantic - 数据验证

数据存储

  • PostgreSQL 15 - 主数据库
  • Redis 7 - 分布式缓存
  • MinIO - 对象存储
  • Elasticsearch 8 - 日志检索

前端技术

框架与库

  • React 18 - UI 框架
  • TypeScript 5 - 类型安全
  • Ant Design - UI 组件库
  • Zustand - 状态管理

构建工具

  • Vite - 构建工具
  • Mermaid.js - 图表渲染
  • TailwindCSS - CSS 框架

AI 引擎

OpenClaw

  • 自主 AI 虚拟助理
  • 文件操作自动化
  • 浏览器自动化
  • 多 IM 平台交互
  • 本地持久化记忆

Claude Code

  • AI 编程助手
  • 代码理解与分析
  • 多文件编辑
  • Git 集成
  • 命令执行

基础设施

容器化

  • Docker - 容器运行时
  • Docker Compose - 本地编排
  • Kubernetes - 容器编排
  • KubeSphere - K8s 管理平台

CI/CD

  • Jenkins - CI/CD 服务器
  • GitLab CI - 替代方案
  • ArgoCD - GitOps 部署
  • Helm - K8s 包管理

核心 API 接口

RESTful API 设计规范 (基础路径:/api/v1)

方法 路径 描述 请求体 响应
POST /projects 创建新项目 {name, description} Project
GET /projects/{id} 获取项目详情 - Project
POST /projects/{id}/analyze 启动需求分析 {raw_input} Task[]
POST /projects/{id}/generate 启动代码生成 {options} GenerationResult
GET /projects/{id}/status 获取项目状态 - ProjectStatus
POST /diagrams/generate 生成图表 {type, spec} DiagramResult
GET /diagrams/{id} 获取图表 - Diagram
WS /ws/projects/{id} WebSocket 实时推送 - Stream
POST /deployments 创建部署任务 {config_id} Deployment

快速部署指南

环境要求

硬件要求

  • CPU: 8 核+ (推荐 16 核)
  • 内存:16GB+ (推荐 32GB)
  • 磁盘:100GB+ SSD
  • 网络:千兆以太网

软件要求

  • Ubuntu 22.04 LTS / macOS 13+
  • Docker 24.0+
  • Docker Compose 2.20+
  • kubectl 1.28+ (可选)

安装步骤

# 1. 克隆项目
git clone <repository-url>
cd end_to_end_research_system

# 2. 安装 Python 依赖
pip install -r requirements.txt

# 3. 安装 Node.js 依赖
npm install

# 4. 配置环境变量
cp .env.example .env
# 编辑.env 文件,填入 API 密钥等配置

# 5. 启动 Docker 服务
docker-compose up -d

# 6. 初始化数据库
python src/database/init_db.py

# 7. 启动应用
python src/main.py

# 8. 访问系统
# Web UI: http://localhost:3000
# API: http://localhost:8000/api/v1
# API Docs: http://localhost:8000/docs

Docker Compose 配置

version: '3.8'

services:
  api:
    build: ./src
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=postgresql://user:pass@postgres:5432/e2e_research
      - REDIS_URL=redis://redis:6379
    depends_on:
      - postgres
      - redis

  web:
    build: ./web
    ports:
      - "3000:3000"

  postgres:
    image: postgres:15
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=e2e_research
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data

  minio:
    image: minio/minio
    command: server /data --console-address ":9001"
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - minio_data:/data

volumes:
  postgres_data:
  redis_data:
  minio_data: