Looking for Python? See the Python guide.
@openai/agents), capturing agent runs, model calls, tool calls, handoffs, and guardrails as OpenInference spans.
Install
Setup
Use theregister function from @arizeai/phoenix-otel to connect to Phoenix, then register the Agents SDK instrumentation.
Create the instrumentation.ts file:
The Agents SDK exposes a first-class tracing API, so this instrumentation registers a trace processor with the SDK rather than monkey-patching the module. By default it replaces the SDK’s built-in processors; pass
manuallyInstrument(agents, { exclusiveProcessor: false }) to keep OpenAI’s native tracing exporter running alongside Phoenix.Usage
Spans are exported in batches. In short-lived scripts, call
await provider.forceFlush() before the process exits so all spans are delivered to Phoenix.Observe
With instrumentation enabled, you will see the following in Phoenix:- AGENT spans for each agent in the run, with graph metadata that lets Phoenix visualize multi-agent handoffs as a graph
- LLM spans for model calls, including messages, invocation parameters, and token counts
- TOOL spans for function tool calls, handoffs, and MCP tool listings
- GUARDRAIL spans for input/output guardrails, including whether the guardrail was triggered
traceConfig for masking sensitive inputs/outputs).

