fix(lesson-09): replace deprecated AzureAIProjectAgentProvider with FoundryChatClient#597
fix(lesson-09): replace deprecated AzureAIProjectAgentProvider with FoundryChatClient#597jorgedoiany wants to merge 1 commit into
Conversation
|
👋 Thanks for contributing @jorgedoiany! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the Azure agent sample notebooks to use the Azure AI Foundry client and more flexible credential/env-var configuration.
Changes:
- Switched from
AzureAIProjectAgentProvider/AzureCliCredentialtoFoundryChatClient/DefaultAzureCredential - Added
.envsupport viapython-dotenvand validated required environment variables - Reformatted the Spanish translation disclaimer markdown cell
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| translations/es/09-metacognition/code_samples/09-python-agent-framework.ipynb | Migrates the Spanish notebook to Foundry client + dotenv config, and adjusts markdown formatting. |
| 09-metacognition/code_samples/09-python-agent-framework.ipynb | Migrates the main notebook to Foundry client + dotenv config and updates runtime metadata. |
Comments suppressed due to low confidence (1)
translations/es/09-metacognition/code_samples/09-python-agent-framework.ipynb:1
- This is the Spanish translation notebook, but the newly added runtime error message is in English. To keep the translated content consistent and user-friendly, translate this message to Spanish (keeping the env var keys unchanged), or reference a shared bilingual message pattern used elsewhere in the translated materials.
{
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "source": [ | ||
| "\n", | ||
| "provider = AzureAIProjectAgentProvider(credential=AzureCliCredential())" | ||
| "# Create the Azure AI Foundry client\n", |
There was a problem hiding this comment.
Following standard industry practice and Microsoft's own convention in this repository, code comments and error messages are intentionally kept in English even in translated notebooks. Translating runtime messages and code comments would be inconsistent with the rest of the codebase.
Description
Updates lesson 09 notebook to use the current Microsoft Agent Framework API.
AzureAIProjectAgentProviderwas removed inagent-frameworkv1.8.x and is no longer available underagent_framework.azure.Problem
Running the notebook fails immediately with:
Root Cause
The
agent-frameworklibrary underwent a breaking change where Foundry-related clients were moved fromagent_framework.azuretoagent_framework.foundry.Reference: https://learn.microsoft.com/en-us/agent-framework/support/upgrade/python-2026-significant-changes
Changes
from agent_framework.azure import AzureAIProjectAgentProviderfrom agent_framework.foundry import FoundryChatClientAzureAIProjectAgentProvider(credential=AzureCliCredential())FoundryChatClient(project_endpoint=..., model=..., credential=DefaultAzureCredential())provider.create_agent(name=..., instructions=..., tools=...)client.as_agent(name=..., instructions=..., tools=...)providertoclientfor clarityAzureCliCredentialwithDefaultAzureCredentialfor better portability%pip installinstead of! pip installpython-dotenvto install celltranslations/es) notebooksTesting
Verified working in GitHub Codespaces with:
Related
Type of Change