Skip to content

fix(lesson-02): replace deprecated AzureAIProjectAgentProvider and add missing semantic-kernel install#576

Merged
leestott merged 3 commits into
microsoft:mainfrom
jorgedoiany:fix/lesson-02-explore-agentic-frameworks
Jun 23, 2026
Merged

fix(lesson-02): replace deprecated AzureAIProjectAgentProvider and add missing semantic-kernel install#576
leestott merged 3 commits into
microsoft:mainfrom
jorgedoiany:fix/lesson-02-explore-agentic-frameworks

Conversation

@jorgedoiany

@jorgedoiany jorgedoiany commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Updates lesson 02 notebooks to fix two issues found when running in GitHub Codespaces with the latest dependencies from requirements.txt.

Problem

Issue 1 - 02-python-agent-framework.ipynb:
AzureAIProjectAgentProvider was removed in agent-framework v1.8.x and is no longer available under agent_framework.azure.

ImportError: cannot import name 'AzureAIProjectAgentProvider' from 'agent_framework.azure'

Issue 2 - 02-semantic-kernel.ipynb:
The notebook uses semantic_kernel but it is not listed in requirements.txt and is not pre-installed in the Codespace environment.

ModuleNotFoundError: No module named 'semantic_kernel'

Root Cause

Issue 1: The agent-framework library underwent a breaking change where Foundry-related clients were moved from agent_framework.azure to agent_framework.foundry.

Reference: https://learn.microsoft.com/en-us/agent-framework/support/upgrade/python-2026-significant-changes

Issue 2: semantic-kernel is a required dependency for this notebook but is missing from requirements.txt.

Changes

Before After
from agent_framework.azure import AzureAIProjectAgentProvider from agent_framework.foundry import FoundryChatClient
AzureAIProjectAgentProvider(credential=...) FoundryChatClient(project_endpoint=..., model=..., credential=...)
provider.create_agent(name=..., instructions=..., tools=...) provider.as_agent(name=..., instructions=..., tools=...)
  • Added %pip install semantic-kernel -q at the top of 02-semantic-kernel.ipynb
  • Applied all fixes to both English and Spanish (translations/es) notebooks

Testing

Verified working in GitHub Codespaces with:

  • agent-framework: 1.8.1
  • Python: 3.12.13
  • azure-identity: 1.25.3
  • azure-ai-projects: 2.2.0

Related

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor

Copilot AI review requested due to automatic review settings June 11, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the agentic framework notebooks to be easier to run and align with the newer Foundry-based client, while also improving notebook metadata/formatting and adding an installation step for Semantic Kernel.

Changes:

  • Add a %pip install semantic-kernel cell to the Semantic Kernel notebooks.
  • Migrate the Python Agent Framework notebooks from agent_framework.azure provider usage to agent_framework.foundry (FoundryChatClient) with env-var configuration loading.
  • Normalize notebook disclaimer formatting and update kernelspec metadata/version fields.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
translations/es/02-explore-agentic-frameworks/code_samples/02-semantic-kernel.ipynb Adds SK install cell; adjusts disclaimer formatting and kernelspec metadata.
translations/es/02-explore-agentic-frameworks/code_samples/02-python-agent-framework.ipynb Switches to Foundry client + dotenv-based env loading; updates disclaimer and kernelspec metadata.
02-explore-agentic-frameworks/code_samples/02-semantic-kernel.ipynb Adds SK install cell, but also commits executed outputs and execution counts.
02-explore-agentic-frameworks/code_samples/02-python-agent-framework.ipynb Switches to Foundry client + dotenv-based env loading.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +33
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m25.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m26.1.2\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install semantic-kernel -q"
]
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in the latest commit. Cleared all cell outputs and reset execution counts. Also pinned semantic-kernel to a specific version for reproducibility.

Comment on lines 46 to +58
"import logging\n",
"logging.getLogger(\"agent_framework.azure\").setLevel(logging.ERROR)\n",
"logging.getLogger(\"agent_framework.foundry\").setLevel(logging.ERROR)\n",
"\n",
"import os\n",
"import asyncio\n",
"import dotenv\n",
"from typing import Annotated\n",
"\n",
"from agent_framework import tool\n",
"from agent_framework.azure import AzureAIProjectAgentProvider\n",
"from azure.identity import AzureCliCredential"
"from agent_framework.foundry import FoundryChatClient\n",
"from azure.identity import AzureCliCredential\n",
"\n",
"dotenv.load_dotenv(dotenv.find_dotenv())"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in the latest commit. Added %pip install python-dotenv -q to the install cell in both the English and Spanish notebooks.

Comment on lines 46 to +58
"import logging\n",
"logging.getLogger(\"agent_framework.azure\").setLevel(logging.ERROR)\n",
"logging.getLogger(\"agent_framework.foundry\").setLevel(logging.ERROR)\n",
"\n",
"import os\n",
"import asyncio\n",
"import dotenv\n",
"from typing import Annotated\n",
"\n",
"from agent_framework import tool\n",
"from agent_framework.azure import AzureAIProjectAgentProvider\n",
"from azure.identity import AzureCliCredential"
"from agent_framework.foundry import FoundryChatClient\n",
"from azure.identity import AzureCliCredential\n",
"\n",
"dotenv.load_dotenv(dotenv.find_dotenv())"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in the latest commit. Added %pip install python-dotenv -q to the install cell in both the English and Spanish notebooks.

Comment on lines +91 to +98
"endpoint = os.getenv(\"AZURE_AI_PROJECT_ENDPOINT\")\n",
"model = os.getenv(\"AZURE_AI_MODEL_DEPLOYMENT_NAME\")\n",
"\n",
"if not endpoint or not model:\n",
" raise ValueError(\n",
" \"Missing required environment variables. \"\n",
" \"Please set AZURE_AI_PROJECT_ENDPOINT and AZURE_AI_MODEL_DEPLOYMENT_NAME in your .env file.\"\n",
" )\n",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in the latest commit. Updated the error message to mention both .env file and shell environment variables as valid options.

"metadata": {},
"outputs": [],
"source": [
"%pip install semantic-kernel -q"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in the latest commit. Cleared all cell outputs and reset execution counts. Also pinned semantic-kernel to a specific version for reproducibility.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for contributing @jorgedoiany! We will review the pull request and get back to you soon.

…improve error message, pin semantic-kernel version and clear outputs
@leestott

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

@leestott leestott merged commit fab18d9 into microsoft:main Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(lesson-02): AzureAIProjectAgentProvider removed and missing semantic-kernel install

4 participants