---
title: Correlating Agent Observability and APM
description: >-
  Learn how to navigate between Agent Observability spans and APM spans so you
  can gain insights into LLM-specific operations and your broader application
  ecosystem.
breadcrumbs: >-
  Docs > Agent Observability > Monitoring > Correlating Agent Observability and
  APM
---

# Correlating Agent Observability and APM

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

This guide explains how you can use both Agent Observability and APM to correlate Agent Observability and APM [spans](https://docs.datadoghq.com/llm_observability/terms.md#spans) in Datadog.

By instrumenting your LLM-specific operations with Agent Observability and your broader application with APM, you can accomplish the following:

- Understand end-to-end visibility: Explore upstream and downstream requests of your LLM applications within the context of your entire application.
- From APM, dive deeper into Agent Observability: Investigate whether or not an issue with your application is specific to LLM-specific applications, such as a call to OpenAI.

## Setup{% #setup %}

The Agent Observability SDK is built on APM's dd-tracer. This allows you to use Agent Observability with [Application Performance Monitoring (APM)](https://docs.datadoghq.com/tracing.md)

If you are using the [Agent Observability SDK for Python](https://docs.datadoghq.com/llm_observability/setup/sdk.md) along with APM's [`dd-tracer`](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries.md), you can navigate between spans in Datadog APM and Agent Observability without additional setup.

If you are using the [Agent Observability API](https://docs.datadoghq.com/llm_observability/setup/api.md) with `dd-tracer` for APM:

1. Use the appropriate method to obtain the span ID from the tracer (for example, using `span.Context().SpanID()` for the Go tracer).
1. Include the captured span IDs in all of the Agent Observability API requests. This links APM and Agent Observability spans in Datadog.

## Navigate between spans{% #navigate-between-spans %}

By using this integration, you can correlate data across your application stack and understand how your LLM applications interact with other components. You can also resolve issues more quickly and optimize your application's performance.

{% video
   url="https://docs.dd-static.net/images/llm_observability/guides/apm/end_to_end_tracing.mp4" /%}

### From Agent Observability to APM{% #from-agent-observability-to-apm %}

To understand the broader context of your LLM operations within your application ecosystem, select an Agent Observability span in the [Agent Observability Explorer](https://app.datadoghq.com/llm/traces) and click APM span to navigate to the relevant APM span.

{% image
   source="https://docs.dd-static.net/images/llm_observability/guides/apm/llm_span.c236676d1fb54e8564cd3f30b2cc01ea.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/llm_observability/guides/apm/llm_span.c236676d1fb54e8564cd3f30b2cc01ea.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="An Agent Observability span with a related APM span that you can navigate to from the Traces page in Agent Observability" /%}

### From APM to Agent Observability{% #from-apm-to-agent-observability %}

To access LLM-specific insights, select an APM span in the [Trace Explorer](https://app.datadoghq.com/apm/traces) and click View Span in the Agent Observability section on the Info tab to navigate to the corresponding Agent Observability span.

{% image
   source="https://docs.dd-static.net/images/llm_observability/guides/apm/apm_span.f09c8128b4449158a04557fc1cd33919.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/llm_observability/guides/apm/apm_span.f09c8128b4449158a04557fc1cd33919.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="An APM span with a related Agent Observability span that you can navigate to from the Traces page in APM" /%}

## Further Reading{% #further-reading %}

- [Learn about Agent Observability Spans](https://docs.datadoghq.com/llm_observability/terms.md)
- [Learn about APM Spans](https://docs.datadoghq.com/glossary.md#span/)
- [Troubleshooting RAG-based LLM applications](https://www.datadoghq.com/blog/troubleshooting-rag-llms/)
