Repository navigation
Description
Component
A365
Description
Summary
When enable_a365=True is passed to use_microsoft_opentelemetry and the OpenAI Agents SDK (openai-agents, the optional openai-agents extra) is not installed, the distro logs a warning with a full traceback on every start:
WARNING Failed to set up A365 OpenAI Agents instrumentation.
...
File ".../microsoft/opentelemetry/_genai/_openai_agents/_trace_processor.py", line 15, in <module>
from agents import MCPListToolsSpanData
ModuleNotFoundError: No module named 'agents'
The SDK is an optional extra and many applications do not use it, so this is expected to be common.
Why it happens
In _setup_instrumentations, the openai_agents entry point is handled before the normal dependency check:
if lib_name == "openai_agents" and enable_a365:
_setup_a365_openai_agents_instrumentation()
continueThe normal path right below it calls get_dist_dependency_conflicts(...) and skips the library quietly when its dependency is missing. The A365 path skips that check and imports the SDK directly, so a missing SDK is reported as a failure.
azure-ai-agentserver-core (2.3.0) sets enable_a365=True itself in hosted environments (FOUNDRY_AGENT365_TRACING_ENABLED), so applications running on that host hit this without having chosen the option.
Reproduce
Environment: Python 3.12, microsoft-opentelemetry 1.5.0 (the code is unchanged in 1.6.0 and on main), openai-agents not installed.
import logging
logging.basicConfig(level=logging.WARNING)
from microsoft.opentelemetry import use_microsoft_opentelemetry
use_microsoft_opentelemetry(enable_a365=True)Expected
When the OpenAI Agents SDK is not installed, skip the A365 OpenAI Agents instrumentation the way the non-A365 path does (debug log at most), and warn only when the SDK is present and the setup then fails.
Notes
If an application has its own top-level package named agents, the failure reads ImportError: cannot import name 'MCPListToolsSpanData' from 'agents' instead, because the name resolves to that package. Checking for the SDK's distribution (rather than the module name) would avoid that confusion too.
Expected Behavior
When the OpenAI Agents SDK is not installed, skip the A365 OpenAI Agents instrumentation the way the non-A365 path does (debug log at most), and warn only when the SDK is present and the setup then fails.
Steps to Reproduce
Reproduce
Environment: Python 3.12, microsoft-opentelemetry 1.5.0 (the code is unchanged in 1.6.0 and on main), openai-agents not installed.
import logging
logging.basicConfig(level=logging.WARNING)
from microsoft.opentelemetry import use_microsoft_opentelemetry
use_microsoft_opentelemetry(enable_a365=True)
Environment
Python 3.12, microsoft-opentelemetry 1.5.0 (the code is unchanged in 1.6.0 and on main), openai-agents not installed.
Additional Context
No response
Activity
github-actions commentedon Nov 6, 2026
cc Hector Hernandez (@hectorhdzg) Jackson Weber (@JacksonWeber) Leighton Chen (@lzchen) Nev (@MSNev) Radhika Gupta (@rads-1996) Jeremy Voss (@jeremydvoss) Jianbiao Lu (@alexlu4250) Nikhil Navakiran (@nikhilNava) Julio Carlos Menendez (@juliomenendez) ajmfehr Grant Harris (@gwharris7) Pujarini Mohapatra (@biswapm)
akhil9tiet commentedon Nov 6, 2026
I'd like to work on this — please assign it to me.