Skip to content

instrument_openai_agents

junjo.plugins.openai_agents.instrument_openai_agents

Kind: Function

SDK version: 0.67.0

Documentation channel: Stable release

instrument_openai_agents(*, tracer_provider: TracerProvider) -> OpenAIAgentsIntegration

View source

Translate first-party OpenAI Agents traces into OpenTelemetry spans.

The application owns the supplied provider, processors, exporters, resource identity, and shutdown order. This function explicitly wraps the active OpenAI Agents TraceProvider while preserving its configured processors and native trace-export policy. Importing the module has no instrumentation side effect.

Repeated calls with the same active OpenTelemetry provider share one registration and return independently closeable handles. A different provider cannot be selected until the active integration is closed.

Name Type Description Default
tracer_provider TracerProvider Process-lifetime OpenTelemetry SDK provider that
owns the application’s existing trace pipeline.
  • OpenAIAgentsIntegration: Ownership handle that must be closed before the provider shuts down.
Exception Description
TypeError If tracer_provider is not an SDK provider.
OpenAIAgentsIntegrationError If another provider is already
active for the process-level OpenAI integration.