Skip to content

Commit 07cf235

Browse files
authored
{AKS} Bump holmesgpt and add feedback slash command (#9261)
1 parent b70762e commit 07cf235

File tree

8 files changed

+259
-183
lines changed

8 files changed

+259
-183
lines changed

src/aks-agent/HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
1.0.0b5
16+
+++++++
17+
* Bump holmesgpt to 0.15.0 - Enhanced AI debugging experience and bug fixes
18+
* Added TODO list feature to allows holmes to reliably answers questions it wasn't able to answer before due to early-stopping
19+
* Fixed mcp server http connection fails when using socks proxy by adding the missing socks dependency
20+
* Fixed gpt-5 temperature bug by upgrading litellm and dropping non-1 values for temperature
21+
* Improved the installation time by removing unnecessary dependencies and move test dependencies to dev dependency group
22+
* Added Feedback slash command Feature to allow users to provide feedback on their experience with the agent performance
23+
* Disable prometheus toolset loading by default to workaround the libbz2-dev missing issue in Azure CLI python environment.
24+
1525
1.0.0b4
1626
+++++++
1727
* Fix the --aks-mcp flag to allow true/false values.

src/aks-agent/azext_aks_agent/_consts.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
# aks agent constants
6+
# Constants to customized holmesgpt
77
CONST_AGENT_CONFIG_PATH_DIR_ENV_KEY = "HOLMES_CONFIGPATH_DIR"
88
CONST_AGENT_NAME = "AKS AGENT"
99
CONST_AGENT_NAME_ENV_KEY = "AGENT_NAME"
1010
CONST_AGENT_CONFIG_FILE_NAME = "aksAgent.yaml"
11+
CONST_PRIVACY_NOTICE_BANNER_ENV_KEY = "PRIVACY_NOTICE_BANNER"
12+
# Privacy Notice Banner displayed in the format of rich.Console
13+
CONST_PRIVACY_NOTICE_BANNER = (
14+
"When you send Microsoft this feedback, you agree we may combine this information, which might include other "
15+
"diagnostic data, to help improve Microsoft products and services. Processing of feedback data is governed by "
16+
"the Microsoft Products and Services Data Protection Addendum between your organization and Microsoft, and the "
17+
"feedback you submit is considered Personal Data under that addendum. "
18+
"Privacy Statement: https://go.microsoft.com/fwlink/?LinkId=521839"
19+
)
20+
# Holmesgpt leverages prometheus_api_client for prometheus toolsets and introduces bz2 library.
21+
# Before libbz2-dev is bundled into azure cli python by https://github.com/Azure/azure-cli/pull/32163,
22+
# we ignore loading prometheus toolset to avoid loading error of bz2 module.
23+
CONST_DISABLE_PROMETHEUS_TOOLSET_ENV_KEY = "DISABLE_PROMETHEUS_TOOLSET"
1124

1225
# MCP Integration Constants (ported from previous change)
1326
CONST_MCP_BINARY_NAME = "aks-mcp"

src/aks-agent/azext_aks_agent/_params.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
# pylint: disable=too-many-statements,too-many-lines
77
import os.path
88

9-
from azure.cli.core.api import get_config_dir
10-
from azure.cli.core.commands.parameters import get_three_state_flag
11-
129
from azext_aks_agent._consts import CONST_AGENT_CONFIG_FILE_NAME
13-
1410
from azext_aks_agent._validators import validate_agent_config_file
11+
from azure.cli.core.api import get_config_dir
12+
from azure.cli.core.commands.parameters import get_three_state_flag
1513

1614

1715
def load_arguments(self, _):
@@ -37,7 +35,7 @@ def load_arguments(self, _):
3735
c.argument(
3836
"max_steps",
3937
type=int,
40-
default=10,
38+
default=40,
4139
required=False,
4240
help="Maximum number of steps the LLM can take to investigate the issue.",
4341
)

src/aks-agent/azext_aks_agent/agent/agent.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@
1111
CONST_AGENT_CONFIG_PATH_DIR_ENV_KEY,
1212
CONST_AGENT_NAME,
1313
CONST_AGENT_NAME_ENV_KEY,
14+
CONST_DISABLE_PROMETHEUS_TOOLSET_ENV_KEY,
15+
CONST_PRIVACY_NOTICE_BANNER,
16+
CONST_PRIVACY_NOTICE_BANNER_ENV_KEY,
1417
)
1518
from azure.cli.core.api import get_config_dir
1619
from azure.cli.core.commands.client_factory import get_subscription_id
1720
from knack.util import CLIError
1821

22+
from .error_handler import MCPError
1923
from .prompt import AKS_CONTEXT_PROMPT_MCP, AKS_CONTEXT_PROMPT_TRADITIONAL
2024
from .telemetry import CLITelemetryClient
21-
from .error_handler import MCPError
25+
26+
27+
# NOTE(mainred): environment variables to disable prometheus toolset loading should be set before importing holmes.
28+
def customize_holmesgpt():
29+
os.environ[CONST_DISABLE_PROMETHEUS_TOOLSET_ENV_KEY] = "true"
30+
os.environ[CONST_AGENT_CONFIG_PATH_DIR_ENV_KEY] = get_config_dir()
31+
os.environ[CONST_AGENT_NAME_ENV_KEY] = CONST_AGENT_NAME
32+
os.environ[CONST_PRIVACY_NOTICE_BANNER_ENV_KEY] = CONST_PRIVACY_NOTICE_BANNER
2233

2334

2435
# NOTE(mainred): holmes leverage the log handler RichHandler to provide colorful, readable and well-formatted logs
@@ -151,21 +162,19 @@ def aks_agent(
151162
:type use_aks_mcp: bool
152163
"""
153164

154-
with CLITelemetryClient():
165+
with CLITelemetryClient() as telemetry:
155166
if sys.version_info < (3, 10):
156167
raise CLIError(
157168
"Please upgrade the python version to 3.10 or above to use aks agent."
158169
)
170+
# customizing holmesgpt should called before importing holmes
171+
customize_holmesgpt()
159172

160173
# Initialize variables
161174
interactive = not no_interactive
162175
echo = not no_echo_request
163176
console = init_log()
164177

165-
# Set environment variables for Holmes
166-
os.environ[CONST_AGENT_CONFIG_PATH_DIR_ENV_KEY] = get_config_dir()
167-
os.environ[CONST_AGENT_NAME_ENV_KEY] = CONST_AGENT_NAME
168-
169178
# Detect and read piped input
170179
piped_data = None
171180
if not sys.stdin.isatty():
@@ -265,7 +274,7 @@ def aks_agent(
265274
is_mcp_mode = current_mode == "mcp"
266275
if interactive:
267276
_run_interactive_mode_sync(ai, cmd, resource_group_name, name,
268-
prompt, console, show_tool_output, is_mcp_mode)
277+
prompt, console, show_tool_output, is_mcp_mode, telemetry)
269278
else:
270279
_run_noninteractive_mode_sync(ai, config, cmd, resource_group_name, name,
271280
prompt, console, echo, show_tool_output, is_mcp_mode)
@@ -312,13 +321,15 @@ async def _setup_mcp_mode(mcp_manager, config_file: str, model: str, api_key: st
312321
:return: Enhanced Holmes configuration
313322
:raises: Exception if MCP setup fails
314323
"""
324+
import tempfile
315325
from pathlib import Path
326+
316327
import yaml
317-
import tempfile
318328
from holmes.config import Config
329+
319330
from .config_generator import ConfigurationGenerator
320-
from .user_feedback import ProgressReporter
321331
from .error_handler import AgentErrorHandler
332+
from .user_feedback import ProgressReporter
322333

323334
# Ensure binary is available (download if needed)
324335
if not mcp_manager.is_binary_available() or not mcp_manager.validate_binary_version():
@@ -602,7 +613,7 @@ def _build_aks_context(cluster_name, resource_group_name, subscription_id, is_mc
602613

603614

604615
def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
605-
prompt, console, show_tool_output, is_mcp_mode):
616+
prompt, console, show_tool_output, is_mcp_mode, telemetry):
606617
"""
607618
Run interactive mode synchronously - no event loop conflicts.
608619
@@ -617,6 +628,7 @@ def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
617628
:param console: Console object for output
618629
:param show_tool_output: Whether to show tool output
619630
:param is_mcp_mode: Whether running in MCP mode (affects prompt selection)
631+
:param telemetry: CLITelemetryClient instance for tracking events
620632
"""
621633
from holmes.interactive import run_interactive_loop
622634

@@ -633,7 +645,8 @@ def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
633645
ai, console, prompt, None, None,
634646
show_tool_output=show_tool_output,
635647
system_prompt_additions=aks_context,
636-
check_version=False
648+
check_version=False,
649+
feedback_callback=telemetry.track_agent_feedback if telemetry else None
637650
)
638651

639652

@@ -653,8 +666,9 @@ def _run_noninteractive_mode_sync(ai, config, cmd, resource_group_name, name,
653666
:param show_tool_output: Whether to show tool output
654667
:param is_mcp_mode: Whether running in MCP mode (affects prompt selection)
655668
"""
656-
import uuid
657669
import socket
670+
import uuid
671+
658672
from holmes.core.prompt import build_initial_ask_messages
659673
from holmes.plugins.destinations import DestinationType
660674
from holmes.plugins.interfaces import Issue
@@ -702,10 +716,12 @@ def _setup_traditional_mode_sync(config_file: str, model: str, api_key: str,
702716
:param verbose: Enable verbose output
703717
:return: Traditional Holmes configuration
704718
"""
719+
import tempfile
705720
from pathlib import Path
721+
706722
import yaml
707-
import tempfile
708723
from holmes.config import Config
724+
709725
from .config_generator import ConfigurationGenerator
710726

711727
# Load base config

src/aks-agent/azext_aks_agent/agent/telemetry.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
# --------------------------------------------------------------------------------------------
55

66
import datetime
7+
import json
78
import logging
89
import os
910
import platform
1011

1112
from applicationinsights import TelemetryClient
12-
from azure.cli.core.telemetry import (_get_azure_subscription_id,
13-
_get_hash_mac_address, _get_user_agent)
13+
from azure.cli.core.telemetry import (
14+
_get_azure_subscription_id,
15+
_get_hash_mac_address,
16+
_get_user_agent,
17+
)
1418

1519
DEFAULT_INSTRUMENTATION_KEY = "c301e561-daea-42d9-b9d1-65fca4166704"
1620
APPLICATIONINSIGHTS_INSTRUMENTATION_KEY_ENV = "APPLICATIONINSIGHTS_INSTRUMENTATION_KEY"
@@ -75,3 +79,21 @@ def _get_application_insights_instrumentation_key(self) -> str:
7579
return os.getenv(
7680
APPLICATIONINSIGHTS_INSTRUMENTATION_KEY_ENV, DEFAULT_INSTRUMENTATION_KEY
7781
)
82+
83+
def track_agent_feedback(self, feedback):
84+
# NOTE: We should try to avoid importing holmesgpt at the top level to prevent dependency issues
85+
from holmes.core.feedback import Feedback, FeedbackMetadata
86+
87+
# Type hint validation for development purposes
88+
if not isinstance(feedback, Feedback):
89+
raise TypeError(f"Expected Feedback object, got {type(feedback)}")
90+
91+
# Before privacy team's approval for other user data, we keep only direct user feedback, and model info.
92+
feedback_filtered = Feedback()
93+
feedback_filtered.user_feedback = feedback.user_feedback
94+
feedback_metadata = FeedbackMetadata()
95+
feedback_metadata.model = feedback.metadata.model
96+
feedback_filtered.metadata = feedback_metadata
97+
self.track("AgentCLIFeedback", properties={"feedback": json.dumps(feedback_filtered.to_dict())})
98+
# Flush the telemetry data immediately to avoid too much data being sent at once
99+
self.flush()

0 commit comments

Comments
 (0)