Documentation

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 script
    curl 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.yaml
provisionDataStore:
cassandra: false
allInOne:
enabled: true
storage:
type: memory
agent:
enabled: false
collector:
enabled: false
query:
enabled: false
EOF

Then install Jaeger using the following command:

helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm repo update
helm 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.

  1. Set the OpenAI API key as an environment variable.

    export OPENAI_API_KEY="your-api-key-here"
  2. 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
  3. If you already installed kagent, get your current Helm release values.

    helm get values kagent -n kagent > values.yaml
  4. Create or update your values file to include the following settings to enable tracing.

    otel:
    tracing:
    enabled: true
    exporter:
    otlp:
    endpoint: http://jaeger-collector.jaeger.svc.cluster.local:4317
  5. 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.

  1. Launch the kagent dashboard.

    kagent dashboard

    Example output:

    kagent dashboard is available at http://localhost:8082
    Press Enter to stop the port-forward...
    Kagent dashboard main page
    Kagent dashboard main page
  2. Click the pre-configured k8s-agent agent.

  3. In the conversation box, enter a query such as "What pods are running in my cluster?".

    Chatting with an agent
    Chatting with an agent

Review tracing data in Jaeger#

Review the tracing data in Jaeger for the agent queries that you just sent.

  1. In your terminal, enable port-forwarding for the Jaeger query service.

    kubectl port-forward svc/jaeger-query -n jaeger 16686:16686
  2. In your browser, open the Jaeger UI: http://localhost:16686.

  3. From the Jaeger Search menu, in the Service dropdown, select the kagent service.

  4. In the Operation dropdown, select agent_run [k8s-agent] to filter for traces specific to the agent.

  5. Click Find Traces.

  6. Review the traces for the kagent service.

    Jaeger results page
    Jaeger results page
  7. Click on a trace to see more details.

    Jaeger trace details
    Jaeger trace details

That's it! You've now traced your first agent.

Next Steps#

Need Help?#

Kagent Lab: Discover kagent and kmcp
Free, on‑demand lab: build custom AI agents with kagent and integrate tools via kmcp on Kubernetes.