# devopsAgent **Repository Path**: dawn_start/devops-agent ## Basic Information - **Project Name**: devopsAgent - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-08 - **Last Updated**: 2026-06-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Agent Harness - DevOps 业务闭环系统 基于 Python + LangGraph 构建的生产级 Agent Harness,实现完整的 DevOps 业务闭环。 ## 架构概览 ``` ┌─────────────────────────────────────────────────────────┐ │ Agent Harness │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ 编排循环 │ │ 工具系统 │ │ 记忆系统 │ │ 护栏系统 │ │ │ │(LangGraph│ │(Tool Reg)│ │(Memory) │ │(Guardrail│ │ │ │StateGraph│ │ │ │ │ │ │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ 状态管理 │ │ 错误处理 │ │ 验证反馈 │ │ 子Agent │ │ │ │(Checkpoint│ │(Error Hdl│ │(Verify) │ │(SubAgent)│ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ └─────────────────────────────────────────────────────────┘ │ ┌─────────────────────────────────────────────────────────┐ │ DevOps 业务闭环工作流 │ │ │ │ 需求分析 ──→ 代码生成 ──→ 代码测试 ──→ 部署上线 │ │ ↑ │ │ │ │ 运行监控 ──→ 反馈优化 ←──────┘ │ │ └──────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────┘ ``` ## 业务闭环流程 1. **需求分析 Agent** - 解析用户需求,生成技术规格 2. **代码生成 Agent** - 根据规格生成代码 3. **代码测试 Agent** - 运行测试,验证代码质量 4. **部署上线 Agent** - 自动化部署到目标环境 5. **运行监控 Agent** - 监控运行状态,收集指标 6. **反馈优化 Agent** - 分析监控数据,生成优化建议,触发新一轮闭环 ## 快速开始 ```bash # 安装依赖 pip install langgraph langchain-core langchain-openai pydantic # 配置环境变量 export OPENAI_API_KEY="your-api-key" export OPENAI_BASE_URL="https://api.openai.com/v1" # 可选 # 运行示例 python main.py ``` ## 项目结构 ``` devops_agent_harness/ ├── __init__.py ├── main.py # 入口文件 & 示例 ├── core/ │ ├── __init__.py │ ├── state.py # 全局状态定义 (TypedDict) │ ├── harness.py # Agent Harness 基类 │ ├── orchestrator.py # LangGraph 编排器 │ ├── error_handler.py # 四层错误处理 │ └── checkpoint.py # 检查点管理 ├── agents/ │ ├── __init__.py │ ├── requirement_agent.py # 需求分析 Agent │ ├── coding_agent.py # 代码生成 Agent │ ├── testing_agent.py # 代码测试 Agent │ ├── deploy_agent.py # 部署上线 Agent │ ├── monitor_agent.py # 运行监控 Agent │ └── feedback_agent.py # 反馈优化 Agent ├── tools/ │ ├── __init__.py │ ├── tool_registry.py # 工具注册中心 │ ├── code_tools.py # 代码操作工具 │ ├── test_tools.py # 测试工具 │ ├── deploy_tools.py # 部署工具 │ └── monitor_tools.py # 监控工具 ├── memory/ │ ├── __init__.py │ ├── short_term.py # 短期记忆 (会话级) │ └── long_term.py # 长期记忆 (持久化) ├── guardrails/ │ ├── __init__.py │ └── guardrails.py # 三层护栏 └── utils/ ├── __init__.py └── logger.py # 日志工具 ```