---
title: Send OpenTelemetry traces to Agent Analytics
description: "Point an OpenTelemetry exporter or Collector at Amplitude's OTLP endpoint so GenAI spans become Agent Analytics sessions, with no Amplitude SDK or re-instrumentation."
product: general
lang: en
token_estimate: 1318
---
# Send OpenTelemetry traces to Agent Analytics

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Amplitude's OTLP endpoint accepts OpenTelemetry GenAI spans and translates them into the same `[Agent]` events the AI SDK produces, so sessions, enrichment, and every chart work the same way. If your stack already emits GenAI spans, point your exporter at Amplitude. You don't need the Amplitude SDK or new instrumentation.

Use this path when you already run an OpenTelemetry exporter or Collector. If you instrument a Node or Python app with the AI SDK instead, use the SDK's [in-process OTel exporters](https://amplitude.com/docs/sdks/agent-analytics/sdk#ingest-opentelemetry-spans), which are a separate path. Before you start, decide your [session ID](https://amplitude.com/docs/amplitude-ai/agent-analytics/sessions) and [privacy mode](https://amplitude.com/docs/amplitude-ai/agent-analytics/privacy-modes).

## Configure your exporter

Set these environment variables on your exporter or Collector:

```bash
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.amplitude.com/otlp/v1/traces   # US
# OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.eu.amplitude.com/otlp/v1/traces  # EU
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <project API key>"
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf   # or http/json
```

The OTLP HTTP endpoint is generally available in the US and EU. A valid project API key is enough. Amplitude doesn't require a per-project enablement request, and the receiver never returns `403` for a missing allowlist.

- **Protocol**: OTLP over HTTP only. Amplitude accepts `http/protobuf` (the OpenTelemetry SDK and Collector default) and `http/json`, with optional gzip. Amplitude doesn't support OTLP/gRPC, so bridge gRPC traffic through a local Collector with an OTLP/HTTP exporter.
- **Authentication**: Pass the project API key as a `Bearer` token or as an `api_key` query parameter.
- **Supported instrumentation**: OpenTelemetry GenAI semantic conventions, OpenInference (`llm.*`), OpenLLMetry and Traceloop (`traceloop.*`), OpenLIT, and LiteLLM. Amplitude ignores non-GenAI spans, so you can point a mixed Collector at Amplitude.

## Set session and user attributes

The session attribute is the one change worth making to your instrumentation. Amplitude maps everything else automatically.

An Amplitude agent session is a whole conversation, not one trace. Without a conversation attribute, every trace becomes its own single-turn session. Task completion and abandonment then read as noise, and because billing is per agent session, one conversation bills as several.

Set these attributes on your GenAI spans:

- **Session**: `gen_ai.conversation.id`, set to your conversation, ticket, or run ID. Refer to [Choose a session ID](https://amplitude.com/docs/amplitude-ai/agent-analytics/sessions#choose-a-session-id).
- **User**: `enduser.id`, set to the same user ID you use for product analytics. Never send a placeholder such as `anonymous`. Refer to [Set user IDs](https://amplitude.com/docs/amplitude-ai/agent-analytics/sessions#set-user-ids).
- **Agent**: `gen_ai.agent.id`, or Amplitude falls back to the resource `service.name`.

Amplitude also reads other common attributes, such as `session.id` and Traceloop association properties. For the full resolution order, refer to [Attribute resolution order](https://amplitude.com/docs/amplitude-ai/agent-analytics/otlp-reference#attribute-resolution-order).

To report cost, also set `gen_ai.usage.cost`. Amplitude doesn't calculate a cost when this attribute is absent.

## Apply your privacy mode

Most OpenTelemetry GenAI instrumentation treats message content as opt-in.

- **Content capture off**: You get the `metadata_only` shape: cost, tokens, latency, model, and sessions, with no transcripts.
- **Content capture on**: `gen_ai.input.messages`, `gen_ai.output.messages`, and `gen_ai.system_instructions` flow into `$llm_message` and `[Agent] System Prompt`, where Amplitude's redaction and enrichment apply.

Redaction that must happen before data leaves your network belongs in a Collector processor. For what each mode sends, refer to [Agent Analytics privacy modes](https://amplitude.com/docs/amplitude-ai/agent-analytics/privacy-modes).

## Keep delivery reliable

Delivery is at least once. Run a Collector with a persistent sending queue and keep retries enabled, because an in-memory queue loses buffered spans on restart. A `200` response can carry a `partial_success` body listing rejected events. For limits and response codes, refer to [Delivery, limits, and responses](https://amplitude.com/docs/amplitude-ai/agent-analytics/otlp-reference#delivery-limits-and-responses).

## Verify

Send one traced conversation, then confirm in Live Events that the events arrive with:

1. A real `[Agent] Session ID`, not a trace ID.
2. A populated `[Agent] Agent ID`.
3. Your own user IDs, not `unknown`.

Those three values come from the attributes in [Set session and user attributes](#set-session-and-user-attributes). For the full checklist, refer to [Verify your Agent Analytics instrumentation](https://amplitude.com/docs/amplitude-ai/agent-analytics/verify).

