The OpenAI Agents SDK traces every run, but by default it uploads those traces to OpenAI. OpenInference's bridge replaces that processor, so the same spans go to Maple over OTLP and each conversation becomes one agent session.
npm install @openai/agents \
@arizeai/openinference-instrumentation-openai-agents \
@arizeai/openinference-core @opentelemetry/api @opentelemetry/sdk-node export OTEL_SERVICE_NAME=support-agent
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.maple.dev
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer YOUR_INGEST_KEY" // instrumentation.ts: import it first in your entry point
import * as agents from "@openai/agents"
import { OpenAIAgentsInstrumentation } from "@arizeai/openinference-instrumentation-openai-agents"
import { NodeSDK } from "@opentelemetry/sdk-node"
// Reads OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES and OTEL_EXPORTER_OTLP_*
export const sdk = new NodeSDK()
sdk.start()
// Replaces the SDK's default processor, which uploads traces to OpenAI
new OpenAIAgentsInstrumentation().manuallyInstrument(agents) import { setAttributes } from "@arizeai/openinference-core"
import { run } from "@openai/agents"
import { context } from "@opentelemetry/api"
export async function handleMessage(conversationId: string, text: string) {
const ctx = setAttributes(context.active(), { "gen_ai.conversation.id": conversationId })
const result = await context.with(ctx, () => run(agent, text))
return result.finalOutput
} This is the short path. The full OpenAI Agents SDK guide covers the rest.
Organization in the EU region? Send to https://ingest.eu.maple.dev instead of https://ingest.maple.dev. An ingest key only works in its own region.
What you get
The bridge copies gen_ai.conversation.id onto every span of a run. Runs that share it form one session, one turn per run.
Each tool the agent calls is a span with its name, arguments and result, inside the turn that called it.
Each model call carries its input and output token counts. Cost shows as unpriced.
Sessions show the framework as OpenAI Agents SDK, so they stay apart from other agents in the same organization.
The spans go through the same OpenTelemetry SDK as your HTTP and database spans, so one trace can hold both.
The full guide has the Python setup for openai-agents, with using_session in place of context.with.
setTracingDisabled(true) and OPENAI_AGENTS_DISABLE_TRACING stop every span, Maple's included. The bridge already stops the upload to OpenAI.
With NODE_ENV=test the SDK disables tracing on its own. Call setTracingDisabled(false) in tests that check spans.
If every model call appears twice, another instrumentation of the OpenAI client is also active. Keep one.
Integrations
Add the SDK, point your OTLP exporter at Maple, and traces arrive.
maple.dev: observability on OpenTelemetry