Skip to main content

Respan instrumentation plugin for the OpenAI Agents SDK

Project description

respan-instrumentation-openai-agents

Respan instrumentation plugin for the OpenAI Agents SDK. Captures agent traces, tool calls, handoffs, and LLM generations via 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.

All vendor-specific variables (e.g. OPENAI_API_KEY) are derived from these in your application code.

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")

os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = f"{respan_base_url}/api/openai"

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():
    result = await Runner.run(agent, "Hello!")
    print(result.final_output)

asyncio.run(main())
respan.flush()

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.

Project details


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.1.tar.gz (8.1 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.1.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.1.tar.gz
Algorithm Hash digest
SHA256 0503d280828fe28cb02c92c3ab146cdacb94b9a2243ae71087760051bc7bd75e
MD5 0cc117a665ec47fe98319f3d5b732056
BLAKE2b-256 354552f1e735627eec774c96791940ef158cb2cfc6875ae2331b82125cb368ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_openai_agents-1.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 133dc83dba2fbab89f98fc704b09c02e35e83f2b32dbb05f734c3695d6116620
MD5 b9615b3f2ffaf9bc9be96ceb13b84205
BLAKE2b-256 914e6ea8676b1986afcde82db8e4462b91c65be14163d206123df0a2c1b5d347

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_openai_agents-1.1.1-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.

Supported by

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