How do I trace an OpenAI Agents SDK run?
Tracing is on by default: every Runner.run() call is wrapped in one trace, and that trace holds a span for each agent, each model call, each tool call, each handoff, and each guardrail check, sent to OpenAI’s own dashboard unless you redirect them. There’s no built-in OpenTelemetry exporter, so reaching a different backend means writing or installing a trace processor: add_trace_processor() sends a copy alongside the default export, set_trace_processors() replaces it outright, and OPENAI_AGENTS_DISABLE_TRACING=1 turns tracing off entirely.
The handoff and guardrail spans are worth grading on their own rather than folding into whatever the agent finally says. A handoff span records the exact moment control moved from one agent to another and what went with it, which is where multi-agent handoffs actually break. A guardrail span records that a check ran and what it decided, a separate fact from the model’s output that’s worth tracking as its own rate.
sources
- OpenAI Agents SDK docs: Tracing fetched