-
Notifications
You must be signed in to change notification settings - Fork 758
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
Environment
- OpenTelemetry Version:
opentelemetry-auto-instrumentation(latest) - Python Version: 3.11.9
- Azure Monitor OpenTelemetry: 1.7.0
- Azure AI Projects SDK: 1.0.0
- Operating System: Windows/Linux (Azure Container Apps)
- Deployment: Azure Container Apps with Application Insights
What happened?
Description
Expected Behavior
Azure AI Agents SDK should work normally with structured response formats when OpenTelemetry HTTP instrumentation is enabled.
Actual Behavior
When OpenTelemetry auto-instrumentation is enabled via Azure Monitor, Azure AI service calls fail with:
OpenAI APIException: Error code: 400 - {
'error': {
'message': 'Unknown response format <class \'dict\'>',
'type': 'invalid_request_error',
'param': None,
'code': None
}
}
Root Cause Analysis
- Azure AI Agents SDK creates
ResponseFormatJsonSchemaTypeobjects for structured responses - OpenTelemetry HTTP instrumentation intercepts and modifies HTTP requests containing these objects
- The serialization/instrumentation process corrupts the response format specification
- Azure AI service receives malformed request and returns the error
Steps to Reproduce
Reproduction Steps
1. Install Dependencies
pip install azure-monitor-opentelemetry==1.7.0
pip install azure-ai-projects==1.0.0
pip install opentelemetry-auto-instrumentation2. Enable Auto-Instrumentation
from azure.monitor.opentelemetry import configure_azure_monitor
# This line enables the problematic instrumentation
configure_azure_monitor(
connection_string="InstrumentationKey=your-key-here"
)3. Create Azure AI Agent with Structured Response
from azure.ai.projects.models import (
ResponseFormatJsonSchemaType,
ResponseFormatJsonSchema
)
from azure.ai.projects import AIProjectClient
# Create response format object
response_format_obj = ResponseFormatJsonSchemaType(
json_schema=ResponseFormatJsonSchema(
name="TestResponse",
description="Test response format",
schema={
"type": "object",
"properties": {
"result": {"type": "string"}
}
},
)
)
# This call FAILS when telemetry is enabled
agent_definition = await ai_project_client.agents.create_agent(
model="gpt-4o",
name="test-agent",
instructions="Test instructions",
response_format=response_format_obj, # ← CAUSES ERROR
)4. Error Occurs
The create_agent call fails with the "Unknown response format" error when OpenTelemetry instrumentation is active.
Expected Result
Expected Behavior
Azure AI Agents SDK should work normally with structured response formats when OpenTelemetry HTTP instrumentation is enabled.
Actual Result
Actual Behavior
When OpenTelemetry auto-instrumentation is enabled via Azure Monitor, Azure AI service calls fail with:
OpenAI APIException: Error code: 400 - {
'error': {
'message': 'Unknown response format <class \'dict\'>',
'type': 'invalid_request_error',
'param': None,
'code': None
}
}
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working