GuidesFramework quickstartsOpenAI Agents SDK

OpenAI Agents SDK

The OpenAI Agents SDK (the openai-agents Python package) is a lightweight framework for building multi-agent workflows. Neens ingests its traces through standard OpenTelemetry with zero Neens-specific code — you point an OTLP exporter at Neens and instrument the SDK once at startup.

At a glance

LanguagePython
Instrumentationopeninference-instrumentation-openai-agents (OpenInference OpenAI Agents instrumentor — community-maintained by Arize)
EndpointPOST /v1/traces (OTLP/HTTP)
AuthAuthorization: Bearer nk_live_… agent key

Instrument your agent

Install the instrumentation

The OpenInference instrumentor hooks the Agents SDK’s own tracing runtime and re-emits it as OpenTelemetry spans.

pip install openinference-instrumentation-openai-agents opentelemetry-sdk opentelemetry-exporter-otlp

This assumes you already have the SDK itself installed (pip install openai-agents).

Point the exporter at Neens

from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
 
exporter = OTLPSpanExporter(
    endpoint="https://<your-neens-host>/v1/traces",
    headers={"Authorization": "Bearer nk_live_your_key_here"},
)
 
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)
 
# Instrument once, before you run your agent.
OpenAIAgentsInstrumentor().instrument()

Run your agent

Run your agent as usual — call Runner.run(...) or Runner.run_sync(...). Spans export to Neens in the background.

What Neens captures

The instrumentor emits spans for each agent run, every LLM call (model, token counts, prompt/response messages), and every tool/function call — so you see the full agent trajectory. For multi-turn agents, set a conversation/session id on your runs so Neens groups them into one session (see Traces & sessions).

Neens speaks standard OTLP — this is not a Neens SDK fork. Any OpenTelemetry-instrumented Agents SDK app exports to Neens by pointing its exporter at the endpoint above. See Send traces for the full attribute reference, size limits, and response codes.

Alternative: the SDK’s built-in tracing. The Agents SDK ships its own tracing runtime, which Pydantic Logfire can bridge to OpenTelemetry via logfire.instrument_openai_agents() (community, not first-party OpenAI). If you already run Logfire, configure it to export OTLP at the endpoint above instead of installing the OpenInference instrumentor. Neens reads either path — it ingests OTel-GenAI and OpenInference attributes alike. We recommend the OpenInference instrumentor above for consistency with the other Neens framework quickstarts.

Verify

Open Traces in Neens; your agent runs appear within a few seconds. Continue to Traces & sessions.