From 2d493be2e4d9528a5a2650226171d554134c6dca Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Tue, 9 Jun 2026 22:18:16 +0200 Subject: [PATCH 1/5] feat(observability): add configurable prometheus.url to agent chart Adds an optional prometheus.url value. When set, the URL is injected into the agent system message so the agent knows which endpoint to use. Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 6 ++++++ helm/agents/observability/values.yaml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index 8d7a05a101..85f6b590fa 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -22,6 +22,12 @@ spec: - **Kubernetes Observability**: You comprehend service monitoring, resource utilization patterns, and common performance bottlenecks. - **Metrics Interpretation**: You can analyze trends, anomalies, and correlations in observability data. - **Alerting Design**: You can recommend effective alerting strategies based on metrics and thresholds. + {{- with .Values.prometheus }}{{- if .url }} + + ## Prometheus Configuration + + The Prometheus server for this cluster is available at {{ .url }}. Use this URL when you need to query Prometheus directly. + {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} diff --git a/helm/agents/observability/values.yaml b/helm/agents/observability/values.yaml index 1cfd5eeaf3..d2ddb630c6 100644 --- a/helm/agents/observability/values.yaml +++ b/helm/agents/observability/values.yaml @@ -15,3 +15,8 @@ resources: memory: 1Gi compaction: {} + +# -- Optional Prometheus server URL (e.g. "http://prometheus:9090"). When set, it is injected +# into the agent's system message so the agent knows which Prometheus endpoint to use. +prometheus: + url: "" From c70e5f2575fdacd92dcfda5a4d3eb29a6f2d2b7f Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Mon, 15 Jun 2026 23:04:11 +0200 Subject: [PATCH 2/5] fix(observability): replace prometheus.url with grafana.prometheusDatasourceName The observability agent queries Prometheus exclusively through the Grafana MCP tool server. Tools like query_prometheus take a Grafana datasourceUid, not a raw Prometheus endpoint, so injecting a URL into the system message provided no actionable value. Replace prometheus.url with grafana.prometheusDatasourceName. When set, the agent is told which Grafana datasource to use for all Prometheus queries, matching how the tools actually work. Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 6 +++--- helm/agents/observability/values.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index 85f6b590fa..a38f63bd24 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -22,11 +22,11 @@ spec: - **Kubernetes Observability**: You comprehend service monitoring, resource utilization patterns, and common performance bottlenecks. - **Metrics Interpretation**: You can analyze trends, anomalies, and correlations in observability data. - **Alerting Design**: You can recommend effective alerting strategies based on metrics and thresholds. - {{- with .Values.prometheus }}{{- if .url }} + {{- with .Values.grafana }}{{- if .prometheusDatasourceName }} - ## Prometheus Configuration + ## Prometheus Datasource - The Prometheus server for this cluster is available at {{ .url }}. Use this URL when you need to query Prometheus directly. + Use "{{ .prometheusDatasourceName }}" as the Grafana datasource name for all Prometheus queries (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} diff --git a/helm/agents/observability/values.yaml b/helm/agents/observability/values.yaml index d2ddb630c6..871a6ce4cb 100644 --- a/helm/agents/observability/values.yaml +++ b/helm/agents/observability/values.yaml @@ -16,7 +16,7 @@ resources: compaction: {} -# -- Optional Prometheus server URL (e.g. "http://prometheus:9090"). When set, it is injected -# into the agent's system message so the agent knows which Prometheus endpoint to use. -prometheus: - url: "" +# -- Optional Grafana datasource name for Prometheus (e.g. "Prometheus"). When set, the agent +# uses this datasource name for all Prometheus queries instead of discovering it at runtime. +grafana: + prometheusDatasourceName: "" From 0370e7e9227f1e0086fbc6a8ca68f3fa06e1af1b Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 19:10:41 +0200 Subject: [PATCH 3/5] fix(observability): replace get_datasource_by_uid and get_datasource_by_name with get_datasource Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index a38f63bd24..a9e68a032c 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -26,7 +26,7 @@ spec: ## Prometheus Datasource - Use "{{ .prometheusDatasourceName }}" as the Grafana datasource name for all Prometheus queries (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). + Call get_datasource with name "{{ .prometheusDatasourceName }}" once to get the datasource UID. Use that UID for all Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} @@ -100,8 +100,7 @@ spec: - get_sift_analysis - get_oncall_shift - get_incident - - get_datasource_by_uid - - get_datasource_by_name + - get_datasource - get_dashboard_panel_queries - get_dashboard_by_uid - get_current_oncall_users From 223371d3ade21ec9523b7990c7a7feb62567f928 Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 22:52:39 +0200 Subject: [PATCH 4/5] fix(observability): strengthen get_datasource instruction in system message Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index a9e68a032c..f602ad71e3 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -26,7 +26,7 @@ spec: ## Prometheus Datasource - Call get_datasource with name "{{ .prometheusDatasourceName }}" once to get the datasource UID. Use that UID for all Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). + Before making any Prometheus tool call, you must first call get_datasource with name "{{ .prometheusDatasourceName }}" to resolve the datasource UID. Use that UID for all subsequent Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} From 390b174826125b1df8883876d2bd186baaf9630b Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 23:13:02 +0200 Subject: [PATCH 5/5] fix(substrate): return empty result when ate.dev CRDs are not installed Signed-off-by: mesutoezdil --- go/core/internal/httpserver/handlers/substrate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go/core/internal/httpserver/handlers/substrate.go b/go/core/internal/httpserver/handlers/substrate.go index 84872f0b85..dddb2e6b9c 100644 --- a/go/core/internal/httpserver/handlers/substrate.go +++ b/go/core/internal/httpserver/handlers/substrate.go @@ -13,6 +13,7 @@ import ( "github.com/kagent-dev/kagent/go/core/internal/httpserver/errors" "github.com/kagent-dev/kagent/go/core/pkg/auth" "github.com/kagent-dev/kagent/go/core/pkg/sandboxbackend/substrate" + "k8s.io/apimachinery/pkg/api/meta" utilvalidation "k8s.io/apimachinery/pkg/util/validation" "sigs.k8s.io/controller-runtime/pkg/client" ctrllog "sigs.k8s.io/controller-runtime/pkg/log" @@ -110,10 +111,16 @@ func (h *SubstrateHandler) listSubstrateCRs(ctx context.Context, namespace strin wpList := &atev1alpha1.WorkerPoolList{} if err := h.KubeClient.List(ctx, wpList, listOpts...); err != nil { + if meta.IsNoMatchError(err) { + return nil, nil, nil + } return nil, nil, err } tmplList := &atev1alpha1.ActorTemplateList{} if err := h.KubeClient.List(ctx, tmplList, listOpts...); err != nil { + if meta.IsNoMatchError(err) { + return nil, nil, nil + } return nil, nil, err }