Skip to content

Commit e16d296

Browse files
authored
Merge branch 'main' into fuming/aks-get-cred-1011
2 parents 6158829 + e572f0a commit e16d296

877 files changed

Lines changed: 249719 additions & 219227 deletions

File tree

Some content is hidden

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

src/aks-agent/HISTORY.rst

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

15+
1.0.0b6
16+
+++++++
17+
* Introduce the new `az aks agent-init` command for better cli interaction.
18+
* Separate llm configuration from main agent command for improved clarity and extensibility.
19+
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+
1530
1.0.0b4
1631
+++++++
1732
* Fix the --aks-mcp flag to allow true/false values.

src/aks-agent/README.rst

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,41 @@ Azure CLI AKS Agent Extension
44
Introduction
55
============
66

7-
The AKS Agent extension provides the "az aks agent" command, an AI-powered assistant that
8-
helps analyze and troubleshoot Azure Kubernetes Service (AKS) clusters using Large Language
9-
Models (LLMs). The agent combines cluster context, configurable toolsets, and LLMs to answer
10-
natural-language questions about your cluster (for example, "Why are my pods not starting?")
11-
and can investigate issues in both interactive and non-interactive (batch) modes.
7+
8+
The AKS Agent extension provides the "az aks agent" command, an AI-powered assistant that helps analyze and troubleshoot Azure Kubernetes Service (AKS) clusters using Large Language Models (LLMs). The agent combines cluster context, configurable toolsets, and LLMs to answer natural-language questions about your cluster (for example, "Why are my pods not starting?") and can investigate issues in both interactive and non-interactive (batch) modes.
9+
10+
New in this version: **az aks agent-init** command for easy LLM model configuration!
11+
12+
You can now use `az aks agent-init` to interactively add and configure LLM models before asking questions. This command guides you through the setup process, allowing you to add multiple models as needed. When asking questions with `az aks agent`, you can:
13+
14+
- Use `--config-file` to specify your own model configuration file
15+
- Use `--model` to select a previously configured model
16+
- If neither is provided, the last configured LLM will be used by default
17+
18+
This makes it much easier to manage and switch between multiple models for your AKS troubleshooting workflows.
1219

1320
Key capabilities
1421
----------------
1522

23+
1624
- Interactive and non-interactive modes (use --no-interactive for batch runs).
17-
- Support for multiple LLM providers (Azure OpenAI, OpenAI, etc.) via environment variables.
18-
- Configurable via a JSON/YAML config file provided with --config-file.
25+
- Support for multiple LLM providers (Azure OpenAI, OpenAI, etc.) via interactive configuration.
26+
- **Easy model setup with `az aks agent-init`**: interactively add and configure LLM models, run multiple times to add more models.
27+
- Configurable via a JSON/YAML config file provided with --config-file, or select a model with --model.
28+
- If no config or model is specified, the last configured LLM is used automatically.
1929
- Control echo and tool output visibility with --no-echo-request and --show-tool-output.
2030
- Refresh the available toolsets with --refresh-toolsets.
2131
- Stay in traditional toolset mode by default, or opt in to aks-mcp integration with ``--aks-mcp`` when you need the enhanced capabilities.
2232

2333
Prerequisites
2434
-------------
25-
26-
Before using the agent, make sure provider-specific environment variables are set. For
27-
example, Azure OpenAI typically requires AZURE_API_BASE, AZURE_API_VERSION, and AZURE_API_KEY,
28-
while OpenAI requires OPENAI_API_KEY. For more details about supported providers and required
35+
No need to manually set environment variables! All model and credential information can be configured interactively using `az aks agent-init`.
36+
For more details about supported model providers and required
2937
variables, see: https://docs.litellm.ai/docs/providers
3038

39+
3140
Quick start and examples
32-
========================
41+
=========================
3342

3443
Install the extension
3544
---------------------
@@ -38,25 +47,58 @@ Install the extension
3847
3948
az extension add --name aks-agent
4049
41-
Run the agent (Azure OpenAI example)
50+
Configure LLM models interactively
51+
----------------------------------
52+
53+
.. code-block:: bash
54+
55+
az aks agent-init
56+
57+
This command will guide you through adding a new LLM model. You can run it multiple times to add more models or update existing models. All configured models are saved locally and can be selected when asking questions.
58+
59+
Run the agent (Azure OpenAI example) :
4260
-----------------------------------
4361

62+
**1. Use the last configured model (no extra parameters needed):**
63+
4464
.. code-block:: bash
4565
46-
export AZURE_API_BASE="https://my-azureopenai-service.openai.azure.com/"
47-
export AZURE_API_VERSION="2025-01-01-preview"
48-
export AZURE_API_KEY="sk-xxx"
66+
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup
67+
68+
**2. Specify a particular model you have configured:**
69+
70+
.. code-block:: bash
4971
5072
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model azure/my-gpt4.1-deployment
5173
74+
**3. Use a custom config file:**
75+
76+
.. code-block:: bash
77+
78+
az aks agent "Why are my pods not starting?" --config-file /path/to/your/model_config.yaml
79+
80+
5281
Run the agent (OpenAI example)
5382
------------------------------
5483

84+
**1. Use the last configured model (no extra parameters needed):**
85+
5586
.. code-block:: bash
5687
57-
export OPENAI_API_KEY="sk-xxx"
88+
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup
89+
90+
**2. Specify a particular model you have configured:**
91+
92+
.. code-block:: bash
93+
5894
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model gpt-4o
5995
96+
**3. Use a custom config file:**
97+
98+
.. code-block:: bash
99+
100+
az aks agent "Why are my pods not starting?" --config-file /path/to/your/model_config.yaml
101+
60102
Run in non-interactive batch mode
61103
---------------------------------
62104

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/_help.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
short-summary: Run AI assistant to analyze and troubleshoot Kubernetes clusters.
1717
long-summary: |-
1818
This command allows you to ask questions about your Azure Kubernetes cluster and get answers using AI models.
19-
Environment variables must be set to use the AI model, please refer to https://docs.litellm.ai/docs/providers to learn more about supported AI providers and models and required environment variables.
19+
No need to manually set environment variables! All model and credential information can be configured interactively using `az aks agent-init` or via a config file.
2020
parameters:
2121
- name: --name -n
2222
type: string
@@ -36,7 +36,7 @@
3636
Note: For Azure OpenAI, it is recommended to set the deployment name as the model name until https://github.com/BerriAI/litellm/issues/13950 is resolved.
3737
- name: --api-key
3838
type: string
39-
short-summary: API key to use for the LLM (if not given, uses environment variables AZURE_API_KEY, OPENAI_API_KEY).
39+
short-summary: API key to use for the LLM (if not given, uses environment variables AZURE_API_KEY, OPENAI_API_KEY). (Deprecated)
4040
- name: --config-file
4141
type: string
4242
short-summary: Path to configuration file.
@@ -63,23 +63,25 @@
6363
short-summary: Enable AKS MCP integration for enhanced capabilities. Traditional mode is the default.
6464
6565
examples:
66+
- name: Ask about pod issues in the cluster with last configured model
67+
text: |-
68+
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup
6669
- name: Ask about pod issues in the cluster with Azure OpenAI
6770
text: |-
68-
export AZURE_API_BASE="https://my-azureopenai-service.openai.azure.com/"
69-
export AZURE_API_VERSION="2025-01-01-preview"
70-
export AZURE_API_KEY="sk-xxx"
7171
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model azure/gpt-4.1
7272
- name: Ask about pod issues in the cluster with OpenAI
7373
text: |-
74-
export OPENAI_API_KEY="sk-xxx"
7574
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model gpt-4o
7675
- name: Run agent with config file
7776
text: |
7877
az aks agent "Check kubernetes pod resource usage" --config-file /path/to/custom.yaml --name MyManagedCluster --resource-group MyResourceGroup
7978
Here is an example of config file:
8079
```json
81-
model: "azure/gpt-4.1"
82-
api_key: "..."
80+
llms:
81+
- provider: "azure"
82+
MODEL_NAME: "gpt-4.1"
83+
AZURE_API_BASE: "https://<your-base-url>"
84+
AZURE_API_KEY: "<your-api-key>"
8385
# define a list of mcp servers, mcp server can be defined
8486
mcp_servers:
8587
aks_mcp:
@@ -131,3 +133,16 @@
131133
- name: Refresh toolsets to get the latest available tools
132134
text: az aks agent "What is the status of my cluster?" --refresh-toolsets --model azure/my-gpt4.1-deployment
133135
"""
136+
137+
helps[
138+
"aks agent-init"
139+
] = """
140+
type: command
141+
short-summary: Initialize and validate LLM provider/model configuration for AKS agent.
142+
long-summary: |-
143+
This command interactively guides you to select an LLM provider and model, validates the connection, and saves the configuration for later use.
144+
You can run this command multiple times to add or update different model configurations.
145+
examples:
146+
- name: Initialize configuration for Azure OpenAI, OpenAI or other llms
147+
text: az aks agent-init
148+
"""

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
)

0 commit comments

Comments
 (0)