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

# OpenTelemetry adapters

> Choose direct OTLP/HTTP JSON export or bridge to a tracer your host already owns.

Agentium supports two OpenTelemetry paths. Choose one to avoid duplicate exports of the same execution.

## Send HTTP JSON directly

```typescript theme={null}
import { OTelExporter } from "@agentium/observability";

export const exporter = new OTelExporter({
  endpoint: "http://localhost:4318",
  protocol: "http/json",
  serviceName: "support-agent",
});
```

Pass `exporter` to `instrument(agent, { exporters: [exporter] })` or `instrumentBus`. `endpoint` is a base URL and appends `/v1/traces`. Use `tracesEndpoint` when you already have the complete signal URL. Supply collector authentication in `headers`.

`OTelExporter` implements **HTTP JSON**. It rejects `http/protobuf`; use a host SDK exporter through the bridge when your collector requires binary OTLP.

## Use your host SDK

This complete factory borrows your tracer and an explicit context binding. Your host initializes its SDK, sampling, span processors, and exporter before calling it.

```typescript theme={null}
import {
  OTelBridgeExporter,
  type OTelBridgeOptions,
} from "@agentium/observability";

export function createBridge(options: OTelBridgeOptions) {
  return new OTelBridgeExporter(options);
}
```

Supply exactly one of `tracer` or `provider`, plus `contextFor(parent)`. In an OpenTelemetry host, the latter can use `trace.setSpanContext(context.active(), parent)` with your chosen root-context behavior when no parent exists. Follow your host SDK's context propagation rules.

The bridge emits completed spans into that tracer and keeps source span IDs as correlation attributes. It never registers a global provider and never shuts down the provider you supplied. Drain Agentium observation first, then flush/shut down your host SDK according to the application's lifecycle.

The same [capture policy and bounds](/observability/overview) apply to both paths.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.