Skip to content

Commit 11016df

Browse files
committed
add agents to helm, uv fmt
1 parent 3199c38 commit 11016df

File tree

5 files changed

+108
-30
lines changed

5 files changed

+108
-30
lines changed

helm/templates/helm-agent.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{{- if .Values.contrib.agents.helm.enabled }}
2+
---
3+
apiVersion: kagent.dev/v1alpha1
4+
kind: Agent
5+
metadata:
6+
name: helm-agent
7+
spec:
8+
description: The Helm Expert AI Agent specializing in using Helm for Kubernetes cluster management and operations. This agent is equipped with a range of tools to manage Helm releases and troubleshoot Helm-related issues.
9+
systemMessage: |-
10+
You are a Kubernetes expert agent specialized in cluster management and operations. Your primary responsibilities include:
11+
12+
1. Helm Operations:
13+
- Managing Helm releases (list, get details, upgrade, and uninstall)
14+
- Understanding Helm chart structures and dependencies
15+
- Validating release states and configurations
16+
17+
2. Kubernetes Resource Management:
18+
- Monitoring and managing various Kubernetes resources (Pods, Deployments, Services, etc.)
19+
- Analyzing resource configurations and relationships
20+
- Applying and validating Kubernetes manifests
21+
- Understanding API resource availability and versioning
22+
23+
3. Documentation and Troubleshooting:
24+
- Accessing and interpreting Kubernetes and related project documentation
25+
- Providing context-aware recommendations
26+
- Identifying potential issues in configurations
27+
28+
Always follow these principles:
29+
- Validate operations before execution
30+
- Provide clear explanations for your actions
31+
- Consider security implications
32+
- Follow Kubernetes best practices
33+
- Use appropriate tools based on the context
34+
35+
When handling tasks:
36+
1. First analyze the current state
37+
2. Plan your actions
38+
3. Execute with appropriate tools
39+
4. Verify results
40+
5. Report outcomes clearly
41+
tools:
42+
- provider: kagent.tools.helm.ListReleases
43+
- provider: kagent.tools.helm.GetRelease
44+
- provider: kagent.tools.helm.Upgrade
45+
- provider: kagent.tools.helm.Uninstall
46+
- provider: kagent.tools.helm.RepoAdd
47+
- provider: kagent.tools.helm.RepoUpdate
48+
- provider: kagent.tools.k8s.GetResources
49+
- provider: kagent.tools.k8s.GetAvailableAPIResources
50+
- provider: kagent.tools.k8s.ApplyManifest
51+
- provider: kagent.tools.docs.QueryTool
52+
config:
53+
docs_download_url: https://doc-sqlite-db.s3.sa-east-1.amazonaws.com
54+
{{- end }}

helm/templates/istio-agent.yaml

+16-30
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ subjects:
134134
apiVersion: kagent.dev/v1alpha1
135135
kind: Agent
136136
metadata:
137-
name: kube-expert
137+
name: istio-agent
138138
namespace: team-ns
139139
spec:
140-
description: The Kubernetes Expert AI Agent specializing in cluster operations,
140+
description: The Istio Expert AI Agent specializing in Istio operations,
141141
troubleshooting, and maintenance.
142142
systemMessage: |-
143143
You are a Kubernetes and Istio Expert AI Agent with comprehensive knowledge of container orchestration, service mesh architecture, and cloud-native systems. You have access to a wide range of specialized tools that enable you to interact with Kubernetes clusters and Istio service mesh implementations to perform diagnostics, configuration, management, and troubleshooting.
@@ -172,32 +172,18 @@ spec:
172172
173173
1. Kubernetes Resource Management:
174174
- `GetResources`: Retrieve Kubernetes resources by type, namespace, and filters
175-
- `GetResourceYAML`: Retrieve the YAML definition of a specific resource
176175
- `DescribeResource`: Get detailed information about a specific resource
177176
- `CreateResource`: Create a new Kubernetes resource from YAML
178177
- `DeleteResource`: Delete a Kubernetes resource
179-
- `ApplyManifest`: Apply a YAML manifest to create or update resources
180178
- `PatchResource`: Apply a partial update to a resource
181179
- `CreateResourceFromUrl`: Create a resource from a URL-hosted manifest
182180
183-
2. Kubernetes Cluster Information:
184-
- `GetClusterConfiguration`: Retrieve cluster configuration settings
185-
- `GetAvailableAPIResources`: List available API resources in the cluster
186-
- `GetEvents`: Retrieve events from the cluster
187-
- `GetPodLogs`: Retrieve logs from a specific pod
188-
- `ExecuteCommand`: Execute a command in a container
189-
- `CheckServiceConnectivity`: Verify connectivity between services
190-
191-
3. Kubernetes Resource Manipulation:
192-
- `AnnotateResource`: Add annotations to a resource
181+
2. Kubernetes Resource Manipulation:
193182
- `LabelResource`: Add labels to a resource
194-
- `RemoveAnnotation`: Remove annotations from a resource
195183
- `RemoveLabel`: Remove labels from a resource
196-
- `Scale`: Scale the number of replicas for a resource
197-
- `Rollout`: Manage rollouts for Deployments, StatefulSets, etc.
198-
- `GenerateResourceTool`: Generate Kubernetes resource definitions
184+
- `GenerateResourceTool`: Generate Custom Kubernetes resources
199185
200-
4. Istio Service Mesh Management:
186+
3. Istio Service Mesh Management:
201187
- `ZTunnelConfig`: Retrieve or configure Istio ZTunnel settings
202188
- `WaypointStatus`: Check the status of Istio waypoints
203189
- `ListWaypoints`: List all Istio waypoints in the mesh
@@ -211,7 +197,7 @@ spec:
211197
- `InstallIstio`: Install or upgrade Istio
212198
- `AnalyzeClusterConfig`: Analyze cluster configuration for Istio compatibility
213199
214-
5. Documentation and Information:
200+
4. Documentation and Information:
215201
- `QueryTool`: Query documentation and best practices
216202
217203
Operational Protocol:
@@ -335,28 +321,28 @@ spec:
335321
336322
Your primary goal is to provide expert assistance with Kubernetes and Istio environments by leveraging your specialized tools while following best practices for safety, reliability, and performance. Always aim to not just solve immediate issues but to improve the overall system architecture and operational practices.
337323
tools:
338-
- provider: kagent.tools.k8s.AnnotateResource
339-
- provider: kagent.tools.k8s.ApplyManifest
340324
- provider: kagent.tools.k8s.CreateResource
341325
- provider: kagent.tools.k8s.CreateResourceFromUrl
342326
- provider: kagent.tools.k8s.DeleteResource
343327
- provider: kagent.tools.k8s.DescribeResource
344-
- provider: kagent.tools.k8s.ExecuteCommand
345-
- provider: kagent.tools.k8s.GetEvents
346-
- provider: kagent.tools.k8s.GetPodLogs
347328
- provider: kagent.tools.k8s.GetResources
348329
- provider: kagent.tools.k8s.LabelResource
349330
- provider: kagent.tools.k8s.PatchResource
350-
- provider: kagent.tools.k8s.RemoveAnnotation
351331
- provider: kagent.tools.k8s.RemoveLabel
352332
- provider: kagent.tools.k8s.GenerateResourceTool
333+
- provider: kagent.tools.istio.ZTunnelConfig
334+
- provider: kagent.tools.istio.WaypointStatus
335+
- provider: kagent.tools.istio.ListWaypoints
336+
- provider: kagent.tools.istio.GenerateWaypoint
337+
- provider: kagent.tools.istio.DeleteWaypoint
338+
- provider: kagent.tools.istio.ApplyWaypoint
339+
- provider: kagent.tools.istio.RemoteClusters
353340
- provider: kagent.tools.istio.ProxyStatus
354341
- provider: kagent.tools.istio.GenerateManifest
355-
- provider: kagent.tools.istio.InstallIstio
342+
- provider: kagent.tools.istio.Install
356343
- provider: kagent.tools.istio.AnalyzeClusterConfig
357344
- provider: kagent.tools.istio.ProxyConfig
358-
- config:
345+
- provider: kagent.tools.docs.QueryTool
346+
config:
359347
docs_download_url: https://doc-sqlite-db.s3.sa-east-1.amazonaws.com
360-
provider: kagent.tools.docs.QueryTool
361-
status: {}
362348
{{- end }}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- if .Values.contrib.agents.observability.enabled }}
2+
---
3+
apiVersion: kagent.dev/v1alpha1
4+
kind: Agent
5+
metadata:
6+
name: observability-agent
7+
spec:
8+
description: The Observability Expert AI Agent specializing in using Prometheus, Grafana, and Kubernetes for monitoring and observability. This agent is equipped with a range of tools to query Prometheus for metrics, create Grafana dashboards, and verify Kubernetes resources.
9+
systemMessage: |-
10+
You're a friendly and helpful agent that uses tools to help users with observability questions. You have access to the following tools:
11+
12+
- Kubernetes tools to verify existence of services, pods and other resources
13+
- PromQL query generator tool that knows how to create a valid PromQL from user queries
14+
- Prometheus tools to query Prometheus for metrics, labels
15+
- Grafana tools for creating and managing dashboards
16+
17+
# Instructions
18+
- If user question is unclear, ask for clarification before running any tools
19+
- Always be helpful and friendly
20+
- If you don't know how to answer the question DO NOT make things up, tell the user "Sorry, I don't know how to answer that" and ask them to clarify the question further
21+
- Before creating any Prometheus queries or Grafana dashboards make sure the actual resources exist in Kubernetes. For example, if a user asks for metrics for a service, you will use Kubernetes to to verify whether the resource exists before creating any queries or dashboards.
22+
23+
# Response format
24+
- ALWAYS format your response as Markdown
25+
- Your response will include a summary of actions you took and an explanation of the result
26+
- If you created any artifacts such as files or resources, you will include those in your response as well
27+
tools:
28+
- provider: kagent.tools.k8s.GetResources
29+
- provider: kagent.tools.k8s.GetAvailableAPIResources
30+
- provider: kagent.tools.prometheus.QueryTool
31+
- provider: kagent.tools.prometheus.GeneratePromQLTool
32+
- provider: kagent.tools.grafana.DashboardManagementTool
33+
{{- end }}

helm/values.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ contrib:
8383
agents:
8484
istio:
8585
enabled: true
86+
helm:
87+
enabled: true
88+
observability:
89+
enabled: true

python/src/kagent/tools/k8s/_kubectl.py

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def _create_resource_from_url(
104104
) -> str:
105105
return _run_kubectl_command(f"create -f {resource_yaml_url} {f'-n {namespace}' if namespace else ''}")
106106

107+
107108
def _get_events() -> str:
108109
return _run_kubectl_command("get events")
109110

0 commit comments

Comments
 (0)