Skip to content

Python: Bug: Python v1.35.2 cannot import agents if running azure-ai-agents==1.1.0 #12902

@PranshuBansalDev

Description

@PranshuBansalDev

Describe the bug
Cannot import AzureAIAgent from semantic_kernel.agents

>>> from semantic_kernel.agents import AzureAIAgent
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/venv/lib/python3.12/site-packages/semantic_kernel/agents/__init__.py", line 58, in __getattr__
    module = importlib.import_module(submod_name, package=__name__)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/venv/lib/python3.12/site-packages/semantic_kernel/agents/azure_ai/azure_ai_agent.py", line 39, in <module>
    from semantic_kernel.agents.azure_ai.agent_thread_actions import AgentThreadActions
  File "/home/venv/lib/python3.12/site-packages/semantic_kernel/agents/azure_ai/agent_thread_actions.py", line 8, in <module>
    from azure.ai.agents.models import (
ImportError: cannot import name 'RequiredMcpToolCall' from 'azure.ai.agents.models' (/home/venv/lib/python3.12/site-packages/azure/ai/agents/models/__init__.py). Did you mean: 'RequiredToolCall'?
>>>
KeyboardInterrupt
>>>

To Reproduce
Steps to reproduce the behavior:

  1. python3 -m venv venv
  2. source venv/bin/activate
  3. pip install azure-ai-agents
  4. pip install semantic-kernel
  5. python
  6. from semantic_kernel.agents import AzureAIAgent

Expected behavior
Expect this import to work

Screenshots
If applicable, add screenshots to help explain your problem.

Platform

  • Language: Python
  • Source: semantic-kernel==1.35.2, azure-ai-agents=1.1.0
  • AI model: [e.g. OpenAI:GPT-4o-mini(2024-07-18)]
  • IDE: terminal
  • OS: wsl / Ubuntu 24.04

Additional context
If you reverse the install order (semantic-kernel first) its fine, but I don't think SK should take a dependency on pre-release packages, as it can cause issues if package installation is done out of order

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpythonPull requests for the Python Semantic Kernel

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions