An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
Hello @Yatipa Chaleenutthawut ,
Welcome to Microsoft Q&A .Thank you for reaching out to us.
Thank you for sharing the implementation details and error information. After reviewing the reported behavior, two separate issues have been identified. The first relates to streaming event handling when using the Azure AI Projects OpenAI-compatible client, and the second relates to authorization requirements for Agent operations. Since these issues are independent, resolving both areas should help unblock the multi-agent workflow implementation
- Import Error: ResponseStreamEventType Observed Error - cannot import name 'ResponseStreamEventType' from 'azure.ai.projects.models' Analysis : The implementation is using
through an OpenAI-compatible client obtained from:openai_client.conversations.create() openai_client.responses.create(stream=True)
Current Azure AI Projects SDK guidance indicates that Responses and Conversations operations are handled through this OpenAI-compatible client surface. Additionally, SDK engineering guidance indicates that classes related to OpenAI client calls are not exposed through the azure-ai-projects model package. Therefore, importing:project_client.get_openai_client()
is not a supported pattern. Please check if the following helps- Verify installed package versions:from azure.ai.projects.models import ResponseStreamEventTypepip show azure-ai-projects pip show azure-ai-agents pip show openai pip show azure-identity- Review the implementation against the latest SDK samples and Responses API documentation, as older samples may reference components that are no longer available.
- Remove the unsupported import and use the streaming events returned by the Responses API directly.
- Avoid importing from internal modules such as:
since these are not part of the supported public SDK surface and may change between releases.azure.ai.projects._models - If package alignment is required, update to the latest supported releases:
Please note that streaming event structures can vary depending on the installed OpenAI SDK version. The event example below should be treated as illustrative and validated against the SDK version currently installed. for event in stream: print(event.type)pip install --upgrade azure-ai-projects azure-ai-agents openai azure-identity
- Permission Error: Microsoft.MachineLearningServices/workspaces/agents/action Observed Error -
Identity(object id:)does not have permissions forMicrosoft.MachineLearningServices/workspaces/agents/actionAnalysis This error is separate from the SDK import issue. The authentication process is succeeding, but the identity executing the Agent operation does not currently have the permissions required to perform that action. Azure AI Foundry permissions are divided into two areas: Control-plane permissions Used for Azure resource management activities, including roles such as:- Owner
- Contributor
- Agent creation
- Agent execution
- Agent interaction
- Inference operations
- Azure CLI credentials
- Managed Identity
- Service Principal
- Environment credentials
Please check if the following steps help-
- Confirming the runtime identity Verify that the executing identity matches with Azure Entra ID Object ID (GUID) For Azure CLI authentication:
To validate the signed-in identity:az account showaz ad signed-in-user show - Reviewing role assignments Run:
Verify that the identity has the appropriate role assignment at the relevant Foundry project or resource scope.az role assignment list \ --assignee d32d8048-dccd-4e16-8ffb-fe14bdc4f634 \ --all - Validating Foundry permissions Review whether an appropriate Foundry role has been assigned, such as:
- Foundry User
- Foundry Project Manager
- Foundry Owner
- Refreshing authentication After any role assignment changes:
Allow time for RBAC propagation and retry the workflow execution.az logout az login
The ResponseStreamEventType error is caused by using an unsupported import while working with the OpenAI-compatible Responses API surface. Aligning the implementation with the current SDK guidance should resolve that issue.
Separately, the Microsoft.MachineLearningServices/workspaces/agents/action error indicates that the identity executing the Agent operation does not currently have the required data-plane permissions. Validating the runtime identity and its Foundry role assignments should help resolve the remaining authorization blocker.
The following references might be helpful , please check them out
- Azure AI Projects client library for Python | Microsoft Learn
- Build with agents, conversations, and responses in Foundry Agent Service - Microsoft Foundry | Microsoft Learn
- Get started with Microsoft Foundry SDKs and Endpoints - Microsoft Foundry | Microsoft Learn
- Role-based access control for Microsoft Foundry - Microsoft Foundry | Microsoft Learn
- Hosted agent permissions reference - Microsoft Foundry | Microsoft Learn
Thank you
Please "Accept" the answer with an "Upvote" if the response was helpful. This will be benefitting other community members who face the same issue.