Skip to content

azure-monitor-opentelemetry in 1.6.10 version not able to run for azure-ai-agents sdk #41766

Open
@Bhavyakala

Description

@Bhavyakala
Traceback (most recent call last):
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\src\app.py", line 34, in run_async
    await self.planner_agent.create_async()
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\src\planner\planner_agent.py", line 120, in create_async
    agent = self.agent_client.create_agent(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\venv\Lib\site-packages\azure\ai\agents\telemetry\_ai_agents_instrumentor.py", line 1459, in inner
    return self.trace_create_agent(function, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\venv\Lib\site-packages\azure\ai\agents\telemetry\_ai_agents_instrumentor.py", line 825, in trace_create_agent
    span = self.start_create_agent_span(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\venv\Lib\site-packages\azure\ai\agents\telemetry\_ai_agents_instrumentor.py", line 746, in start_create_agent_span
    response_format=_AIAgentsInstrumentorPreview.agent_api_response_to_str(response_format),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\t-kalabhavya\source\repos\azure-migrate-ai-eval-system\venv\Lib\site-packages\azure\ai\agents\telemetry\_ai_agents_instrumentor.py", line 633, in agent_api_response_to_str
    raise ValueError(f"Unknown response format {type(response_format)}")
ValueError: Unknown response format <class 'dict'>

When creating an agent using the AgentsClient SDK's create_agent function with response_format="json", the execution fails due to an unknown issue (stacktrace above). As a result, we are currently unable to use this configuration.

We have enabled via below:

import os
os.environ["AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED"] = "true"  # Disabled by default

This setting enables tracing of GenAI prompts and responses, which is disabled by default.

reference:
azure-monitor-opentelemetry==1.6.10
azure-ai-agents==1.0.0

https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/develop/trace-agents-sdk

Metadata

Metadata

Assignees

Labels

AI AgentsMonitorMonitor, Monitor Ingestion, Monitor QueryOpenTelemetryOpenTelemetry instrumentation (not Monitor-specific)Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions