AI-driven operations assistant system
Project description
OpsPilot
AI 驱动的运维辅助系统。接收告警 → LLM 分析 → 自动/审批处置,形成闭环。
快速开始
# 安装
git clone <repo-url> && cd opspilot
uv sync
最小配置(config.yaml):
providers:
mimo:
model: "mimo-v2.5-pro"
api_keys:
- "${MIMO_KEY}"
base_url: "https://token-plan-cn.xiaomimimo.com/v1"
actions:
tools:
builtins: {}
projects:
- name: my-project
ingestion:
webhook:
enabled: true
secret: "${WEBHOOK_SECRET}"
运行时以 OpsPilot 为入口(程序化 API,不读文件、不开端口):
import asyncio
from core.app import OpsPilot
async def main():
async with OpsPilot(open("config.yaml").read()) as op:
result = await op.ingest([event]) # 推入告警
await op.approve(session_id, "ok") # 审批
asyncio.run(main())
宿主负责读取配置文件与挂载 HTTP 服务(见 REST API)。
架构
告警源 (Prometheus / Grafana / 自定义)
│
▼
┌─────────┐
│ 接入层 │ Webhook 接收 / Pull 拉取 / 格式归一化
└────┬────┘
│ AlertEvent
▼
┌─────────┐
│ 调度层 │ 去重 / 优先级队列 / Worker 池
└────┬────┘
│
▼
┌─────────┐
│ 决策层 │ Agent 循环: 上下文组装 → LLM 分析 → 工具调用 → 安全检查 → 审批
└────┬────┘
│ await 审批决策(approve/reject)
▼
┌─────────┐
│ 处置层 │ K8s / Shell / 通知 / 数据库 (@tool) + MCP 扩展
└────┬────┘
│
▼
┌─────────┐
│ 存储层 │ 告警记录 / 分析过程 / 工具调用 / 审批记录
└─────────┘
技术栈
| 组件 | 选型 | 说明 |
|---|---|---|
| 语言 | Python 3.14 | |
| 包管理 | uv | uv init / uv add / uv run |
| Web 框架 | FastAPI | 异步支持,自动 OpenAPI 文档 |
| Agent 引擎 | 手写 async 循环 | 上下文压缩 + 非阻塞审批 + 持久化(无 LangGraph 依赖) |
| LLM 抽象 | LangChain | 多模型支持 + @tool 工具定义 |
| CLI | Typer + Rich | 运维友好的表格输出 |
| 数据库 | SQLite + SQLAlchemy | 零依赖,单文件部署 |
| 调度 | APScheduler | Pull 模式定时拉取 |
| MCP | langchain-mcp-adapters | 用户自定义工具扩展 |
文档
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
opspilot_assistant-0.1.0.tar.gz
(83.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opspilot_assistant-0.1.0.tar.gz.
File metadata
- Download URL: opspilot_assistant-0.1.0.tar.gz
- Upload date:
- Size: 83.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeaea8c96c70b437d027fc233f993d8b8c28cd48b61250a566b6b767adcb7636
|
|
| MD5 |
5cdce3d27465481eecad4b88d3b51117
|
|
| BLAKE2b-256 |
2b00300d20613070b8121039744d0ac180696d26e8d297bd5ce440ca862dbd0f
|
File details
Details for the file opspilot_assistant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: opspilot_assistant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 111.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a58f79c9f5c9a78de89f6c6763f7d87db1b4be3063de32a3bf04c0e77f5e65
|
|
| MD5 |
d43566e1ac6a9516690aece40794846e
|
|
| BLAKE2b-256 |
8d46f5f8e5170048e9763cb62f98715956cc5d983e187d49f6833224e8fb96b8
|