AI assistant for Grafana Cloud
Project description
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.
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, thegrafana-assistant-app.tokens:accesspermission must be included.
For non-interactive environments (CI/CD, scripts), you can use a service account token instead:
grafana-assistant config set-instance mystack \
--url https://mystack.grafana.net \
--token '${GRAFANA_SA_TOKEN}'
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:
/clearor/new- Start a new conversation/exit,/quit, or/q- Exit/help- Show help
Keyboard Shortcuts:
Enter- Send messageCtrl+C- Cancel current request or exitCtrl+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 | - |
--token, -t |
Service account token | - |
--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 | - |
--token, -t |
Service account token | - |
--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 (recommended) |
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
grepandfind_pathactions - Add/remove projects dynamically mid-session
- Configure named projects (e.g.,
- 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_SA_TOKEN |
Service account token |
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
- During a chat session, when a tool requires approval, you'll see a prompt:
Approve execute_query - Execute a database query? [y]/[n]
- Press
yorYto approve and allow the tool to execute - Press
n,N, orEscto 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
- A Grafana instance with the Assistant plugin enabled
- A Grafana user account for browser-based authentication (recommended)
For non-interactive use (CI/CD, automation), create a service account with the Editor role and generate a token instead.
Contributing
See CONTRIBUTING.md for development setup, testing, and snapshot test instructions.
License
This software is licensed under the Grafana Enterprise Plugin License Agreement.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 grafana_assistant-0.0.22-py3-none-win_arm64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-win_arm64.whl
- Upload date:
- Size: 17.9 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6883f8f47a39397602e0d8eaa614480ac7077d097f2285f9201776550b8ffce
|
|
| MD5 |
4464d418efb86627c58049d89599b9bb
|
|
| BLAKE2b-256 |
d170d6a5792bc361d899127e19c965740d628d37f6d71ea3129f3078b60b731f
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-win_arm64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-win_arm64.whl -
Subject digest:
e6883f8f47a39397602e0d8eaa614480ac7077d097f2285f9201776550b8ffce - Sigstore transparency entry: 1185564648
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-win_amd64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-win_amd64.whl
- Upload date:
- Size: 19.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68c3c6657631df228c22857fb71fda61233ef5f79a6bbffa30d78331e8b2dc47
|
|
| MD5 |
a4f11109402dd2121ab863d3ae970eb0
|
|
| BLAKE2b-256 |
c4368440e9be94a671d7d605b8e7890b0f84781b6a70373d52b9fd723605395e
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-win_amd64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-win_amd64.whl -
Subject digest:
68c3c6657631df228c22857fb71fda61233ef5f79a6bbffa30d78331e8b2dc47 - Sigstore transparency entry: 1185564667
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 19.3 MB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74c5650c973e7824c8a91cefcd585bd3a208aeffb0d93b44f80c7bc0719b1bf6
|
|
| MD5 |
806be66a8d73760c4887cf03ffbe533c
|
|
| BLAKE2b-256 |
fd040e312c591f7339c1016f6a8d4d1ecc521eda40e68d5ee88a850c9d83df1d
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-musllinux_1_2_x86_64.whl -
Subject digest:
74c5650c973e7824c8a91cefcd585bd3a208aeffb0d93b44f80c7bc0719b1bf6 - Sigstore transparency entry: 1185564531
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 18.0 MB
- Tags: Python 3, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4854a6d8c8ca5b973e12f711d19844cf447447b090034c715528ee165386e896
|
|
| MD5 |
7aa281f1a95b08e06ae5e4230e605799
|
|
| BLAKE2b-256 |
f7a8de4faeca662d7e3eeac1b22dd50493756a14f88df689efb20122eb0edb81
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-musllinux_1_2_aarch64.whl -
Subject digest:
4854a6d8c8ca5b973e12f711d19844cf447447b090034c715528ee165386e896 - Sigstore transparency entry: 1185564591
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 19.3 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
babc43eabe005962b3c431d5885757253e46ff4e1623ace40a90aa492c149a2b
|
|
| MD5 |
cf93e0db81ba80dd3cce11699f53ed58
|
|
| BLAKE2b-256 |
2112310f51ce2966c4c1ab75d1d24e319ee86f295ea19fd2b0fa50b1f1ba8abb
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-manylinux_2_17_x86_64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-manylinux_2_17_x86_64.whl -
Subject digest:
babc43eabe005962b3c431d5885757253e46ff4e1623ace40a90aa492c149a2b - Sigstore transparency entry: 1185564608
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 18.0 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
876d3367b07e264a1342d53ef6ceef5f06e27a85ae56a40d0c52d44d998441a5
|
|
| MD5 |
ab654e6a3fa1bdf80319fd09b036d2e3
|
|
| BLAKE2b-256 |
63fdb8d0e046edae179ebad302ac2b2b23677c5c0290cd0af48a53ab05de0630
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-manylinux_2_17_aarch64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-manylinux_2_17_aarch64.whl -
Subject digest:
876d3367b07e264a1342d53ef6ceef5f06e27a85ae56a40d0c52d44d998441a5 - Sigstore transparency entry: 1185564630
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 18.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5f2502e58682da4ebb41b4ff089367910ed6b31fa8863176b86347b9a606c0a
|
|
| MD5 |
c1b43f4a095641cd45bfd2a351ccc407
|
|
| BLAKE2b-256 |
c74d28ebc7eb3e71699aff5a3dac4ee0e904f1d504f66868ea7ca02b8d030e84
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-macosx_11_0_arm64.whl -
Subject digest:
d5f2502e58682da4ebb41b4ff089367910ed6b31fa8863176b86347b9a606c0a - Sigstore transparency entry: 1185564563
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grafana_assistant-0.0.22-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: grafana_assistant-0.0.22-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 19.2 MB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33f36826778ea829b8c69b02eb4e2972d027147169e1c5a4a4eea3c2ee3c1774
|
|
| MD5 |
8e1d1cb4ccf3f49aff2407be4ad3a40b
|
|
| BLAKE2b-256 |
137026e520adcbd3bfe23f2156eeaf984aec1c7e8bdf4e80223d5a66a941bdb8
|
Provenance
The following attestation bundles were made for grafana_assistant-0.0.22-py3-none-macosx_10_9_x86_64.whl:
Publisher:
release.yml on grafana/assistant-cli-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grafana_assistant-0.0.22-py3-none-macosx_10_9_x86_64.whl -
Subject digest:
33f36826778ea829b8c69b02eb4e2972d027147169e1c5a4a4eea3c2ee3c1774 - Sigstore transparency entry: 1185564545
- Sigstore integration time:
-
Permalink:
grafana/assistant-cli-internal@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Branch / Tag:
refs/tags/v0.0.22 - Owner: https://github.com/grafana
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce85363fe8752891d72f25d45c3a337e5f7c69d8 -
Trigger Event:
push
-
Statement type: