run function that drives them. Arize AX captures every Agents JS run — agent invocations, tool calls, handoffs, guardrails, and the underlying LLM calls — via the @arizeai/openinference-instrumentation-openai-agents package, which registers as a first-class TracingProcessor against the SDK.
Prerequisites
- Node.js 22+
- An Arize AX account (sign up)
- An
OPENAI_API_KEYfrom the OpenAI Platform
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Configure credentials
Setup tracing
The instrumentor implements the Agents SDK’s first-class
TracingProcessor interface rather than monkey-patching imports, so manuallyInstrument(agents) must receive the same @openai/agents namespace your application code imports. Pass exclusiveProcessor: false to the constructor to run alongside the SDK’s default OpenAI tracing exporter instead of replacing it.Run OpenAI Agents JS
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
openai-agents-js-tracing-example. - You should see a new trace within ~30 seconds with this shape: an
Agent workflowroot span (AGENT) wraps anAssistantagent span (AGENT) and aresponseLLM child span (modelgpt-5) with the prompt, response, and token usage attached. Tool, handoff, and guardrail spans appear when the agent invokes them. - If no traces appear, see Troubleshooting.
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.ts. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. - Agents spans missing.
instrumentation.manuallyInstrument(agents)must run beforeAgentis constructed orrunis called. Make sureimport { provider } from "./instrumentation"is the first import in your entry point, and that the same@openai/agentsnamespace passed tomanuallyInstrument(...)is the one your application code imports. 401from OpenAI. VerifyOPENAI_API_KEYis set and has access to the default model. Swapmodel: "gpt-5"for a model your key can call.- Spans still going to the default OpenAI tracing exporter. The instrumentor registers exclusively by default. If you need to keep the SDK’s built-in exporter alongside Arize AX, pass
new OpenAIAgentsInstrumentation({ tracerProvider: provider, exclusiveProcessor: false }). - Process exits before spans flush.
BatchSpanProcessorbatches spans before export; alwaysawait provider.forceFlush()(orprovider.shutdown()) before the process exits to avoid losing trailing spans. - Tool / handoff / guardrail spans expected but not present. These spans only emit when the agent actually invokes the corresponding feature. The minimal example above has none — add
tools,handoffs, orinputGuardrailsto theAgentconstructor to see them.