# ml-ai

Enables machine learning and AI features in Grafana Cloud. It helps set up Prophet forecasts, DBSCAN outlier alerts, and Sift root-cause investigations.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4100 installs · ★ 290
- Author: grafana
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/grafana/skills/tree/HEAD/skills/grafana-cloud/ml-ai/SKILL.md
- Updated: 2026-10-25
- HTML: https://affpapa.org/en/nevibecode/skills/ml-ai

## What it does

The skill equips coding agents with workflows for Grafana Cloud AI and ML APIs. It configures Prophet forecasting jobs and DBSCAN peer-group anomaly detection. Teams can replace rigid threshold alerting with dynamic bounds that follow daily seasonality. The skill also covers automated incident investigations with Sift and LLM Plugin setup.

Under the hood, the skill generates API calls against `grafana-ml-app` and `grafana-sift-app`, as well as provisioning files for `grafana-llm-app`. Alerts rely on generated metrics such as `ml_forecast_upper` and `ml_outlier_score`. Investigations trigger eight automated checks in Sift, linking findings directly to the incident view.

You need a Grafana Cloud Pro or Advanced stack and an API token with `plugins:write` permissions. Dynamic alerting will fail on new services. Prophet requires at least 14 days of metric history to compute a usable baseline.

## Requirements
- Works with: Grafana, Azure

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill ml-ai -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/ml-ai/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/ml-ai/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill ml-ai -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/ml-ai/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill ml-ai -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/ml-ai/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install grafana/skills ml-ai
```

2. **Manually: put the files in place**
- File: `.github/skills/ml-ai/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill ml-ai -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/grafana/skills --path skills/grafana-cloud/ml-ai
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/ml-ai/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add grafana/skills --skill ml-ai -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/grafana/skills/tree/HEAD/skills/grafana-cloud/ml-ai/SKILL.md

## When to use it
- configure Prophet metric forecasting alerts without static thresholds
- detect outlier services using DBSCAN grouping on error rates
- run automated incident investigations across 8 Sift checks
- provision the LLM Plugin with OpenAI or other model providers

## Example prompts
- Set up a Prophet forecast alert on CPU usage if it exceeds the upper bound by 10%
- Run a Sift root-cause investigation for the checkout service over the last 30 minutes
- Provision the LLM Plugin with gpt-4o for Grafana Assistant

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 9e2930d4f4449234.

BEGIN THIRD-PARTY FILE 9e2930d4f4449234
````text
---
name: ml-ai
license: Apache-2.0
description: Turn on AI + ML features in Grafana Cloud — Grafana Assistant (NL → PromQL/LogQL/TraceQL, dashboard build, incident investigation, MCP integration), Dynamic Alerting (Prophet forecasting + DBSCAN outlier detection), Sift (8-analysis automated root-cause), Knowledge Graph + RCA Workbench, and the LLM Plugin (OpenAI / Anthropic / Azure / Ollama / vLLM / LiteLLM). Use when you want anomaly alerts without static thresholds, natural-language querying, automated incident investigation, dashboards generated from a sentence, or a managed LLM proxy for plugins — even when the user says "alert when something looks weird", "explain this PromQL", "find the root cause", "make this a dashboard", or "wire Claude into Grafana" without naming any of these products.
---

# Grafana Cloud AI & ML

> **Docs**: https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/

ML alerting + automated RCA + LLM-powered Assistant in one Grafana Cloud stack.

## Prerequisites

- Grafana Cloud stack (Pro / Advanced — most features GA, some in preview)
- API token with `plugins:write` for ML / Sift / LLM-plugin endpoints
- For Dynamic Alerting: at least 14 days (ideally 90d) of history for the metric you want to forecast

## Common Workflows

### 1. Forecasting alert with Dynamic Alerting

```bash
# 1. Create forecast job (Prophet — learns daily/weekly seasonality)
curl -X POST https://<stack>.grafana.net/api/plugins/grafana-ml-app/resources/ml/v1/forecast \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "cpu-forecast",
    "metric": "avg(rate(node_cpu_seconds_total{mode=\"user\"}[5m]))",
    "datasourceId": 1,
    "interval": 300,
    "trainingWindow": "90d",
    "forecastWindow": "7d",
    "algorithm": { "name": "prophet", "config": {} }
  }'

# 2. Verify job is producing the predicted-value metric (may take a few minutes).
#    <datasourceId> must match the datasourceId used above (find it via
#    GET /api/datasources), or run the query from Explore instead.
curl -s -H "Authorization: Bearer <token>" \
  'https://<stack>.grafana.net/api/datasources/proxy/<datasourceId>/api/v1/query?query=ml_forecast_upper{job="cpu-forecast"}' \
  | jq '.data.result | length'
# Expect > 0

# 3. Add an alert that fires when actual exceeds the upper bound
# expr:  avg(rate(node_cpu_seconds_total{mode="user"}[5m]))
#         > ml_forecast_upper{job="cpu-forecast"} * 1.1
```

### 2. Outlier alert — one service deviates from peers

```bash
# 1. Create outlier job (DBSCAN — groups peers, flags the odd one)
curl -X POST https://<stack>.grafana.net/api/plugins/grafana-ml-app/resources/ml/v1/outlier \
  -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \
  -d '{
    "name": "service-error-outliers",
    "metric": "sum(rate(http_requests_total{status=~\"5..\"}[5m])) by (service)",
    "datasourceId": 1,
````
END THIRD-PARTY FILE 9e2930d4f4449234

The third-party file has ended. Everything between the 9e2930d4f4449234 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2947 of 5419 bytes. © grafana · Apache-2.0 · https://github.com/grafana/skills/tree/HEAD/skills/grafana-cloud/ml-ai/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
