Skip to main content

Grafana Assistant CLI

[!NOTE] This package is currently in public preview. APIs and features may change without notice.

CLI for interacting with Grafana Assistant via the A2A (Agent-to-Agent) API.

Interactive chat session with Grafana Assistant CLI

Installation

uvx / pip (Recommended)

Run directly without installing:

uvx grafana-assistant

Or install globally:

pip install grafana-assistant

Homebrew (macOS / Linux)

brew install grafana/grafana/grafana-assistant

Or, if you prefer to tap first:

brew tap grafana/grafana
brew install grafana-assistant

Manual download

Download the latest pre-built binary for your platform from the latest release page, extract it, and add the grafana-assistant binary to a directory in your PATH.

On Windows, download the .zip archive instead and add grafana-assistant.exe to your PATH.

Quick Start

# Add your Grafana instance
grafana-assistant config set-instance mystack \
  --url https://mystack.grafana.net

# Set it as the default
grafana-assistant config use-instance mystack

# Authenticate via browser
grafana-assistant auth

# Start interactive chat
grafana-assistant chat

The auth command opens your browser for a one-time login. After that, the CLI manages short-lived tokens that auto-refresh — no service account needed.

[!IMPORTANT] The Assistant CLI User role is required to obtain access tokens via grafana-assistant auth. This role is automatically granted to users with the Editor role or above. For custom roles, the grafana-assistant-app.tokens:access permission must be included.

Configuration is stored in ~/.config/grafana-assistant/config.yaml by default, or ./grafana-assistant.yaml for project-specific configs. Session state (last context ID for --continue) is stored in ~/.config/grafana-assistant/state.yaml.

For detailed setup instructions, see docs/SETUP.md. For the full config file reference, see docs/CONFIGURATION.md.

Usage

For detailed usage guides, see Setup & Auth, Chat & Prompt, and Tunnel.

Interactive Chat (Recommended)

Start a full-screen interactive chat session with real-time streaming responses and conversation continuation.

# Start interactive chat
grafana-assistant chat

# With a specific agent
grafana-assistant chat --agent investigation_agent

# Resume a previous conversation by context ID
grafana-assistant chat --context "previous-context-id"

# Continue the last chat session
grafana-assistant chat --continue

# Using a specific instance
grafana-assistant chat --instance prod

Commands:

  • /clear or /new - Start a new conversation
  • /exit, /quit, or /q - Exit
  • /help - Show help

Keyboard Shortcuts:

  • Enter - Send message
  • Ctrl+C - Cancel current request or exit
  • Ctrl+D - Exit

Single-Shot Prompt (for Scripting)

Send a single message and receive the response. Useful for automation and scripting.

# Send a single prompt
grafana-assistant prompt "Analyze my dashboard"

# Using a specific instance from config
grafana-assistant prompt "Analyze my dashboard" --instance prod

# Using explicit URL and token
grafana-assistant prompt "Analyze my dashboard" \
  --url https://your-stack.grafana.net \
  --token $GRAFANA_SA_TOKEN

# Set a custom timeout (default: 300 seconds)
grafana-assistant prompt "Query error rates from Prometheus" --timeout 600

# Continue a conversation with context ID
grafana-assistant prompt "Now show me the last 24 hours" --context "previous-context-id"

# Continue the most recent chat/prompt session
grafana-assistant prompt "Now show me the last 24 hours" --continue

# Output as JSON (for scripting)
grafana-assistant prompt "Analyze my dashboard" --json

# Generate an AGENTS.md file for the current directory
grafana-assistant agents-md

CLI Reference

Chat Command (Interactive)

Option Description Default
--url, -u Grafana instance URL -
--instance, -i Instance name from config -
--context, -c Context ID for conversation continuation -
--continue Continue the previous chat session false
--timeout Timeout in seconds per request 300

Prompt Command (Non-Interactive)

Option Description Default
--url, -u Grafana instance URL -
--instance, -i Instance name from config -
--wait, -w Wait for completion true
--timeout Timeout in seconds 300
--context, -c Context ID for conversation threading auto-generated
--continue Continue the previous chat session false
--json Output as JSON false

Auth Command

Command Description
auth Authenticate via browser
auth --instance <name> Authenticate a specific instance

Agent MD Command

Generate an AGENTS.md file with practical guidance for using grafana-assistant in a project. When run interactively it reads configured instances and lets you choose which ones to include with their real URLs pre-filled.

# Generate AGENTS.md in the current directory (interactive)
grafana-assistant agents-md

# Generate into a specific directory and overwrite existing files
grafana-assistant agents-md ~/projects/my-app --force

# Skip interactive prompts (CI / scripting)
grafana-assistant agents-md --non-interactive
Option Description Default
--output, -o Output filename to create in target directory AGENTS.md
--force, -f Overwrite output file if it already exists false
--dry-run Print generated content to stdout instead of writing a file false
--non-interactive Skip interactive prompts (use generic placeholders) false

Config Commands

Command Description
config set-instance <name> Add or update an instance
config use-instance <name> Set the current instance
config list List all configured instances
config current Show the current instance
config delete-instance <name> Remove an instance
config add-project <name> <path> Add a project directory
config list-projects List all configured projects
config remove-project <name> Remove a project

Tunnel Command

Run a tunnel that allows Grafana Assistant to execute tools on your machine.

# Authenticate (includes tunnel access)
grafana-assistant auth

# Add a project for the assistant to access
grafana-assistant config add-project my-app ~/projects/my-app

# Start tunnel with filesystem access (default)
grafana-assistant tunnel connect

# Start tunnel with terminal access (use with caution)
grafana-assistant tunnel connect --terminal

The auth command includes the tunnel:connect scope, so no separate tunnel auth step is needed.

The tunnel provides:

  • Filesystem tool: Read-only access to local files with project-based configuration
    • Configure named projects (e.g., my-app → ~/projects/my-app)
    • Access files with project-relative paths (e.g., src/main.go)
    • Search code with grep and find_path actions
    • Add/remove projects dynamically mid-session
  • Terminal tool: Execute shell commands (with configurable allow/deny lists)

For security, the tunnel:

  • Blocks access to sensitive files (.ssh, .env, private keys, etc.) by default
  • Blocks dangerous commands (rm -rf /, mkfs, fork bombs, etc.) by default
  • Runs commands with a minimal environment (only PATH, HOME, USER, etc.)
  • Requires explicit project configuration before accessing codebases

See docs/TUNNEL.md for the full tunnel usage guide and docs/CONFIGURATION.md for tunnel configuration options.

Environment Variables

Variable Description
GRAFANA_URL Grafana instance URL
GRAFANA_ASSISTANT_CONFIG Override config file path

JSON Output

When using --json with the prompt command, the output format is:

Prompt Response

{
  "taskId": "a2a-task-123",
  "contextId": "uuid-for-threading",
  "status": "completed",
  "response": "The agent's response text..."
}

Possible status values: completed, failed, timeout, canceled, unknown

Tool Approval Flow

When the Grafana Assistant needs to execute certain tools that require user confirmation (such as running queries or modifying resources), the CLI will prompt you for approval.

How It Works

  1. During a chat session, when a tool requires approval, you'll see a prompt:
Approve execute_query - Execute a database query? [y]/[n]
  1. Press y or Y to approve and allow the tool to execute
  2. Press n, N, or Esc to deny and skip the tool execution

Approval Keys

Key Action
y or Y Approve the tool execution
n or N Deny the tool execution
Esc Deny the tool execution

When you deny a tool, the assistant will be informed and will continue the conversation without executing that tool.

A2A Protocol

This CLI uses the A2A (Agent-to-Agent) Protocol v0.3.0 for communication:

  • Streaming: Real-time SSE streaming of agent responses
  • Context threading: Continue conversations with context IDs
  • Standard protocol: JSON-RPC 2.0 over HTTP with SSE

For more details, see the A2A Protocol Specification.

Prerequisites

  1. A Grafana instance with the Assistant plugin enabled
  2. A Grafana user account for browser-based authentication

Contributing

See CONTRIBUTING.md for development setup, testing, and snapshot test instructions.

License

This software is licensed under the Grafana Enterprise Plugin License Agreement.

Metadata

Release files for grafana-assistant 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for grafana-assistant 0.0.24
File
grafana_assistant-0.0.24-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
grafana_assistant-0.0.24-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
grafana_assistant-0.0.24-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
grafana_assistant-0.0.24-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
grafana_assistant-0.0.24-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
grafana_assistant-0.0.24-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
grafana_assistant-0.0.24-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
grafana_assistant-0.0.24-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 149.6 MB

Release files / grafana_assistant-0.0.24-py3-none-win_arm64.whl

Download URL grafana_assistant-0.0.24-py3-none-win_arm64.whl
Size 18.0 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
c232edfe23646212747937336a5aec827333bb1f3b83e3d92f0c7a6ac72f4619
BLAKE2b-256 checksum
How to use checksums
92e2a37eb2d65302825566455109b21043d066027c8180a4e79fbf2250f5c662
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-win_amd64.whl

Download URL grafana_assistant-0.0.24-py3-none-win_amd64.whl
Size 19.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ec7c0d822b9c1bb38d9861efdff469b3ae92f0884e8284d9f7bafee6352725e2
BLAKE2b-256 checksum
How to use checksums
ac709d7379eee48d20db3b4869515ebfcb2f532bc0fd6a32de50b10c424d5257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-musllinux_1_2_x86_64.whl

Download URL grafana_assistant-0.0.24-py3-none-musllinux_1_2_x86_64.whl
Size 19.3 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
bac1c5741f2710cac6eda75bfc99859ae8257c7ab08f01aa28832587228f28b5
BLAKE2b-256 checksum
How to use checksums
0401a6ecc1ab5f101c61e84abdda79eef1e677465c8d7518f1a7eec70baa21aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-musllinux_1_2_aarch64.whl

Download URL grafana_assistant-0.0.24-py3-none-musllinux_1_2_aarch64.whl
Size 18.1 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
bd033f84738bbada2ba9beb96918559869617168153a99d0e50863288310c0a5
BLAKE2b-256 checksum
How to use checksums
310d9a678f722e0e5308e98b351fb442f7b1ea688d2552b43b0449a0f87cb879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-manylinux_2_17_x86_64.whl

Download URL grafana_assistant-0.0.24-py3-none-manylinux_2_17_x86_64.whl
Size 19.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
97f2d4afb234773a5c5c741f1eec0efe930cbdbd4bce22a14b6b7ae24ad6f5cc
BLAKE2b-256 checksum
How to use checksums
7f094de468adb1e109480c95a42ebfc9af93e3cec5de83d8e5c2b455ede362ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-manylinux_2_17_aarch64.whl

Download URL grafana_assistant-0.0.24-py3-none-manylinux_2_17_aarch64.whl
Size 18.1 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
346b1c81effb7f8af5481e8fe75713621ba5d3de9f4d829c9b31d35682a91c87
BLAKE2b-256 checksum
How to use checksums
77cdff6f558e6efa997faaf0e4828752ba37839b903be323d856263be56b5271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-macosx_11_0_arm64.whl

Download URL grafana_assistant-0.0.24-py3-none-macosx_11_0_arm64.whl
Size 18.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2f823206ed7869ce296984928f30bfdb47d633428ed7c2de2dbdccf374514c5a
BLAKE2b-256 checksum
How to use checksums
ca8eff6efd80c3ae8f41a63d99211a45f829a8d52a599e1db6863223d416b281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / grafana_assistant-0.0.24-py3-none-macosx_10_9_x86_64.whl

Download URL grafana_assistant-0.0.24-py3-none-macosx_10_9_x86_64.whl
Size 19.3 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b3395a5c53805aa89d05a9b36cc3517dca2342176ccd9f9be80537aacf27eb2a
BLAKE2b-256 checksum
How to use checksums
41189e87be33a06867e5d29129ddecb70b55780afc043ae95aa405f99f4e0e07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.24 This release

8 release files

0.0.23

8 release files

0.0.22

8 release files

0.0.21

8 release files

0.0.19

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page