> ## Documentation Index
> Fetch the complete documentation index at: https://developers.agentx.so/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenTelemetry

> Send traces from any OTel-instrumented app - no AgentX SDK required

Already instrumented with OpenTelemetry? Point any OTel SDK, auto-instrumentation library, or
Collector `otlphttpexporter` straight at the engine - no AgentX SDK needed:

```bash theme={null}
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4700/api/v1/otel
export OTEL_EXPORTER_OTLP_HEADERS="x-api-key=agtx_local_..."   # from the engine startup log
```

## Wire formats

| Protocol           | Supported | Notes                                                                                       |
| ------------------ | --------- | ------------------------------------------------------------------------------------------- |
| OTLP/HTTP protobuf | ✅         | The default, and the only transport Python's `opentelemetry-exporter-otlp-proto-http` ships |
| OTLP/HTTP JSON     | ✅         | `OTEL_EXPORTER_OTLP_PROTOCOL=http/json` - common from Node/JS exporters                     |
| OTLP/gRPC          | ❌         | HTTP only                                                                                   |

## Attribute conventions

Each incoming span becomes one trace row, with `input`/`output`/`model`/token counts pulled
from whichever convention the instrumentation actually sends:

| Convention            | Attributes read                                                                                                                                                                          |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OTel GenAI semconv    | `gen_ai.input.messages` / `gen_ai.output.messages`, `gen_ai.request.model`, `gen_ai.usage.*` - current **and** legacy names (the convention has renamed fields more than once)           |
| OpenLLMetry (legacy)  | Indexed `gen_ai.prompt.{i}.*` / `gen_ai.completion.{i}.*`                                                                                                                                |
| OpenInference (Arize) | `input.value` / `output.value`                                                                                                                                                           |
| MLflow Tracing        | `mlflow.spanInputs` / `mlflow.spanOutputs` / `mlflow.spanType` (JSON-encoded values unwrapped) - agents on Databricks export straight in, see [Databricks](/sdk/integrations/databricks) |

Monitor runs against every OTel-ingested span by default; set `AGENTX_OTEL_MONITOR=false` to
turn that off.

## First-class citizenship

Three attributes make OTel traffic part of the full loop, not just rows in Live Traces:

* **Sessions** - set `session.id`, `gen_ai.conversation.id`, or `agentx.session_id` and traces
  group into conversations on the [Sessions](/trace/sessions) surface, with session judging
  applying exactly like SDK traffic. Without one, spans still group by OTel trace id.
* **Prompt identity** - set `agentx.prompt_name` (and optionally `agentx.version`) and the
  whole [Improve loop](/improve/prompt-management) lights up: prompt-registry evidence
  gathering and version comparison treat the trace as if the SDK had tagged it.
* **Tool calls** - a child span carrying `gen_ai.tool.name` (or an MLflow `TOOL`-typed span) is
  folded up into its root interaction's `tool_calls`, with `success`/`error` derived from span
  status - so Tool quality, the built-in Tool-failure check, and
  [Tool Schema](/improve/tool-schemas) evidence all work on OTel traffic. In-batch only: a
  parent exported in an earlier OTLP batch isn't updated retroactively.

## Verify it's flowing

Send one span, then check **Observe → Live Traces** - OTel spans arrive with their full
span tree (Timeline and Graph views) whenever the instrumentation emits parent/child links.

<Tip>
  Popular auto-instrumentation packages (`openinference-instrumentation-langchain`,
  OpenLLMetry's SDK, MLflow Tracing) all export full span trees - one env var and your existing
  instrumentation becomes AgentX's data source.
</Tip>
