# [[GCX]]
![[GCX.svg]]
**GCX** (lowercase `gcx`) is the **Grafana Cloud CLI** — a single command-line tool for managing [[Grafana]] and [[Grafana Cloud]] resources, designed from the ground up for **agentic** usage inside AI-assisted coding environments like [[Claude Code]], [[Cursor]], and [[GitHub Copilot]]. It was announced on **21 April 2026** at **[[GrafanaCON]] 2026** in Barcelona, alongside AI Observability in Grafana Cloud, expanded [[Grafana Assistant]] capabilities, and `o11y-bench`. It is the evolution of `grafanactl`, and it is currently in **public preview**.
## Why it's important
Grafana's framing is that modern dev workflows have an **"AI blind spot"** / **"context vacuum"**: agents write code in the editor, but have no line of sight into what's happening in production. GCX closes that gap by giving your coding agent a structured, machine-friendly way to talk to your entire Grafana Cloud stack — dashboards, alerts, logs, metrics, traces, SLOs, synthetics, k6, OnCall, Incidents — *and* to invoke the [[Grafana Assistant]] without ever leaving the editor. The agent can query live telemetry, correlate alerts with recent repo changes, propose fixes, and ship them — closing the loop between **code → production → code**. This is Grafana's bet on what "observability as a development signal" looks like once the agent becomes the primary interface.
## Links
- **Announcement (press release)**: [Grafana Labs Targets the "AI Blind Spot" with New Observability Tools Announced at GrafanaCON 2026](https://www.morningstar.com/news/business-wire/20260421657088/grafana-labs-targets-the-ai-blind-spot-with-new-observability-tools-announced-at-grafanacon-2026)
- **Analyst write-up**: [SiliconANGLE — Grafana is trying to close the AI observability gap before enterprise agents reign supreme](https://siliconangle.com/2026/04/21/grafana-trying-close-ai-observability-gap-enterprise-agents-reign-supreme/)
- **Conference context**: [GrafanaCON 2026 agenda](https://grafana.com/blog/grafanacon-2026-agenda/) · [GrafanaCON event page](https://grafana.com/events/grafanacon/)
- **GitHub repo**: [grafana/gcx](https://github.com/grafana/gcx) (Apache-2.0, Go)
- **Official docs**: [gcx CLI | Grafana documentation](https://grafana.com/docs/grafana/latest/as-code/observability-as-code/grafana-cli/gcx/) · [Introduction to the Grafana CLI](https://grafana.com/docs/grafana/latest/as-code/observability-as-code/grafana-cli/)
- **Deep-dive docs in repo**: [Configuration](https://github.com/grafana/gcx/blob/main/docs/configuration.md) · [Dashboards as Code guide](https://github.com/grafana/gcx/blob/main/docs/guides/dashboards-as-code.md) · [Claude Code plugin README](https://github.com/grafana/gcx/blob/main/claude-plugin/README.md)
- **Related video**: [Agentic AI for Observability: Grafana Assistant & Investigations](https://www.youtube.com/watch?v=mYgexXCMXeg) (Assistant + Investigations demo — the intelligence layer GCX exposes)
## Features / what you can do with it
- **Agent-native interface** — JSON/YAML output, structured errors, predictable exit codes, non-interactive by default. Agent mode is auto-detected for [[Claude Code]], Copilot, and Cursor.
- **Bundled [[Claude Code]] plugin** — ships with ~18 skills (e.g. `explore-datasources`) that give your agent deep Grafana knowledge out of the box.
- **Grafana Assistant integration** — your agent can delegate to the Assistant for automated root-cause analysis, investigation summaries, and remediation suggestions.
- **Live production queries from the terminal** — PromQL against Mimir/Prometheus, LogQL against Loki, plus Tempo (traces) and Pyroscope (profiles).
- **Unified resource management** — get / push / pull / edit / delete / validate dashboards, folders, alert rules, and more, with a single CLI.
- **Observability-as-code workflow** — scaffold projects with the `grafana-foundation-sdk`, import existing dashboards as Go builder code, run a live-reload dev server, and lint with built-in or custom Rego rules.
- **GitOps round-trip** — pull resources to files, commit, push back; idempotent, with dependency-aware ordering (folders before dashboards).
- **CI/CD friendly** — `--dry-run`, `--on-error abort|fail|ignore`, machine-readable output — drop straight into GitHub Actions.
- **Multi-environment contexts** — named contexts for dev/staging/prod, plus env-var auth (`GRAFANA_SERVER`, `GRAFANA_TOKEN`, `GRAFANA_CLOUD_TOKEN`) for pipelines and agents.
- **Raw API passthrough** — `gcx api …` for anything not yet wrapped by a dedicated command.
- **Auth** — service account tokens, Cloud Access Policy tokens, and an experimental browser-based OAuth login (`gcx auth login`).
Requirement: **Grafana 12 or later**.
## Which Grafana products work with it
GCX reaches across most of the Grafana Cloud surface area. From the repo's product table:
| Product | Command | What you get |
| --- | --- | --- |
| [[Grafana]] core (dashboards, folders, datasources, alert rules) | `gcx resources`, `gcx alert` | Full CRUD, pull/push, dashboards-as-code |
| [[Grafana Alerting]] | `gcx alert` | `rules list`, `groups list` |
| [[SLOs\|Grafana SLO]] | `gcx slo` | `definitions list`, `reports list` |
| [[Synthetic Monitoring]] | `gcx synth` | `checks list`, `probes list` |
| [[Grafana OnCall\|OnCall]] | `gcx oncall` | `schedules list`, `integrations list` |
| [[k6\|Grafana Cloud k6]] | `gcx k6` | `load-tests list`, `runs list` |
| [[Fleet Management]] | `gcx fleet` | `pipelines list`, `collectors list` |
| [[IRM\|IRM Incidents]] | `gcx incidents` | `list`, `create -f incident.yaml` |
| Knowledge Graph | `gcx kg` | `status`, `search`, `entities show` |
| [[Adaptive Telemetry]] (metrics + logs) | `gcx adaptive` | `metrics recommendations show`, `logs patterns show` |
| Mimir / Prometheus | `gcx metrics` | PromQL queries, labels, metadata |
| [[Loki]] | `gcx logs` | LogQL queries, labels, series |
| [[Tempo]] | traces datasource | Query traces |
| [[Pyroscope]] | profiles datasource | Query profiles |
## What [[Grafana Assistant]] has to do with it
This is the core of GCX's story: **the [[Grafana Assistant]] is the intelligence, GCX is the interface.** The Assistant already does the hard observability reasoning — investigations, root-cause analysis, remediation suggestions, drafting alert rules — inside Grafana Cloud, built on top of your existing dashboards, alerts, and datasources. What GCX adds is a way for your **coding agent** to *call* the Assistant from wherever it lives (Claude Code, Cursor, Copilot, a CI job), so that the Assistant's conclusions show up in your editor instead of in a browser tab.
The canonical agentic workflow Grafana describes:
1. An alert fires (e.g. P95 latency on checkout crosses SLO).
2. Your coding agent calls the Grafana Assistant **through gcx**. The Assistant investigates and traces it to, say, a missing index causing full table scans.
3. The agent drafts the migration and adds the index.
4. It prevents recurrence — instruments with OpenTelemetry spans, adds a Synthetic Monitoring check, creates an alert rule on query duration.
5. It opens a PR, tests pass, the alert resolves.
All of it without the developer leaving the editor. That's the loop GCX is built to close.
## See also
- [[Grafana Assistant]]
- [[Grafana Cloud]]
- [[GrafanaCON]]
- [[Claude Code]]
- [[Observability as code]]
%%
# Exc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