Skip to content

Commit 31b10f0

Browse files
committed
Merge branch 'main' of github.com:Azure/azure-cli-extensions into feature/eas-llm-setup
2 parents 06743cb + 07cf235 commit 31b10f0

File tree

429 files changed

+187162
-197378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

429 files changed

+187162
-197378
lines changed

src/aks-agent/HISTORY.rst

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

15-
1.0.0b5
15+
1.0.0b6
1616
+++++++
1717
* Introduce the new `az aks agent-init` command for better cli interaction.
1818
* Separate llm configuration from main agent command for improved clarity and extensibility.
1919

20+
1.0.0b5
21+
+++++++
22+
* Bump holmesgpt to 0.15.0 - Enhanced AI debugging experience and bug fixes
23+
* Added TODO list feature to allows holmes to reliably answers questions it wasn't able to answer before due to early-stopping
24+
* Fixed mcp server http connection fails when using socks proxy by adding the missing socks dependency
25+
* Fixed gpt-5 temperature bug by upgrading litellm and dropping non-1 values for temperature
26+
* Improved the installation time by removing unnecessary dependencies and move test dependencies to dev dependency group
27+
* Added Feedback slash command Feature to allow users to provide feedback on their experience with the agent performance
28+
* Disable prometheus toolset loading by default to workaround the libbz2-dev missing issue in Azure CLI python environment.
29+
2030
1.0.0b4
2131
+++++++
2232
* 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():
@@ -603,7 +614,7 @@ def _build_aks_context(cluster_name, resource_group_name, subscription_id, is_mc
603614

604615

605616
def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
606-
prompt, console, show_tool_output, is_mcp_mode):
617+
prompt, console, show_tool_output, is_mcp_mode, telemetry):
607618
"""
608619
Run interactive mode synchronously - no event loop conflicts.
609620
@@ -618,6 +629,7 @@ def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
618629
:param console: Console object for output
619630
:param show_tool_output: Whether to show tool output
620631
:param is_mcp_mode: Whether running in MCP mode (affects prompt selection)
632+
:param telemetry: CLITelemetryClient instance for tracking events
621633
"""
622634
from holmes.interactive import run_interactive_loop
623635

@@ -634,7 +646,8 @@ def _run_interactive_mode_sync(ai, cmd, resource_group_name, name,
634646
ai, console, prompt, None, None,
635647
show_tool_output=show_tool_output,
636648
system_prompt_additions=aks_context,
637-
check_version=False
649+
check_version=False,
650+
feedback_callback=telemetry.track_agent_feedback if telemetry else None
638651
)
639652

640653

@@ -654,8 +667,9 @@ def _run_noninteractive_mode_sync(ai, config, cmd, resource_group_name, name,
654667
:param show_tool_output: Whether to show tool output
655668
:param is_mcp_mode: Whether running in MCP mode (affects prompt selection)
656669
"""
657-
import uuid
658670
import socket
671+
import uuid
672+
659673
from holmes.core.prompt import build_initial_ask_messages
660674
from holmes.plugins.destinations import DestinationType
661675
from holmes.plugins.interfaces import Issue
@@ -703,10 +717,12 @@ def _setup_traditional_mode_sync(config_file: str, model: str, api_key: str,
703717
:param verbose: Enable verbose output
704718
:return: Traditional Holmes configuration
705719
"""
720+
import tempfile
706721
from pathlib import Path
722+
707723
import yaml
708-
import tempfile
709724
from holmes.config import Config
725+
710726
from .config_generator import ConfigurationGenerator
711727

712728
# 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()

src/aks-agent/azext_aks_agent/tests/latest/const.py

Whitespace-only changes.

0 commit comments

Comments
 (0)