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.0.tar.gz (7.4 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.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.0.tar.gz
Algorithm Hash digest
SHA256 59197bd7e141c516f686ad80c062cb06abfefb8935f4de58e21586803fc422e7
MD5 c225620a7e24dbcab72bb44aafde11a1
BLAKE2b-256 76334879e80c4b14c89932d0419c8fe22967803dacb38385f33bd88fd05a807c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for respan_instrumentation_openai_agents-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d0db689d3c8f6574f87b4e0ea527c5768d1640ce8ba60ee34ee24964bfb80df
MD5 82faa00941b0dcd2d1ea8c408e3b5250
BLAKE2b-256 b894118ff26970338d5d56c5d6b753639c4e3115af7db4a48a90b9e6f33cedeb

See more details on using hashes here.

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