> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zespan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents SDK

> Trace OpenAI's Agents SDK (agent runs, handoffs, tool calls) via OpenTelemetry auto-instrumentation, no Zespan SDK required.

<Note>
  Available via: **OpenTelemetry auto-instrumentation** (Python). This is not a Zespan SDK wrapper — see [Send traces from any OTel-instrumented app](/sdk/otel-integration#send-traces-from-any-otel-instrumented-app-no-zespan-sdk) for how the underlying endpoint works.
</Note>

OpenAI's [Agents SDK](https://github.com/openai/openai-agents-python) has its own built-in tracing model (agent runs, handoffs, guardrail checks, tool calls). [OpenInference](https://github.com/Arize-ai/openinference)'s `openinference-instrumentation-openai-agents` package bridges that tracing model onto standard OpenTelemetry spans, so it flows through the same `/v1/traces` endpoint as everything else.

## Installation

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
pip install openai-agents openinference-instrumentation-openai-agents \
  opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
```

## Setup

```python theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
from agents import Agent, Runner
from opentelemetry import trace as trace_api
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(
    endpoint="https://api.zespan.com/v1/traces",
    headers={"x-api-key": "zsp_..."},
)))
trace_api.set_tracer_provider(provider)

OpenAIAgentsInstrumentor().instrument(tracer_provider=provider)

# Every agent run below is now traced automatically
agent = Agent(name="Assistant", instructions="You are helpful.")
result = Runner.run_sync(agent, "What's 2+2?")
```

## What gets captured

Agent runs, tool calls, and handoffs between agents map to Zespan's agent/tool span kinds via the standard [OpenTelemetry GenAI semantic conventions](/sdk/otel-integration#attributes-zespan-reads) — a multi-agent handoff chain shows up as one connected trace, the same shape as [Google ADK](/sdk/integrations/google-adk) or [CrewAI](/sdk/integrations/crewai) traces.

<Note>
  OpenAI Agents SDK's own model calls (to `gpt-4o` etc.) are captured as part of this same instrumentation — you don't need [`wrapOpenAI`/`patch_openai`](/sdk/integrations/openai) separately for agent runs built with this SDK.
</Note>
