Updated: December 1st, 2026
Built against: kagent 1.0.1, Agent Substrate 1.0.1, agentevals 0.15.1
Introduction#
An agent's turn on Agent Substrate passes through the kagent controller, Substrate's ingress gateway, the agent's own actor, and Substrate's egress gateway before it reaches a model or a tool. Each of those writes its own telemetry, and none of it is collected until you say where it goes.
This guide sends traces, metrics and logs from kagent and Agent Substrate through one OpenTelemetry Collector. Tempo stores the traces, Loki the logs, and kube-prometheus-stack runs Prometheus and Grafana. agentevals scores the agent runs and sends each score back through the Collector as a log event.
kagent controller + agents ─┐ ┌─> Tempo (traces)Substrate (api, controller, ├─> otel-collector ├─> Loki (logs)atelet, workers, │ (telemetry) ├─> Prometheus (metrics, scraped on :8889)router, egress) ─┘ ▲ └─> agentevals (agent turns only)│ │└── scores, as log events
What goes wrong without it#
Each of these is addressed by a step in this guide.
- Nothing is collected until you say where. The kagent chart ships
config.telemetry: {}and the Substrate chartotel.endpoint: "". Every component can export OTLP, and none does. - Substrate keeps one trace in a hundred. Its chart samples traces at
0.01by default, so most turns leave no Substrate spans at all. - A turn is spread across components. The controller, the gateways, Substrate's API and the agent runtime each record their own part. Without one pipeline that keeps the trace ID, following a slow turn means reading several logs side by side.
- Prometheus does not find Substrate's gateways. The ingress gateway carries a
prometheus.io/scrapeannotation, and kube-prometheus-stack ignores annotations. - A trace says what an agent did, not whether it was right. The same agent, asked the same thing twice, can call different tools and give different answers. Nothing in a trace scores that.
What you will build#
- One OpenTelemetry Collector that receives every signal from kagent and Agent Substrate
- Tempo for traces, Loki for logs, Prometheus for metrics, and Grafana with all three as data sources
- A turn-duration metric derived from each agent's
invoke_agentspan - Prometheus scraping Substrate's ingress and egress gateways, and the kagent controller
- agentevals receiving agent turns only, and scoring one session against another
- Every score in Loki, carrying the trace and span ID of the turn it scored
How this guide is organized#
Up and Running installs the stack, points Substrate and kagent at it, and ends with one turn found in every backend. Nothing else works until this does.
Observe reads that telemetry: one turn's trace from the controller to the model call, the metrics agents and the controller produce, and the traffic through Substrate's two gateways.
Evaluate generates sessions to compare, scores them in agentevals, and finds the scores next to the traces they belong to.
Validate sends one session through the whole pipeline and maps each result to the step that set it.
This guide starts from an existing install. It adds observability to a cluster that already runs kagent on Agent Substrate. It does not install either.
Version support#
This guide is pinned to one set, and every version and chart below is part of that set:
| Component | Version |
|---|---|
kagent (kagent chart) and the kagent CLI | 1.0.1 |
Agent Substrate (substrate chart) | 1.0.1 |
OpenTelemetry Collector (opentelemetry-collector chart) | chart 0.183.2, contrib image 0.165.0 |
Tempo (tempo chart) | chart 1.24.4 |
Loki (loki chart) | chart 7.7.0 |
Prometheus and Grafana (kube-prometheus-stack chart) | chart 94.2.2 |
agentevals (agentevals chart) | 0.15.1 |
The kagent and Substrate versions are the ones already installed; Step 1 checks them, and Steps 6 and 7 upgrade those releases in place at the same version. A chart version fixes the image tags it deploys. No image in this guide is pinned by digest.
Environment setup#
Run this first, in every new shell you paste this guide's blocks into:
if [ -n "${ZSH_VERSION:-}" ]; then setopt interactive_comments nobanghist; fiif [ -n "${BASH_VERSION:-}" ]; then set +H; fi
interactive_comments: an interactive zsh does not treat#as a comment unless this is set, so every comment line in a pasted block fails, and one containing<or>is a parse error.nobanghist(zsh) andset +H(bash): an interactive shell expands!inside double quotes as a history reference, which rewrites or rejects any line that contains one.
Then set these. Every command below uses them.
# Pinned versions. The platform this guide starts from; Step 1 checks it.export KAGENT_VERSION=1.0.1export SUBSTRATE_VERSION=1.0.1# The observability stack, Steps 2 to 4.export TEMPO_CHART_VERSION=1.24.4export LOKI_CHART_VERSION=7.7.0export KUBE_PROMETHEUS_STACK_CHART_VERSION=94.2.2export OTEL_COLLECTOR_CHART_VERSION=0.183.2# agentevals, Step 5.export AGENTEVALS_VERSION=0.15.1# The cluster. Every port-forward names this context, so a forward to another cluster is never touched.export KUBE_CONTEXT=${KUBE_CONTEXT:-$(kubectl config current-context)}# How far back the checks search Tempo, Loki and Prometheus, in seconds.export LOOKBACK=${LOOKBACK:-3600}# Local ports for the port-forwards.export KAGENT_API_PORT=${KAGENT_API_PORT:-8083}export KAGENT_UI_PORT=${KAGENT_UI_PORT:-8081}export AGENTEVALS_PORT=${AGENTEVALS_PORT:-8001}export GRAFANA_PORT=${GRAFANA_PORT:-3000}
What you need before you start#
| Requirement | Needed for | Notes |
|---|---|---|
| A cluster running kagent 1.0.1 on Agent Substrate 1.0.1 | Everything | With the default install names: the kagent and substrate Helm releases in kagent and ate-system, the kagent Harness, the kagent-tool-server RemoteMCPServer and the default-model-config ModelConfig. Step 1 checks each |
An OpenAI key in the default-model-config Secret, under OPENAI_API_KEY | Steps 5, 8 and 13 | The agents already use it. Step 5 copies it for the evaluator's judge. It needs access to the agents' model and to gpt-4o |
kubectl, helm, jq, curl, lsof | Everything | |
The kagent CLI at 1.0.1 | Steps 8, 13 and 16 | Older CLIs have no kagent agent command. Check with kagent version |
Permission to read Services through the API server (services/proxy) in telemetry and agentevals | The checks | The checks query Tempo, Loki, Prometheus and agentevals through the API server, so they need no port-forward |
Egress from the cluster to docker.io, quay.io, registry.k8s.io and ghcr.io | Steps 2 to 5 | Images |
Access from your machine to grafana.github.io, prometheus-community.github.io, open-telemetry.github.io and ghcr.io | Steps 2 to 7 | Helm charts |
Ports used in this guide#
| Port | What |
|---|---|
| 8083 | kagent controller API, port-forwarded from Step 8. The kagent CLI talks to it. KAGENT_API_PORT moves it. |
| 8081 | kagent UI, port-forwarded from Step 8. KAGENT_UI_PORT moves it. |
| 3000 | Grafana, port-forwarded in Step 12. GRAFANA_PORT moves it. |
| 8001 | agentevals UI, port-forwarded in Step 14. AGENTEVALS_PORT moves it. |
Every port-forward binds 127.0.0.1 only. kubectl port-forward binds localhost by default; the
--address 127.0.0.1 below makes it explicit so it is not changed by accident.
Port-forwards die. A port-forward is attached to one pod, and a rollout replaces the pod. The
symptom is connection refused right after a step that appeared to work. Define these now and
re-run forwards whenever something refuses to connect:
# forward <namespace> <target> <local port> <remote port>: open one port-forward to this cluster,# replacing an older one to the same target.forward() {local pf tries=0pkill -f "kubectl --context ${KUBE_CONTEXT} port-forward --address 127.0.0.1 -n $1 $2 " 2>/dev/null || truewhile lsof -nP -iTCP:"$3" -sTCP:LISTEN >/dev/null 2>&1 && [ "$tries" -lt 5 ]; do sleep 1; tries=$((tries + 1)); doneif lsof -nP -iTCP:"$3" -sTCP:LISTEN >/dev/null 2>&1; thenecho "forward: port $3 is held by something else, often a forward to another cluster; set a free port in the environment block" >&2return 1fikubectl --context "${KUBE_CONTEXT}" port-forward --address 127.0.0.1 -n "$1" "$2" "$3:$4" >/dev/null 2>&1 &pf=$!; tries=0while kill -0 "$pf" 2>/dev/null && [ "$tries" -lt 20 ]; doif curl -sS -o /dev/null --max-time 2 "http://127.0.0.1:$3/" 2>/dev/null; thenecho "forward up: $2 on 127.0.0.1:$3"; return 0fisleep 1; tries=$((tries + 1))doneecho "forward: $2 did not answer on 127.0.0.1:$3" >&2return 1}# forwards: the kagent controller and UI.forwards() {kubectl --context "${KUBE_CONTEXT}" rollout status deployment/kagent-controller -n kagent --timeout=120sforward kagent service/kagent-controller "${KAGENT_API_PORT}" 8083forward kagent service/kagent-ui "${KAGENT_UI_PORT}" 8080}# stop_forwards: close every port-forward this guide opened to this cluster.stop_forwards() {if pkill -f "kubectl --context ${KUBE_CONTEXT} port-forward "; thenecho "closed the port-forwards to ${KUBE_CONTEXT}"elseecho "no port-forwards open to ${KUBE_CONTEXT}"fi}
Every port-forward names this cluster's context, and forward closes only an older forward to the
same target, so a forward you have open to another cluster is never touched. forward waits until
the port answers, and reports a port that something else already holds rather than reading from it.
The checks in this guide do not use port-forwards. They read each backend through the API server with these helpers:
# svc_get <namespace> <service:port> <path and query>: GET from a Service through the API server.svc_get() { kubectl get --raw "/api/v1/namespaces/$1/services/$2/proxy$3"; }# urlenc <string>: percent-encode a query.urlenc() { jq -rn --arg v "$1" '$v | @uri'; }# prom <PromQL>: an instant query. One line per series: its labels, a tab, its value.prom() {svc_get telemetry kube-prometheus-stack-prometheus:9090 "/api/v1/query?query=$(urlenc "$1")" \| jq -r '.data.result[] | "\(.metric | del(.__name__) | to_entries | map("\(.key)=\(.value)") | join(" "))\t\(.value[1])"'}# tempo <TraceQL> [limit]: the search response for traces from the last LOOKBACK seconds.tempo() {local now; now=$(date +%s)svc_get telemetry tempo:3200 "/api/search?q=$(urlenc "$1")&limit=${2:-20}&start=$((now - LOOKBACK))&end=${now}"}# loki <LogQL> [limit]: the query response for log entries from the last LOOKBACK seconds.loki() {local now; now=$(date +%s)svc_get telemetry loki:3100 "/loki/api/v1/query_range?query=$(urlenc "$1")&limit=${2:-20}&start=$((now - LOOKBACK))000000000&end=${now}000000000"}# trace_spans <trace id>: every span of a trace, oldest first: service, span name, duration.# Leaves out the TaskStore span kagent writes for each streamed chunk.trace_spans() {svc_get telemetry tempo:3200 "/api/traces/$1" \| jq -r '.batches[] | (.resource.attributes[] | select(.key == "service.name") | .value.stringValue) as $svc| .scopeSpans[].spans[] | select(.name | test("TaskStoreService") | not)| [(.startTimeUnixNano | tonumber), $svc, .name, ((((.endTimeUnixNano | tonumber) - (.startTimeUnixNano | tonumber)) / 1e6 | floor | tostring) + " ms")] | @tsv' \| sort -n | cut -f2-}# kagent_cli <arguments>: the kagent CLI, pointed at this guide's port-forward to the controller.kagent_cli() {kagent --api-url "http://127.0.0.1:${KAGENT_API_PORT}" --gateway-url "http://127.0.0.1:${KAGENT_API_PORT}" "$@"}
UP AND RUNNING#
Before you can read a trace or score a run, every component has to export to one place and that place has to store it.
If something breaks later, come back here and confirm this still works before changing anything else.
What you are going to do: check the platform you are starting from, install Tempo, Loki, Prometheus and Grafana, install the Collector that feeds them, install agentevals, point Substrate and kagent at the Collector, and find one agent turn in every backend.
What you will have that you did not have before: traces, metrics and logs from the kagent controller, every agent, and every Substrate component in one place, joined by trace ID.
Step 1: Check the platform you are starting from#
This guide upgrades the kagent and substrate Helm releases in place and uses resources the
kagent install created. Confirm they are there, at the versions this guide pins:
helm list -n kagent -o json | jq -r '.[] | "\(.namespace)\t\(.chart)\t\(.status)"'helm list -n ate-system -o json | jq -r '.[] | "\(.namespace)\t\(.chart)\t\(.status)"'kubectl get workerpool,harness,modelconfig,remotemcpserver -n kagentecho "model key Secret holds: $(kubectl get secret default-model-config -n kagent -o json | jq -r '.data | keys | join(", ")')"echo "kagent CLI: $(kagent version | jq -r .kagent_version)"
You need kagent-1.0.1 and substrate-1.0.1, both deployed; a WorkerPool that is ready; the
kagent Harness; the default-model-config ModelConfig; the kagent-tool-server RemoteMCPServer,
accepted; OPENAI_API_KEY in the Secret; and a CLI at 1.0.1. The Secret line prints the names of
its keys, never a value.
Step 2: Install Tempo and Loki#
Everything this guide installs for storage and display goes in one namespace:
kubectl get namespace telemetry >/dev/null 2>&1 || kubectl create namespace telemetry
Tempo stores traces. It receives OTLP from the Collector on 4317 and serves its query API on 3200:
helm upgrade --install tempo tempo \--repo https://grafana.github.io/helm-charts \--version ${TEMPO_CHART_VERSION} \--namespace telemetry \--wait \-f - <<'EOF'persistence:enabled: falsetempo:receivers:otlp:protocols:grpc:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318EOF
Loki stores logs. This runs it as a single binary on a 2Gi volume, with every other deployment mode scaled to zero, and with structured metadata allowed: the Collector delivers each log record's attributes that way, and the queries in Observe filter on them.
helm upgrade --install loki loki \--repo https://grafana.github.io/helm-charts \--version ${LOKI_CHART_VERSION} \--namespace telemetry \--wait \-f - <<'EOF'backend:replicas: 0bloomCompactor:replicas: 0bloomGateway:replicas: 0chunksCache:enabled: falsecompactor:replicas: 0deploymentMode: SingleBinarydistributor:replicas: 0gateway:enabled: falseindexGateway:replicas: 0ingester:replicas: 0limits_config:allow_structured_metadata: trueloki:auth_enabled: falsecommonConfig:replication_factor: 1schemaConfig:configs:- from: "2024-04-01"index:period: 24hprefix: loki_index_object_store: filesystemschema: v13store: tsdbstorage:type: filesystemlokiCanary:enabled: falsememberlist:service:publishNotReadyAddresses: trueminio:enabled: falsemonitoring:selfMonitoring:enabled: falsegrafanaAgent:installOperator: falsequerier:replicas: 0queryFrontend:replicas: 0queryScheduler:replicas: 0read:replicas: 0resultsCache:enabled: falsesingleBinary:persistence:enabled: truesize: 2Gireplicas: 1test:enabled: falsewrite:replicas: 0EOF
Check that both answer:
kubectl rollout status statefulset/tempo -n telemetry --timeout=300skubectl rollout status statefulset/loki -n telemetry --timeout=300secho "tempo: $(svc_get telemetry tempo:3200 /ready)"echo "loki: $(svc_get telemetry loki:3100 /ready)"
Both lines end in ready. Tempo keeps traces on the pod's own disk (persistence.enabled: false),
so they are gone when the pod restarts. Before production covers it.
Step 3: Install Prometheus and Grafana#
kube-prometheus-stack runs the Prometheus Operator, Prometheus and Grafana. Install it before any ServiceMonitor or PodMonitor, because it provides those CRDs.
helm upgrade --install kube-prometheus-stack kube-prometheus-stack \--repo https://prometheus-community.github.io/helm-charts \--version ${KUBE_PROMETHEUS_STACK_CHART_VERSION} \--namespace telemetry \--wait \-f - <<'EOF'alertmanager:enabled: falsegrafana:additionalDataSources:- name: Tempotype: tempouid: tempo# Tempo's HTTP API listens on 3200. Loki's is 3100.url: http://tempo.telemetry.svc.cluster.local:3200- name: Lokitype: lokiuid: lokiurl: http://loki.telemetry.svc.cluster.local:3100nodeExporter:enabled: falseprometheus:prometheusSpec:podMonitorSelectorNilUsesHelmValues: falseserviceMonitorSelectorNilUsesHelmValues: falseEOF
The two SelectorNilUsesHelmValues: false settings make Prometheus pick up every ServiceMonitor and
PodMonitor in the cluster, not only the ones this chart labels as its own. Steps 4, 6 and 7 each add
one.
The Tempo data source uses port 3200. The Tempo Service has no port 3100; that is Loki's. With 3100 the data source is created without complaint and every trace query in Grafana fails.
Check the CRDs arrived and Prometheus answers:
kubectl get crd servicemonitors.monitoring.coreos.com podmonitors.monitoring.coreos.com -o nameecho "prometheus: $(svc_get telemetry kube-prometheus-stack-prometheus:9090 /-/ready)"
Step 4: Install the OpenTelemetry Collector#
The Collector is the one address every component exports to: OTLP over gRPC on 4317 and over HTTP on 4318. It runs five pipelines:
| Pipeline | From | To | What it changes |
|---|---|---|---|
traces | OTLP | Tempo, and the signal_to_metrics connector | Deletes the GenAI request and usage attributes from some runtime spans (Attachment A.3) |
metrics | OTLP, and the connector | A Prometheus endpoint on 8889 | Converts delta metrics to cumulative |
logs | OTLP | Loki | Nothing |
traces/agentevals | OTLP | agentevals | Keeps agent runtime spans only, and drops TaskStore spans |
logs/agentevals | OTLP | agentevals | Keeps agent runtime logs only |
The connector turns every invoke_agent span into a sample of a histogram,
gen_ai.invoke_agent.duration, so a turn's duration is a metric as well as a span. Attachment A
explains each processor.
The heredoc is quoted (<<'EOF'), so the shell passes the configuration through untouched:
helm upgrade --install otel-collector opentelemetry-collector \--repo https://open-telemetry.github.io/opentelemetry-helm-charts \--version ${OTEL_COLLECTOR_CHART_VERSION} \--namespace telemetry \--wait \-f - <<'EOF'config:connectors:signal_to_metrics:spans:- attributes:- key: gen_ai.agent.nameoptional: true- key: gen_ai.request.modeloptional: true- key: error.typeoptional: trueconditions:- span.attributes["gen_ai.operation.name"] == "invoke_agent" and instrumentation_scope.name!= "github.com/kagent-dev/kagent/go/adk/pkg/a2a/server" and instrumentation_scope.name!= "kagent.core.a2a"description: The duration of one agent invocation, derived from its span.histogram:buckets:- 0.5- 1- 2- 5- 10- 30- 60- 120- 300value: Seconds(span.end_time - span.start_time)include_resource_attributes:- key: service.name- key: service.namespaceoptional: true- key: service.versionoptional: true- key: kagent.runtimeoptional: true- key: gen_ai.main_agent.idoptional: truename: gen_ai.invoke_agent.durationunit: sexporters:otlp_grpc/tempo:endpoint: tempo.telemetry.svc.cluster.local:4317tls:insecure: trueotlp_http/loki:endpoint: http://loki.telemetry.svc.cluster.local:3100/otlpotlp_http/agentevals:endpoint: http://agentevals.agentevals.svc.cluster.local:4318prometheus:endpoint: 0.0.0.0:8889# The default (5m) drops a series five minutes after its last update, so each# burst of agent turns starts a new series and rate()/increase() miss turns.metric_expiration: 60mresource_to_telemetry_conversion:enabled: trueprocessors:batch: {}delta_to_cumulative: {}# agentevals groups spans into sessions by gen_ai.conversation.id and falls back# to the trace ID. Forward only agent runtime telemetry, so Substrate,# agentgateway and controller background traces don't show up as sessions.filter/agent_runtimes_only:error_mode: ignoretraces:span:- resource.attributes["kagent.runtime"] == nillogs:log_record:- resource.attributes["kagent.runtime"] == nil# kagent writes a TaskStore RPC span per streamed chunk. agentevals keeps only# the first 10,000 spans of a trace, so a long turn could lose its invoke_agent span.filter/kagent_taskstore:error_mode: ignoretraces:span:- IsMatch(span.attributes["rpc.method"], "^kagent\\.runtime\\.v1\\.TaskStoreService/")- IsMatch(span.name, "^kagent\\.runtime\\.v1\\.TaskStoreService/")transform/harness_native_genai:error_mode: ignoretrace_statements:- conditions:- resource.attributes["kagent.genai.producer"] == "runtime" and not span.attributes["llm_request.context"]== "standalone"context: spanstatements:- delete_matching_keys(span.attributes, "^gen_ai\\.(operation\\.name|system|request\\.model|response\\.finish_reasons|usage\\..*)$")receivers:otlp:protocols:grpc:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318service:pipelines:logs:exporters:- otlp_http/lokiprocessors:- batchreceivers:- otlpmetrics:exporters:- prometheusprocessors:- delta_to_cumulative- batchreceivers:- otlp- signal_to_metricstraces:exporters:- signal_to_metrics- otlp_grpc/tempoprocessors:- transform/harness_native_genai- batchreceivers:- otlp# Agent turns for agentevals to score. agentevals sends its scores back# as logs, which the logs pipeline above delivers to Loki.traces/agentevals:exporters:- otlp_http/agentevalsprocessors:- filter/agent_runtimes_only- filter/kagent_taskstore- batchreceivers:- otlplogs/agentevals:exporters:- otlp_http/agentevalsprocessors:- filter/agent_runtimes_only- batchreceivers:- otlpfullnameOverride: otel-collectorimage:repository: otel/opentelemetry-collector-contribmode: deploymentports:metrics-export:containerPort: 8889enabled: trueprotocol: TCPservicePort: 8889EOF
The regular expressions need doubled backslashes (\\.). With a single backslash the Collector fails to parse its configuration and crash-loops, and nothing reaches any backend. An unquoted heredoc (<<EOF) halves them on the way in, which is why this one is quoted. If you move these values to a file, keep them doubled.
Let Prometheus scrape the metrics the Collector serves on 8889, the port named metrics-export
above:
kubectl apply -f- <<'EOF'apiVersion: monitoring.coreos.com/v1kind: ServiceMonitormetadata:name: otel-collectornamespace: telemetryspec:endpoints:- interval: 15sport: metrics-exportselector:matchLabels:app.kubernetes.io/instance: otel-collectorEOF
Check the Collector started and Prometheus has found it. A new target takes up to a minute to appear, so the block waits for it:
kubectl rollout status deployment/otel-collector -n telemetry --timeout=300sfor i in $(seq 1 24); do[ -n "$(prom 'up{job="otel-collector"} == 1')" ] && breaksleep 5doneprom 'up{job="otel-collector"}'
One line ending in 1. A Collector that restarts in a loop here is the backslash warning above;
kubectl logs deployment/otel-collector -n telemetry --previous names the line it could not parse.
The Collector logs export errors for otlp_http/agentevals until Step 5. Its two agentevals pipelines send to a Service that does not exist yet. The other three pipelines are unaffected.
Step 5: Install agentevals#
agentevals receives agent turns from the Collector, groups them into sessions, and scores one
session against another. Its values turn on evaluation events and send them to the Collector over
OTLP HTTP, so each score lands in Loki as a gen_ai.evaluation.result event that carries the trace
and span ID of the turn it scored.
The LLM-backed metrics (final_response_match_v2, hallucinations_v1 and the rubric_based_*
metrics) need a key for the judge model. agentevals reads OPENAI_API_KEY, ANTHROPIC_API_KEY or
GOOGLE_API_KEY from its environment, here from a Secret named agentevals-judge. This copies the
OpenAI key the agents already use, from one Secret to the other over stdin, without printing it.
Create the Secret before installing, or the pod does not start:
kubectl get namespace agentevals >/dev/null 2>&1 || kubectl create namespace agentevalskubectl delete secret agentevals-judge -n agentevals --ignore-not-foundkubectl get secret default-model-config -n kagent -o jsonpath='{.data.OPENAI_API_KEY}' | base64 --decode \| kubectl create secret generic agentevals-judge -n agentevals --from-file=OPENAI_API_KEY=/dev/stdinecho "judge key: $(kubectl get secret agentevals-judge -n agentevals -o jsonpath='{.data.OPENAI_API_KEY}' | base64 --decode | wc -c | tr -d ' ') bytes"
The last line prints the key's length. 0 bytes means default-model-config has no
OPENAI_API_KEY: the Secret was still created, empty, and the judge will fail when a metric needs it.
helm upgrade --install agentevals oci://ghcr.io/agentevals-dev/agentevals/helm/agentevals \--version ${AGENTEVALS_VERSION} \--namespace agentevals \--wait \-f - <<'EOF'# Send evaluation results to the Collector as gen_ai.evaluation.result log events,# so scores land in Loki next to the agent traces in Tempo.env:- name: AGENTEVALS_EVALUATION_EVENTSvalue: "true"- name: OTEL_EXPORTER_OTLP_ENDPOINTvalue: http://otel-collector.telemetry.svc.cluster.local:4318- name: OTEL_SERVICE_NAMEvalue: agentevals# Key for the LLM judge (OPENAI_API_KEY), used by the LLM-backed metrics such as# final_response_match_v2.envFrom:- secretRef:name: agentevals-judgeEOF
Check it is up and has found the judge's key:
kubectl rollout status deployment/agentevals -n agentevals --timeout=300ssvc_get agentevals agentevals:8001 /api/config | jq -c '.data'
"openai":true under apiKeys, and the OTLP ports the Collector sends to. The Collector's export
errors from Step 4 stop here.
The Collector forwards only telemetry from agent runtimes, the resources that carry a
kagent.runtime attribute. agentevals turns any trace without a conversation ID into a session of
its own, so Substrate, gateway and controller traces would otherwise fill its session list.
Step 6: Point Substrate at the Collector#
One otel.endpoint sends ate-api-server, ate-controller, atelet, the workers and both
gateways to the Collector. samplingRatio: "1.0" keeps every trace instead of one in a hundred.
The upgrade also enables the GoldenEgressPolicy preview gate. kagent 1.0.0-rc3 and later set a
golden egress policy on every ActorTemplate. Without the gate, Substrate rejects them and Agents
show Ready=False with reason ActorTemplateRejected.
--reuse-values keeps everything your install set, so the block carries only what it adds:
helm upgrade substrate oci://ghcr.io/kagent-dev/substrate/helm/substrate \--version ${SUBSTRATE_VERSION} \--namespace ate-system \--reuse-values \--wait --timeout 10m \-f - <<'EOF'otel:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317traces:samplingRatio: "1.0"# kagent rc3 and later set goldenEgressPolicy on every ActorTemplate it compiles.# Without the GoldenEgressPolicy gate, Substrate rejects those templates and# Agents report ActorTemplateRejected (InvalidArgument).preview:- PerTemplateSnapshotLocation- GoldenEgressPolicyEOF
preview is a list, and Helm replaces a list whole. If your release already enables a preview gate that is not in the block, it is turned off. Check with helm get values substrate -n ate-system first, and add any gate you find to the list.
Substrate runs two agentgateway instances in ate-system, and both serve Prometheus metrics on
:15020/metrics:
atenet-routeris the ingress. It routes traffic from the kagent controller to actors and wakes suspended actors. Its metrics port is namedgw-metrics.atenet-egressis the egress. It intercepts every outbound call an actor makes, such as model APIs and MCP servers. Its metrics port is namedstats.
The router carries a prometheus.io/scrape annotation, which kube-prometheus-stack ignores, so a
PodMonitor is required. Each pod has only one of the two port names, so each pod is scraped once.
No network change is needed: Substrate's ate-system-observability NetworkPolicy already allows
ingress on both port names.
kubectl apply -f- <<'EOF'apiVersion: monitoring.coreos.com/v1kind: PodMonitormetadata:name: agentgatewaynamespace: telemetryspec:namespaceSelector:matchNames:- ate-systemselector:matchExpressions:- key: appoperator: Invalues:- atenet-router- atenet-egresspodMetricsEndpoints:# Each pod only exposes one of these port names, so each pod is scraped once.- port: gw-metricspath: /metricsinterval: 15s- port: statspath: /metricsinterval: 15sEOF
Check the release holds the telemetry settings, and that Prometheus has found both gateways:
helm get values substrate -n ate-system -o json | jq -c '{otel, preview}'for i in $(seq 1 24); do[ "$(prom 'count(up{job="telemetry/agentgateway"} == 1)' | cut -f2)" = 2 ] && breaksleep 5doneprom 'up{job="telemetry/agentgateway"}'
Two lines ending in 1, one for an atenet-router pod and one for an atenet-egress pod.
Step 7: Point kagent at the Collector#
config.telemetry covers the kagent controller, and config.runtimeDefaults.telemetry covers the
agents. captureContent puts prompts, responses and tool arguments on spans. agentevals needs that
to score responses.
controller.metrics exposes the controller's own Prometheus endpoint and creates a ServiceMonitor
for it. The endpoint is served securely, so the scrape is authorized only once the controller's
metrics-reader role is bound to the ServiceAccount Prometheus runs as; naming that ServiceAccount
makes the chart render the binding. Step 10 reads a metric that comes only from this endpoint.
--reuse-values keeps everything the install set:
helm upgrade kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \--version ${KAGENT_VERSION} \--namespace kagent \--reuse-values \--wait \-f - <<'EOF'config:telemetry:traces:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317metrics:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317logs:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317runtimeDefaults:telemetry:captureContent: truetraces:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317metrics:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317logs:endpoint: http://otel-collector.telemetry.svc.cluster.local:4317controller:metrics:enabled: trueserviceMonitor:enabled: trueprometheusServiceAccount:name: kube-prometheus-stack-prometheusnamespace: telemetryEOF
With captureContent on, every prompt, response and tool argument is stored in Tempo and sent to agentevals. Anyone who can query either can read them. Do not put sensitive data through agents on this cluster.
If you changed the model API key in the kagent UI, this upgrade can conflict with the chart's default-model-config. Attachment C.6 has the fix.
Check the controller's configuration and its scrape target:
kubectl rollout status deployment/kagent-controller -n kagent --timeout=300skubectl get configmap kagent-controller -n kagent -o jsonpath='{.data.controller\.yaml}' | grep -c 'otel-collector.telemetry.svc.cluster.local:4317'for i in $(seq 1 24); do[ -n "$(prom 'up{job="kagent-controller-metrics"} == 1')" ] && breaksleep 5doneprom 'up{job="kagent-controller-metrics"}'
6 endpoints in the controller's configuration, three for the controller and three for the agent
runtimes, and one scrape target ending in 1.
Step 8: Verify the first turn in every backend#
The checks talk to one agent, smoke-agent: the default model, read-only Kubernetes tools from
kagent-tool-server, and the kagent Harness. An Agent of that name that already exists is updated
to this definition:
kubectl apply -f- <<'EOF'apiVersion: api.kagent.dev/v1alpha3kind: Agentmetadata:name: smoke-agentnamespace: kagentspec:harnessRef:name: kagenttemplate:inline:description: Smoke-test agent for verifying the kagent + Substrate installmodelConfig:name: default-model-configsystemPrompt: You are a concise assistant. Answer in one sentence.tools:- mcp:server:kind: RemoteMCPServername: kagent-tool-servertools:- k8s_get_resources- k8s_describe_resource- k8s_get_events- k8s_get_pod_logsEOFkubectl wait agent/smoke-agent -n kagent --for=condition=Ready --timeout=300s
kagent bakes telemetry settings into each agent revision. An agent that existed before Step 7 keeps running its old revision until the new one is ready, and a chat that was already open stays on the revision it started with. Wait until each Agent's desired and latest revisions match, and use a new session after that:
for i in $(seq 1 60); do[ "$(kubectl get agent smoke-agent -n kagent -o jsonpath='{.status.desiredRevision}')" = "$(kubectl get agent smoke-agent -n kagent -o jsonpath='{.status.latestSuccessfulRevision}')" ] && breaksleep 5donekubectl get agents -n kagent \-o custom-columns='NAME:.metadata.name,READY:.status.conditions[?(@.type=="Ready")].status,DESIRED:.status.desiredRevision,LATEST:.status.latestSuccessfulRevision'
READY is True, and DESIRED equals LATEST on every line.
Bring the forwards up, so the kagent CLI can reach the controller:
forwards
Create a session and send one message that needs a tool. The CLI acts as admin@kagent.dev in the
kagent namespace by default:
export FIRST_SESSION=$(kagent_cli agent session create --agent smoke-agent -o json | jq -r .session.id): "${FIRST_SESSION:?is empty: the controller returned no session. Run forwards and try again.}" && {echo "session: ${FIRST_SESSION}"kagent_cli agent invoke --session "$FIRST_SESSION" \-t "Use your tools to list the namespaces in this cluster, then tell me how many pods are running in the kagent namespace. Answer in two short sentences."}
An answer alone does not prove the telemetry arrived. The session's ID is on every span the agent
writes, as gen_ai.conversation.id, and Substrate names the session's actor after it, so look for
that ID in each backend. The Collector batches for a few seconds, so the block waits for the trace
first:
: "${FIRST_SESSION:?is empty: run step-8-first-turn in this shell first}" && {TURN_QUERY="{resource.service.name=\"smoke-agent\" && name=~\"invoke_agent.*\" && span.gen_ai.conversation.id=\"${FIRST_SESSION}\"}"for i in $(seq 1 24); do[ -n "$(tempo "$TURN_QUERY" | jq -r '.traces[0].traceID // empty')" ] && breaksleep 5doneecho "-- Tempo: the turn's trace"tempo "$TURN_QUERY" | jq -r '.traces[] | "\(.traceID)\t\(.rootServiceName)\t\(.rootTraceName)\t\(.durationMs) ms"'echo "-- Prometheus: turns counted from invoke_agent spans"prom "sum by (service_name, gen_ai_agent_name) (last_over_time(gen_ai_invoke_agent_duration_seconds_count[${LOOKBACK}s]))"echo "-- Loki: the ingress gateway's access log for this session's actor"loki "{service_name=\"agentgateway\"} | ate_actor_name=\"session-${FIRST_SESSION}\"" \| jq -r '.data.result[].stream | "\(.route)\t\(.http_response_status_code)\t\(.duration)\tresume=\(.ate_router_resume)\ttrace=\(.trace_id)"'echo "-- agentevals: the session"svc_get agentevals agentevals:8001 /api/streaming/sessions \| jq -c --arg s "$FIRST_SESSION" '.data[] | select(.sessionId == $s) | {sessionId, spanCount, isComplete}'}
| Line | What it shows |
|---|---|
| Tempo | One trace whose root is the kagent controller's A2A request. The agent's invoke_agent span is inside it |
| Prometheus | A count for smoke-agent: the Collector's connector made a metric sample from the span |
| Loki | The request the controller sent through atenet-router, with status 200, whether it had to resume the actor, and the same trace ID as the Tempo line |
| agentevals | The session, with its span count. isComplete turns true a few seconds after the last answer |
What you now have: every component exporting to one Collector, three backends holding what it sends, and one turn found in all of them by its session ID. What you have not done yet is read any of it. Observe does that.
OBSERVE#
Up and Running proved the telemetry arrives. This section reads it, so that when a turn is slow or wrong you know which backend answers which question.
What you are going to do: follow one turn's trace from the controller to the model call, read the metrics agents and the controller produce, look at the traffic through Substrate's two gateways, and open the same data in Grafana.
What you will have that you did not have before: the queries that find a turn, a metric or a gateway request, and a picture of which component sends which signal.
| Component | Sends |
|---|---|
| kagent controller | Traces, metrics, logs |
Agents (kagent runtimes such as smoke-agent) | Traces (invoke_agent, one span per model call, execute_tool), metrics, logs |
Substrate (ate-api-server, ate-controller, atelet, workers) | Traces, metrics, logs |
| agentgateway router and egress | Traces, access logs, and metrics scraped directly |
| agentevals | Logs (the gen_ai.evaluation.result score events) |
Step 9: Read a turn's trace#
Find the first session's trace and list its spans, oldest first:
: "${FIRST_SESSION:?is empty: run step-8-first-turn in this shell first}" && {export FIRST_TRACE=$(tempo "{resource.service.name=\"smoke-agent\" && name=~\"invoke_agent.*\" && span.gen_ai.conversation.id=\"${FIRST_SESSION}\"}" \| jq -r '.traces | sort_by(.startTimeUnixNano | tonumber) | last | .traceID')echo "trace: ${FIRST_TRACE}"trace_spans "$FIRST_TRACE" | grep -v $'\t0 ms$'}
The grep leaves out spans shorter than a millisecond, which are mostly Substrate's authorization
and database calls. A turn reads top to bottom:
| Service | Spans | What happened |
|---|---|---|
kagent-controller | The A2A request | The message entered through the controller |
agentgateway | The same request, and ResumeActor | The ingress gateway routed it to the session's actor, and woke the actor first if it was suspended |
ateapi, atelet, the worker | ResumeActor, Restore, RestoreWorkload | Substrate placed the actor on a worker and restored it from its snapshot |
The agent (smoke-agent) | invoke_agent | The agent's turn |
| The agent | One span per model call | The model and its token counts |
| The agent | execute_tool | Each tool call to kagent-tool-server |
The Substrate rows appear only when the actor had to be resumed, which is every turn that starts from a suspended session.
Step 10: Agent and controller metrics#
Metrics reach Prometheus two ways. Everything that exports OTLP goes through the Collector, which
serves it on port 8889 with each resource's attributes as labels, service_name among them. The
kagent controller and the two gateways are also scraped directly.
See which services send metrics through the Collector:
prom 'count by (service_name) ({job="otel-collector"})'
The turn-duration histogram the Collector derives from invoke_agent spans:
prom "sum by (service_name, kagent_runtime) (last_over_time(gen_ai_invoke_agent_duration_seconds_count[${LOOKBACK}s]))"prom "sum by (service_name) (last_over_time(gen_ai_invoke_agent_duration_seconds_sum[${LOOKBACK}s]))"
The first line counts turns per agent and the second sums their seconds, so the second divided by
the first is the mean turn. last_over_time is there because an idle agent's series leaves the
Collector's endpoint an hour after its last turn (metric_expiration: 60m), and an instant query
looks back only five minutes.
And a metric that comes only from the controller's own endpoint, through the ServiceMonitor Step 7 created:
prom 'count by (job) (kagent_runtime_revision_gc_duration_seconds_bucket)'
One line, for the job kagent-controller-metrics.
Step 11: Substrate's gateways#
Every message to an agent enters through atenet-router, and every call an agent makes leaves
through atenet-egress. The PodMonitor from Step 6 scrapes both:
prom 'sum by (pod, route, status) (agentgateway_requests_total)'
One line for each gateway pod, route and status. The metrics worth knowing:
| Metric | What it measures |
|---|---|
agentgateway_requests_total | Requests, by route and status |
agentgateway_request_duration_seconds | The whole request |
agentgateway_upstream_call_duration_seconds | The gateway's own call to the destination |
agentgateway_atenet_router_route_duration_seconds | Router only: the time to route a request to an actor, including waking it |
The gateways' access logs go through the Collector to Loki, one record per request, with the request's fields as structured metadata:
loki '{service_name="agentgateway"}' 10 \| jq -r '.data.result[].stream | "\(.route)\t\(.http_response_status_code)\t\(.duration)\tactor=\(.ate_actor_name // "-")\ttrace=\(.trace_id)"'
Each line carries the trace ID of the turn it belongs to, which is how a gateway log line leads back to an agent's trace in Step 9.
Step 12: Open Grafana#
The same data is in Grafana, which has Prometheus, Tempo and Loki as data sources from Step 3. Forward it:
forward telemetry service/kube-prometheus-stack-grafana "${GRAFANA_PORT}" 80
Open http://localhost:3000 (or your GRAFANA_PORT). The login is admin, and the password is in
the chart's Secret. To copy it without displaying it, on macOS:
kubectl get secret kube-prometheus-stack-grafana -n telemetry -o jsonpath='{.data.admin-password}' | base64 --decode | pbcopy
Agent traces.
- Go to Explore.
- Choose the Tempo data source.
- Switch the query type to TraceQL.
- Run this to find the agent turns, and open a trace:
{resource.service.name="smoke-agent" && name=~"invoke_agent.*"}
Metrics.
- Choose the Prometheus data source.
- Look up
kagent_runtime_revision_gc_duration_seconds_bucket, or any metric from Steps 10 and 11.
Gateway logs.
- Choose the Loki data source.
- Switch the query editor, on the right side, from Builder to Code.
- Run:
{service_name="agentgateway"}
The browser half is not part of the scripted run.
What you now have: a turn followed from the controller through Substrate to the model and its tools, the metrics behind it, and the gateways' own record of the traffic, each joined to the others by trace ID. None of it says whether the agent's answer was any good. Evaluate does that.
EVALUATE#
Observe showed what an agent did. This section scores it: agentevals takes one session as the reference, the golden run, and measures other sessions against it.
What you are going to do: generate sessions that can be compared, score them in agentevals, and find the scores in Loki beside the traces they belong to.
What you will have that you did not have before: a measure of how much one agent varies from run to run, stored with the telemetry of the turns it measured.
Step 13: Generate sessions to compare#
Each run below creates a new session and sends it the same two messages. Every session shows up in
agentevals as one conversation with two turns: the Collector forwards every span from a kagent agent
runtime, and agentevals groups them by gen_ai.conversation.id, which is the kagent session ID.
forwardsAGENTS=(smoke-agent)RUNS=2for agent in "${AGENTS[@]}"; dofor run in $(seq 1 "$RUNS"); dosession=$(kagent_cli agent session create --agent "$agent" -o json | jq -r .session.id)echo "== $agent run $run ($session)"kagent_cli agent invoke --session "$session" \-t "Use your tools to list the namespaces in this cluster, then tell me how many pods are running in the kagent namespace. Answer in two short sentences."kagent_cli agent invoke --session "$session" \-t "Now use your tools to list the services in the agentevals namespace. One sentence."donedone
Add -S to kagent agent invoke to stream the answers.
Check that agentevals received the sessions. Each one is marked complete a few seconds after its last answer:
svc_get agentevals agentevals:8001 /api/streaming/sessions \| jq -c '.data[] | {sessionId, spanCount, isComplete}'
From the UI instead. The kagent UI creates sessions through the same controller API as the CLI, so each UI chat shows up in agentevals as one session, the same way.
- Open
http://localhost:8081(or yourKAGENT_UI_PORT) and selectsmoke-agent. - Start a New chat. The UI also calls it New conversation in a few places. Both create a new session.
- Send both prompts in that one chat. One chat with two messages is one agentevals session with two turns.
- For a second session to compare, start another New chat and send the same two prompts again.
Step 14: Score the sessions#
Forward the agentevals UI:
forward agentevals service/agentevals "${AGENTEVALS_PORT}" 8001
- Open
http://localhost:8001(or yourAGENTEVALS_PORT). - Click Local Development. Each session is one card with two turns.
- On a
smoke-agentsession card, click Set as EvalSet. That session is now the golden run. - Click Continue to Evaluation.
- Under Evaluation Settings, set Judge Model to
openai/gpt-4o. - Select the metrics and click Run Evaluation:
| Metric | What it checks |
|---|---|
tool_trajectory_avg_score | That each turn called the same tools with the same arguments. Set the match type to ANY_ORDER if the order does not matter |
response_match_score | Each answer against the golden one, by ROUGE-1 text overlap |
final_response_match_v2 | Whether the judge model finds each answer means the same as the golden one, so different wording of the same answer still passes. It needs the judge key from Step 5 |
- Click another
smoke-agentsession in the results to compare its expected and actual tool calls turn by turn. It shows how much the same agent varies from run to run.
Attachment B runs the same comparison across two agents on different models.
Step 15: Find the scores beside the traces#
agentevals sends every score to the Collector as a gen_ai.evaluation.result log event, and the
Collector's logs pipeline delivers it to Loki. Each event carries the metric, the score, the
session, and the trace and span ID of the turn it scored:
loki '{service_name="agentevals"} | gen_ai_evaluation_name != ""' 50 \| jq -r '.data.result[].stream | "\(.gen_ai_evaluation_name)\t\(.gen_ai_evaluation_score_value)\t\(.gen_ai_evaluation_score_label // "-")\tsession=\(.gen_ai_conversation_id)\ttrace=\(.trace_id)"'
One line per metric and turn scored. Before you run an evaluation in Step 14 this prints nothing.
Pass a line's trace ID to trace_spans from Step 9, or paste it into Grafana's Tempo data source,
to open the turn that score belongs to.
What you now have: sessions scored against a golden run, and every score stored with the telemetry of the turn it measured.
VALIDATE#
Everything above was checked one piece at a time. This section sends one new session through the whole pipeline and checks each result against the step that set it up. If something breaks later, this is the section to run first.
What you are going to do: check the three scrape targets, run one session that calls the model and a tool, then look for that session in Tempo, Prometheus, Loki and agentevals.
What you will have that you did not have before: one pass that tells you whether the pipeline still does what each step said it would, and which step to go back to when it does not.
Step 16: Drive one session through every signal#
record prints one check: the step that set it up, what was checked, what was observed, and whether
that matches what the step said. It also keeps the line for Step 17:
# record <step> <what was checked> <observed> <expected: an extended regular expression>record() {local result=FAILprintf '%s' "$3" | grep -qE -- "$4" && result=PASSVALIDATE_RESULTS="${VALIDATE_RESULTS:-}${result}|$1|$2|$3"$'\n'printf '%-4s %-12s %s: %s\n' "$result" "$1" "$2" "$3"}
What Prometheus scrapes. The Collector, both gateways and the controller:
VALIDATE_RESULTS=""record "Step 4" "Collector scrape targets up" "$(prom 'count(up{job="otel-collector"} == 1)' | cut -f2)" '^[1-9]'record "Step 6" "Gateway scrape targets up" "$(prom 'count(up{job="telemetry/agentgateway"} == 1)' | cut -f2)" '^2$'record "Step 7" "Controller scrape targets up" "$(prom 'count(up{job="kagent-controller-metrics"} == 1)' | cut -f2)" '^[1-9]'
The session. One turn that needs both the model and a tool, then a wait for its trace:
forwards >/dev/nullexport VALIDATE_SESSION=$(kagent_cli agent session create --agent smoke-agent -o json | jq -r .session.id)kagent_cli agent invoke --session "$VALIDATE_SESSION" \-t "Use your tools to count the pods in the kagent namespace. One sentence." >/dev/nullVALIDATE_QUERY="{resource.service.name=\"smoke-agent\" && name=~\"invoke_agent.*\" && span.gen_ai.conversation.id=\"${VALIDATE_SESSION}\"}"for i in $(seq 1 24); doVALIDATE_TRACE=$(tempo "$VALIDATE_QUERY" | jq -r '.traces[0].traceID // empty')[ -n "$VALIDATE_TRACE" ] && breaksleep 5donerecord "Steps 7, 8" "The turn's trace in Tempo" "$([ -n "$VALIDATE_TRACE" ] && echo found || echo none)" '^found$'
The trace. What the agent did, and that Substrate's part of the turn is in the same trace:
record "Step 9" "Agent spans in the trace" "$(trace_spans "$VALIDATE_TRACE" \| awk -F'\t' '{split($2, w, " "); n[w[1]]++} END {printf "invoke_agent=%d generate_content=%d execute_tool=%d", n["invoke_agent"], n["generate_content"], n["execute_tool"]}')" \'^invoke_agent=1 generate_content=[1-9][0-9]* execute_tool=[1-9]'record "Step 6" "Services in the trace" "$(trace_spans "$VALIDATE_TRACE" | cut -f1 | sort -u | tr '\n' ' ')" 'agentgateway.*kagent-controller.*smoke-agent'
The other backends. The gateway's log, the derived metric, and the evaluator:
record "Steps 6, 11" "Ingress access log for the session's actor" "status $(loki "{service_name=\"agentgateway\"} | ate_actor_name=\"session-${VALIDATE_SESSION}\"" \| jq -r '[.data.result[].stream.http_response_status_code] | unique | join(",")')" '^status 200$'record "Steps 4, 10" "Turns counted from invoke_agent spans" "$(prom "sum(last_over_time(gen_ai_invoke_agent_duration_seconds_count{service_name=\"smoke-agent\"}[${LOOKBACK}s]))" | cut -f2)" '^[1-9]'record "Step 5" "The session in agentevals" "$(svc_get agentevals agentevals:8001 /api/streaming/sessions \| jq -r --arg s "$VALIDATE_SESSION" '[.data[] | select(.sessionId == $s)] | length') found" '^1 found$'
Step 17: Map each result to the step that set it#
printf '%s' "$VALIDATE_RESULTS" | awk -F'|' 'NF >= 3 {printf "%-4s set in %-12s %s\n", $1, $2, $3}'FAILED=$(printf '%s' "$VALIDATE_RESULTS" | grep -c '^FAIL' || true)echo "checks: $(printf '%s' "$VALIDATE_RESULTS" | grep -c '|' || true), failed: ${FAILED}"
Every check names the step that set it up, so a FAIL sends you back to one place. Read them in the
order a turn passes through the pipeline:
| Order | What happens | Set in | Checked by |
|---|---|---|---|
| 1 | The controller receives the message and exports its span to the Collector | Step 7 | The turn's trace in Tempo |
| 2 | The ingress gateway routes the message to the session's actor, and logs the request | Step 6 | Services in the trace, ingress access log |
| 3 | The agent runs the turn and exports its spans, with the session's ID on each | Steps 7, 8 | Agent spans in the trace |
| 4 | The Collector sends every span to Tempo and makes a metric sample from the invoke_agent span | Step 4 | Turns counted from spans |
| 5 | Prometheus scrapes the Collector, the gateways and the controller | Steps 4, 6, 7 | The three scrape targets |
| 6 | The Collector forwards the agent's spans, and only those, to agentevals | Steps 4, 5 | The session in agentevals |
What you built#
- One Collector receives traces, metrics and logs from the kagent controller, every agent, and every Substrate component, and sends each signal to the backend that stores it.
- Tempo holds a turn as one trace, from the controller's A2A request through Substrate's gateways and actor restore to the agent's model and tool calls.
- Prometheus holds the metrics the Collector receives, a turn-duration histogram derived from spans, and the gateways' and controller's own metrics, scraped directly.
- Loki holds the gateways' access logs and the agents' logs, each with the trace ID of its turn.
- agentevals receives agent turns only, scores one session against another, and writes every score back to Loki with the trace and span ID of the turn it scored.
- Grafana reads all three.
What it does not do yet is in Before production.
Before production#
Each item is a limit of this setup that you can plan for, with the step that shows it.
- Turn content capture off unless you need it.
captureContent: truestores every prompt, response and tool argument on spans, in Tempo and in agentevals. agentevals needs it to score responses; nothing else in this guide does (Step 7). - Give Tempo storage. It runs with
persistence.enabled: false, so every trace is lost when its pod restarts (Step 2). - Size Loki, or move it off a single binary. It is one pod with a 2Gi filesystem volume, a replication factor of 1, and authentication off (Step 2).
- Lower Substrate's trace sampling.
samplingRatio: "1.0"keeps every trace, which suits a demo. The chart's default is0.01(Step 6). - Restrict who can send to the Collector. Its OTLP receivers listen on every address with no
authentication, and this guide puts no NetworkPolicy in
telemetry(Step 4). - Turn alerting back on. This guide disables Alertmanager and the node exporter (Step 3).
- Give Grafana real sign-in. It has one
adminuser whose password is in a Secret (Step 12). - Give the judge its own key. The evaluator reuses the agents' OpenAI key, so judge spend and
agent spend are one bill, and anyone who can read Secrets in
agentevalsholds the agents' key (Step 5). - Keep agentevals at one replica. It holds live sessions in the memory of the pod that receives them, so with more replicas one session's telemetry is split across pods, and a restart loses the sessions it held (Step 5).
- Expect long turns to be truncated in agentevals. It keeps only the first 10,000 spans of a trace. The Collector drops kagent's per-chunk TaskStore spans for that reason (Step 4).
- Expect idle agents to disappear from instant queries. The Collector stops serving a series an hour after its last update, so dashboards over agent metrics need a range (Step 10).
- Pin images by digest. Each chart version here fixes image tags, not digests (Version support).
When you are done with this cluster, or before working on another, close its port-forwards:
stop_forwards