Skip to main content

respan-instrumentation-openai-agents

Respan instrumentation plugin for the OpenAI Agents SDK. Captures current 0.20.x agent, task, turn, tool, handoff, guardrail, Responses, Chat Completions, and streaming spans through the OTEL pipeline.

Configuration

1. Install

pip install respan-instrumentation-openai-agents

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key. Authenticates both proxy and tracing.
RESPAN_BASE_URL No Defaults to https://api.respan.ai/api.

OPENAI_API_KEY is required when your application calls OpenAI directly. A compatible OpenAI gateway can instead be configured through the Agents SDK's normal custom-client APIs. Hosted Responses tools such as Web Search, File Search, and Computer Use require a Responses-capable OpenAI credential and endpoint; this instrumentation does not convert those tools to Chat Completions.

Quickstart

3. Run Script

import asyncio
import os
from agents import Agent, Runner
from respan import Respan
from respan_instrumentation_openai_agents import OpenAIAgentsInstrumentor

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")

os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = respan_base_url

respan = Respan(
    api_key=respan_api_key,
    base_url=respan_base_url,
    instrumentations=[OpenAIAgentsInstrumentor()],
)

agent = Agent(name="Assistant", instructions="You are a helpful assistant.")


async def main():
    try:
        result = await Runner.run(agent, "Hello!")
        print(result.final_output)
    finally:
        respan.flush()


asyncio.run(main())

Instrumentation activation is process-wide and reference-counted. Repeated Respan instances share one Agents tracing processor, and the SDK's previous processors are restored after the final deactivation. Auto-emitted spans use canonical JSON attributes, never traceloop.span.kind or the deprecated top-level tool aliases.

4. View Dashboard

After running the script, traces appear on your Respan dashboard.

Further Reading

See the examples/openai-agents-sdk/ directory for runnable examples including tool use, handoffs, multi-agent workflows, guardrails, and streaming.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_openai_agents-1.1.3.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_openai_agents-1.1.3.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.3.tar.gz
Algorithm Hash digest
SHA256 dbefe51c481473023a5ff5095f0fc7e450f2d9ccda20d34b761ae1ca8088db45
MD5 3c5cdf318dada0ae1a83fdfab33e14a6
BLAKE2b-256 2dddf0b8f57ad787ad3530a73d5d4356c21819dce20954f4792f5f0cd8eb930b

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_openai_agents-1.1.3.tar.gz:

Publisher: publish.yml on respanai/respan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file respan_instrumentation_openai_agents-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 28797dee2522188a4b83a95b07339b2691931dd14a4e7c5f6f4a4adc71d6bfa1
MD5 d921ca3d7428bbd98e7fb0e3db1f4f0e
BLAKE2b-256 40a98a50b5d842526fdfe9195b1485deb8f5a22c20d95358f8e7fabbcaec8499

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_openai_agents-1.1.3-py3-none-any.whl:

Publisher: publish.yml on respanai/respan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page