Skip to content

DOCS

OpenAI Agents SDK

The OpenAI Agents SDK keeps its own trace processors. To also send OpenTelemetry spans, install an OpenTelemetry bridge and point the HTTP exporter at Monitor. gRPC is not accepted.

  1. Create an ingest key. See keys.
  2. Install the Agents SDK, the HTTP OTLP exporter, and a bridge such as openai-agents-opentelemetry.
  3. Register the tracer provider before the agent runs.
  4. Add the bridge with add_trace_processor so OpenAI's own exporter stays in place. Use set_trace_processors only when you want to replace that exporter.
  5. Run one short agent call.
  6. Open Runs in the dashboard. The walkthrough also polls until the first trace arrives.
from agents import add_trace_processor
from openai_agents_opentelemetry import OpenTelemetryTracingProcessor
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

provider = TracerProvider()
provider.add_span_processor(
    BatchSpanProcessor(
        OTLPSpanExporter(
            endpoint="https://balerxgate.com/v1/traces",
            headers={"x-balerx-key": "YOUR_INGEST_KEY"},
        ),
        max_export_batch_size=512,
    )
)
trace.set_tracer_provider(provider)
add_trace_processor(OpenTelemetryTracingProcessor())

The endpoint for this HTTP exporter includes /v1/traces. Give the span gen_ai.operation.name and gen_ai.agent.name if the bridge does not. Monitor uses those names to group the run.

Content in the OpenAI payload is a separate choice from Balerx content capture. Leave Balerx content capture off until you mean to store prompts.