Self-healing Kubernetes with AI agents.
OpsGentic turns an alert into a reviewed GitOps pull request β automated Root Cause Analysis, Validation, and Remediation, with a human in the loop.
π Website & Documentation Β· Quickstart Β· Architecture Β· GitHub
Alert fires β agents find the root cause β propose a minimal manifest fix β open a PR on your GitOps repo β you approve β ArgoCD/Flux applies it.
No kubectl, no manual patching.
OpsGentic is an open-source AIOps / agentic SRE platform for Kubernetes incident response
and auto-remediation. A multi-agent LangGraph
pipeline performs automated root cause analysis on Prometheus/Alertmanager alerts (or a chat
message), then remediates through GitOps β every change is a reviewable pull request opened on
your ArgoCD/Flux repo, never a live kubectl mutation. Think of it as an AI SRE agent that
turns alerts into self-healing infrastructure, with a human in the loop.
thread_id to poll; a worker drives the run.config/pipeline.yaml; reshape the workflow by editing YAML, not Python.Prometheus/Alertmanager βalertββΆ OpsGentic API βenqueueββΆ Worker
β RCA β Validation β [approve] β Action
ArgoCD/Flux ββsyncβ merge ββ Pull Request ββββββββββββββββ
POST /chat) is enqueued; the API returns 202 { thread_id }.Deep dive: docs/ARCHITECTURE.md.
The agent graph is declarative. Nodes, routing, and per-agent tool wiring live in
config/pipeline.yaml, not in Python. Clone the repo, edit that file,
and restart β the graph is rebuilt from the blueprint on startup.
# config/pipeline.yaml (agents section abbreviated)
entrypoint: rca
interrupt_before:
- action # human-in-the-loop gate before opening a PR
nodes:
- id: rca
step: rca
agents: [context, rca]
- id: resolve_target
step: resolve_target
agents: [resolver]
- id: validation
step: validation
agents: [validation]
- id: action
step: action
agents: [remediation]
edges:
- from: rca
to: resolve_target
- from: resolve_target
to: validation
- from: validation
route: after_validation # named router -> conditional edge
branches:
action: action
rca: rca
escalate: END
- from: action
to: END
agents:
context:
tools: [kubernetes, prometheus]
remediation:
tools: [kubernetes, github, prometheus]
# rca / resolver / validation reason without MCP tools -> tools: []
nodes, rewrite edges, or change an
agentβs tools in YAML. step binds a node to a built-in implementation; route binds a
conditional edge to a named router; END is the graph terminal.src/opsgentic/pipeline/registry.py (STEP_REGISTRY),
or a new router in ROUTER_REGISTRY, then reference it by name from the YAML. That is the only
Python you write to extend the graph.step / route, a dangling edge target, or a node whose
agent has no agents: entry fails fast with a clear PipelineSpecError.Inspect and validate the blueprint from the CLI:
opsgentic pipeline show # print the active topology
opsgentic pipeline validate # validate config/pipeline.yaml (exit 1 on error)
opsgentic pipeline validate my.yaml # validate a specific file
Example β add a notify node after action:
src/opsgentic/pipeline/registry.py:
def notify_node(state: MachineState) -> dict:
... # your logic; returns partial state
STEP_REGISTRY = {..., "notify": notify_node}
config/pipeline.yaml:
```yaml
nodes:
opsgentic pipeline validate, then restart. opsgentic pipeline show reflects the new graph.Agent behavior (prompts) is tuned separately in the editable agent-skill library β see USAGE.md β Editing agent skills.
One-command demo β provisions the cluster (or a local k3d/minikube/kind), ArgoCD, Prometheus, the demo apps, and opsgentic; forks the demo repo for you and only asks for a GitHub PAT:
./hack/demo-up.sh # idempotent; ./hack/demo-down.sh to tear it down
Local dev β no cluster, just the graph:
python -m venv .venv && . .venv/bin/activate
pip install -e .
cp .env.example .env # set LLM_BASE_URL / LLM_API_KEY (empty = canned fallback)
# try the full graph locally (synchronous, no cluster needed)
opsgentic --file examples/grafana_alert.json --source grafana --approve
Full walkthrough β one-command demo, local dev, and the manual end-to-end Kubernetes path
(GitHub auth, ArgoCD, Alertmanager webhook, bootstrap.sh): QUICKSTART.md.
| Doc | Whatβs inside |
|---|---|
| Website | Project homepage & docs hub |
| QUICKSTART.md | Install & run β dev + Kubernetes, GitHub auth, ArgoCD, Alertmanager webhook, troubleshooting |
| docs/USAGE.md | HTTP API, triggers, full configuration reference, editing agent skills, deploy |
| docs/ARCHITECTURE.md | Agents, async queue/worker, graph flow, remediation & convergence, multi-repo resolution |
config/pipeline.yamlWhat is OpsGentic? An open-source AI agent for Kubernetes incident response. It reads Prometheus/Alertmanager alerts, runs automated root cause analysis with a multi-agent LangGraph pipeline, and opens a GitOps pull request with a minimal manifest fix β self-healing Kubernetes with a human in the loop.
How does OpsGentic remediate incidents without kubectl?
It never mutates the cluster directly. All cluster and repo reads go through read-only MCP servers,
and every change is written as a pull request on your GitOps repo, which ArgoCD or Flux applies
after merge.
Which LLMs does it support? Any OpenAI-compatible endpoint β a self-hosted vLLM server, OpenAI, or other compatible APIs β configured via environment variables.
Does it work with ArgoCD and Flux? Yes. OpsGentic is GitOps-native and multi-repo: it discovers the owning repository from your ArgoCD/Flux Applications and supports GitHub, GitLab, and Gitea.
How do I try it quickly?
Run ./hack/demo-up.sh for a one-command demo (cluster + ArgoCD + Prometheus + demo apps), or use
the local-dev path with no cluster. See the Quickstart.
Issues and PRs are welcome. Licensed under GPLv3. Website & docs: https://lehuannhatrang.github.io/opsgentic/
Keywords: Kubernetes Β· Kubernetes incident response Β· SRE Β· DevOps Β· AIOps Β· AI SRE agent Β· AI agent Β· agentic AI Β· multi-agent Β· LLM Β· vLLM Β· LangGraph Β· MCP Β· Model Context Protocol Β· auto-remediation Β· self-healing Kubernetes Β· self-healing infrastructure Β· root cause analysis Β· RCA Β· GitOps Β· ArgoCD Β· Flux Β· Prometheus Β· Alertmanager Β· alert remediation Β· incident response automation Β· pull request automation