Prerequisites#
This guide walks you through all the steps you need to get started with tracing your kagent agents, including a basic installation. However, you might want to try out the other getting started guides first to get a better understanding of how kagent works.
-
kind for creating and running a local Kubernetes cluster.
-
Helm for installing the kagent chart.
-
kubectl for interacting with your cluster.
-
kagent CLI for interacting with kagent, such as to launch the dashboard.
# Download/run the install scriptcurl https://raw.githubusercontent.com/kagent-dev/kagent/refs/heads/main/scripts/get-kagent | bash
To run the AI agents you also need an OpenAI API key. You can get one here.
Installing Jaeger#
In order to demonstrate tracing, we'll first need to install Jaeger. We will use the Jaeger all in one mode to demonstrate the tracing capabilities without needing to install any other components.
Create the jaeger.yaml
file using the following command:
cat << 'EOF' > jaeger.yamlprovisionDataStore:cassandra: falseallInOne:enabled: truestorage:type: memoryagent:enabled: falsecollector:enabled: falsequery:enabled: falseEOF
Then install Jaeger using the following command:
helm repo add jaegertracing https://jaegertracing.github.io/helm-chartshelm repo updatehelm upgrade --install jaeger jaegertracing/jaeger \--namespace jaeger \--create-namespace \--history-max 3 \--values jaeger.yaml
Installing kagent#
The following steps include commands to install or upgrade the kagent Helm release.
-
Set the OpenAI API key as an environment variable.
export OPENAI_API_KEY="your-api-key-here" -
If you did not already, install the kagent and kmcp CRDs.
helm upgrade --install kagent-crds oci://ghcr.io/kagent-dev/kagent/helm/kagent-crds \--namespace kagent \--create-namespace -
If you already installed kagent, get your current Helm release values.
helm get values kagent -n kagent > values.yaml -
Create or update your values file to include the following settings to enable tracing.
otel:tracing:enabled: trueexporter:otlp:endpoint: http://jaeger-collector.jaeger.svc.cluster.local:4317 -
Install or upgrade the kagent Helm chart with the tracing details.
helm upgrade -i kagent oci://ghcr.io/kagent-dev/kagent/helm/kagent \--namespace kagent \--set providers.openAI.apiKey=$OPENAI_API_KEY \--values values.yaml
Tracing your first agent#
Now that you installed kagent with Jaeger, learn how to trace requests to an agent.
Generate tracing data#
To generate tracing data, you can chat with a pre-configured agent such as k8s-agent
. For more information about agents, see the Your First Agent guide.
-
Launch the kagent dashboard.
kagent dashboardExample output:
kagent dashboard is available at http://localhost:8082Press Enter to stop the port-forward...Kagent dashboard main page -
Click the pre-configured
k8s-agent
agent. -
In the conversation box, enter a query such as "What pods are running in my cluster?".
Chatting with an agent
Review tracing data in Jaeger#
Review the tracing data in Jaeger for the agent queries that you just sent.
-
In your terminal, enable port-forwarding for the Jaeger query service.
kubectl port-forward svc/jaeger-query -n jaeger 16686:16686 -
In your browser, open the Jaeger UI: http://localhost:16686.
-
From the Jaeger Search menu, in the Service dropdown, select the
kagent
service. -
In the Operation dropdown, select
agent_run [k8s-agent]
to filter for traces specific to the agent. -
Click Find Traces.
-
Review the traces for the
kagent
service.Jaeger results page -
Click on a trace to see more details.
Jaeger trace details
That's it! You've now traced your first agent.
Next Steps#
- Learn about Core Concepts
- Join our Community
Need Help?#
- Visit our GitHub repository
- Ask a question on Discord
- Check out the FAQ