jamarius-fortson/AI-DevOps-Orchestrator
GitHub: jamarius-fortson/AI-DevOps-Orchestrator
一个基于多 AI 代理的事件驱动 DevOps 自动化编排引擎,解决手动运维与告警疲劳问题。
Stars: 0 | Forks: 0
# AI-DevOps-Orchestrator 🚀
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://fastapi.tiangolo.com/)
## 概述
AI-DevOps-Orchestrator 是一个自主式 DevOps 编排引擎,用于将软件交付事件通过一组专业 AI 代理进行路由。它能够加速 PR 审查、CI 故障诊断、事件响应、基础设施成本管理和安全态势监控。
本仓库包含一个生产就绪的 FastAPI Webhook 服务、一个 LangGraph 工作流、CrewAI 代理定义、部署脚手架以及用于 GitHub、AWS、PagerDuty 和文档的集成工具。
## 为什么这很重要
- 减少手动 DevOps 工作和告警疲劳
- 自动化 PR 审查、CI 诊断和事件分诊
- 提供一个用于事件驱动工作流的统一 Webhook 入口点
- 支持对每个决策进行安全、可审计的日志记录
- 支持使用 SQLite 回退的快速本地开发
## 关键能力
- 基于代码分析的 GitHub PR 审查自动化
- CI 流水线故障诊断与修复建议
- AWS 基础设施成本与利用率洞察
- PagerDuty 事件确认与升级工具
- 合并后文档与 README 更新
- 定时安全态势审计与策略检查
## 快速开始
### 先决条件
- Python 3.10 或更高版本
- 具有仓库权限的 GitHub 个人访问令牌
- OpenAI API 密钥
- Anthropic API 密钥
- 可选:AWS 凭证、PagerDuty API 密钥、Slack Webhook URL
### 安装
```
git clone https://github.com/daniellopez882/AI-DevOps-Orchestrator.git
cd AI-DevOps-Orchestrator
python -m venv venv
# macOS / Linux
source venv/bin/activate
# Windows PowerShell
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
```
### 配置
```
copy .env.example .env
```
编辑 `.env` 并设置所需的值:
- `OPENAI_API_KEY`
- `ANTHROPIC_API_KEY`
- `GITHUB_TOKEN`(执行 GitHub PR 操作必需)
- `DATABASE_URL`(可选;如果未设置将使用本地 SQLite 回退)
### 本地运行
```
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
访问 API 文档:
`http://localhost:8000/docs`
## 测试 Webhook 事件
```
curl -X POST http://localhost:8000/webhook \
-H "Content-Type: application/json" \
-d '{
"trigger_type": "pr_opened",
"repo": "your-org/your-repo",
"branch": "main",
"payload": {"pr_number": 42}
}'
```
## 项目结构
```
AI-DevOps-Orchestrator/
├── main.py # FastAPI webhook API entrypoint
├── agent_graph.py # LangGraph workflow and state machine
├── crew_agents.py # CrewAI agent and tool setup
├── tools.py # GitHub, AWS, PagerDuty, and security tools
├── tasks.py # Agent task definitions and expected outputs
├── devops_agent_prompts.py # Prompt engineering and operational guardrails
├── llm_config.py # OpenAI and Anthropic model configuration
├── database.py # Audit logging and database initialization
├── .env.example # Environment template
├── docker-compose.yml # Container orchestration scaffold
├── requirements.txt # Python dependency manifest
└── README.md # Project documentation
```
## 架构
```
graph TD
A[Webhook Event] --> B[FastAPI API]
B --> C[LangGraph Orchestrator]
C --> D[CodeReviewAgent]
C --> E[CIMonitorAgent]
C --> F[InfraOptimizerAgent]
C --> G[IncidentResponder]
C --> H[DocumentationAgent]
C --> I[SecurityAuditAgent]
```
## 支持的触发器
| 触发器 | 代理 | 优先级 |
|---|---|---|
| `pr_opened` | CodeReviewAgent | P3 |
| `ci_failed` | CIMonitorAgent | P2 |
| `scheduled_infra` | InfraOptimizerAgent | P4 |
| `pagerduty` | IncidentResponder | P1 |
| `pr_merged` | DocumentationAgent | P3 |
| `scheduled_security` | SecurityAuditAgent | P4 |
## 部署
### Docker
```
docker-compose up -d
```
### 环境变量
| 变量 | 描述 | 是否必需 |
|---|---|---|
| `OPENAI_API_KEY` | OpenAI API 密钥 | ✅ |
| `ANTHROPIC_API_KEY` | Anthropic API 密钥 | ✅ |
| `GITHUB_TOKEN` | GitHub API 令牌 | ✅ |
| `AWS_ACCESS_KEY_ID` | AWS 访问密钥 | ❌ |
| `AWS_SECRET_ACCESS_KEY` | AWS 密钥 | ❌ |
| `AWS_DEFAULT_REGION` | AWS 区域 | ❌ |
| `PAGERDUTY_API_KEY` | PagerDuty API 密钥 | ❌ |
| `SLACK_WEBHOOK_URL` | Slack 通知 | ❌ |
| `DATABASE_URL` | 数据库连接字符串 | ❌ |
## 说明
- 使用 `.env` 存储密钥,切勿提交凭据。
- 本地开发支持通过 `devops_os.db` 使用 SQLite 回退。
- 本项目设计用于通过更多代理和集成进行快速扩展。
## 贡献
1. 叉取仓库
2. 创建新功能分支
3. 提交更改
4. 发起 Pull Request
## 许可证
本项目根据 MIT 许可证授权。详见 [LICENSE](LICENSE)。
标签:AI DevOps, AI 代理, AV绕过, AWS 集成, CI/CD 自动化, CrewAI, DevOps 工具链, DNS解析, FastAPI, GitHub 集成, LangGraph, PagerDuty 集成, PR 自动化, Python, SEO 关键词, SQLite 快速开发, Webhook 服务, 事件驱动架构, 云成本优化, 代码审查, 基础设施成本管理, 安全态势监控, 审计日志, 开源项目, 故障诊断, 无后门, 智能编排, 自动化运维, 请求拦截, 逆向工具