OpenAI Agents Integration
Updated on Aug 14, 2026
Use this integration when your OpenAI Agents application is implemented in Python.
Setup
- Install SDK
bash
pip install progress-observability
- Instrument your app
python
Observability.instrument(
app_name=os.getenv("OBSERVABILITY_APP_NAME"),
api_key=os.getenv("OBSERVABILITY_API_KEY")
)
- Complete example
python
import os
from dotenv import load_dotenv
from agents import Agent, Runner, function_tool
from progress.observability import Observability
load_dotenv()
# LLM INSTRUMENTATION
Observability.instrument(
app_name=os.getenv("OBSERVABILITY_APP_NAME"),
api_key=os.getenv("OBSERVABILITY_API_KEY")
)
model = os.getenv("OPENAI_MODEL", "gpt-4o-mini")
@function_tool
def get_weather(location: str) -> str:
"""Get the weather for a given location."""
return f"The weather in {location} is cloudy with a high of 15°C."
agent = Agent(
name="Weather Assistant",
model=model,
tools=[get_weather],
instructions="You are a helpful AI assistant."
)
result = Runner.run_sync(agent, "What's the weather in Paris?")
Observability.shutdown()
Avoiding duplicate spans
When using Observability.instrument() with the OpenAI Agents SDK, each model call may be captured twice — once by the SDK's native tracing hooks (OpenAIAgentsInstrumentor) and once by the lower-level OpenAI client patch (OpenAIInstrumentor). This doubles reported token usage and cost.
To fix it, block the redundant instrumentor:
python
from progress.observability.enums import ObservabilityInstruments
Observability.instrument(
app_name=os.getenv("OBSERVABILITY_APP_NAME"),
api_key=os.getenv("OBSERVABILITY_API_KEY"),
block_instruments={ObservabilityInstruments.OPENAI},
)