Description
Setting AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=true causes all streaming agent requests to fail with AttributeError: 'AsyncStreamWrapper' object has no attribute 'parse'. The agent returns no response and the error is not clearly linked to the tracing configuration.
Error
AttributeError: 'AsyncStreamWrapper' object has no attribute 'parse'
File "agent_framework_openai/_chat_client.py", line 740, in _stream
async with raw_create_response.parse() as stream_response:
Root Cause
When AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=true, the Azure OpenTelemetry instrumentation wraps the OpenAI responses client, returning an AsyncStreamWrapper instead of the raw OpenAI response object. agent_framework_openai._chat_client calls .parse() on this object at line 740, which AsyncStreamWrapper does not expose.
Impact
- All streaming requests fail completely
- No response is returned to the user
- The error message does not indicate the tracing configuration as the cause, making it hard to diagnose
Workaround
Set AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=false. Side effect: LLM/GenAI spans are not emitted to Application Insights.
Request
Either:
- Make
_chat_client.py handle wrapped response objects from the tracing instrumentation, or
- Document that
AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=true is incompatible with the current streaming implementation
Package Versions
agent-framework-openai: 1.12.0, azure-monitor-opentelemetry: 1.8.7, azure-ai-projects: 2.3.0
Python Version
Python: 3.12
Description
Setting
AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=truecauses all streaming agent requests to fail withAttributeError: 'AsyncStreamWrapper' object has no attribute 'parse'. The agent returns no response and the error is not clearly linked to the tracing configuration.Error
Root Cause
When
AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=true, the Azure OpenTelemetry instrumentation wraps the OpenAI responses client, returning anAsyncStreamWrapperinstead of the raw OpenAI response object.agent_framework_openai._chat_clientcalls.parse()on this object at line 740, whichAsyncStreamWrapperdoes not expose.Impact
Workaround
Set
AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=false. Side effect: LLM/GenAI spans are not emitted to Application Insights.Request
Either:
_chat_client.pyhandle wrapped response objects from the tracing instrumentation, orAZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING=trueis incompatible with the current streaming implementationPackage Versions
agent-framework-openai: 1.12.0, azure-monitor-opentelemetry: 1.8.7, azure-ai-projects: 2.3.0
Python Version
Python: 3.12