Repository navigation
Python: [Python/.NET] Normalize Foundry sample configuration - #9070
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Several affected samples still expose or prioritize legacy configuration names, leaving the cross-language contract inconsistent.
Review effort: Balanced
Findings: 3
Open (4)
What changed in this PR
Normalizes Microsoft Foundry endpoint and model configuration across Python and .NET samples while preserving hosted-agent compatibility.
Changes:
- Standardizes project-scoped endpoints and
FOUNDRY_*variables. - Adds hosted Python model-variable fallbacks.
- Aligns sample verification metadata and CI environments.
| File | Description |
|---|---|
README.md |
Updates .NET configuration names. |
python/scripts/sample_validation/skills/foundry-hosted-agent-validation/SKILL.md |
Documents local and hosted model variables. |
python/samples/SAMPLE_GUIDELINES.md |
Corrects the endpoint example. |
python/samples/05-end-to-end/evaluation/self_reflection/README.md |
Uses a project-scoped endpoint. |
python/samples/05-end-to-end/evaluation/self_reflection/.env.example |
Updates the endpoint template. |
python/samples/04-hosting/mcp/README.md |
Updates Foundry setup. |
python/samples/04-hosting/foundry-hosted-agents/responses/workflows/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/workflows/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/tools/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/tools/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/main.py |
Normalizes model configuration. |
python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/resilient_long_running_workflow/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/observability/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/observability/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/monty_codeact/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/mcp/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/mcp/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md |
Updates required variables. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/README.md |
Normalizes model variables. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py |
Normalizes provisioning configuration. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/.env.example |
Updates chat and embedding variables. |
python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md |
Updates required variables. |
python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/files/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/README.md |
Updates required variables. |
python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/service_history.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/README.md |
Updates local configuration. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/provider_background.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/options.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/agent_history.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/basic/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/README.md |
Documents local and hosted contracts. |
python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/tests/test_main.py |
Updates test configuration. |
python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/deploy.sh |
Removes obsolete endpoint variable. |
python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/azure.yaml |
Uses the normalized endpoint. |
python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/foundry-hosted-agents/invocations/basic/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/foundry-hosted-agents/invocations/basic/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/container/hyperlight_codeact/main.py |
Adds model-variable fallback. |
python/samples/04-hosting/container/hyperlight_codeact/.env.example |
Uses FOUNDRY_MODEL. |
python/samples/04-hosting/af-hosting/local_telegram/README.md |
Corrects endpoint guidance. |
python/samples/04-hosting/af-hosting/local_responses/README.md |
Corrects endpoint guidance. |
python/samples/04-hosting/af-hosting/local_responses/app.py |
Corrects embedded setup instructions. |
python/samples/04-hosting/af-hosting/local_responses_workflow/README.md |
Corrects endpoint guidance. |
python/samples/04-hosting/af-hosting/local_responses_workflow/app.py |
Corrects embedded setup instructions. |
python/samples/04-hosting/af-hosting/local_responses_harness/README.md |
Corrects endpoint guidance. |
python/samples/04-hosting/af-hosting/local_responses_harness/app.py |
Corrects embedded setup instructions. |
python/samples/02-agents/providers/foundry/foundry_agent_basic.py |
Corrects the endpoint example. |
python/samples/02-agents/observability/README.md |
Corrects the endpoint example. |
python/samples/02-agents/multimodal_input/README.md |
Corrects the endpoint example. |
python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/README.md |
Clarifies hosted model configuration. |
python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/hosted.py |
Adds model-variable fallback. |
python/samples/02-agents/devui/README.md |
Corrects endpoint guidance. |
python/samples/02-agents/devui/agent_weather/.env.example |
Corrects the endpoint template. |
python/samples/02-agents/devui/agent_foundry/.env.example |
Corrects the endpoint template. |
python/samples/02-agents/devui/agent_content_understanding_file_search_foundry/README.md |
Corrects Foundry setup. |
python/samples/02-agents/devui/agent_content_understanding_file_search_azure_openai/README.md |
Corrects project endpoint setup. |
python/samples/02-agents/devui/.env.example |
Corrects the endpoint template. |
python/samples/02-agents/context_providers/azure_content_understanding/README.md |
Normalizes Foundry setup. |
python/samples/01-get-started/04_memory.py |
Corrects the endpoint example. |
python/samples/01-get-started/03_multi_turn.py |
Corrects the endpoint example. |
python/samples/01-get-started/02_add_tools.py |
Corrects the endpoint example. |
python/samples/01-get-started/01_hello_agent.py |
Corrects the endpoint example. |
python/packages/azure-cosmos-memory/README.md |
Updates project endpoint shapes. |
python/packages/azure-cosmos-memory/AGENTS.md |
Updates provider endpoint guidance. |
python/packages/azure-contentunderstanding/README.md |
Normalizes Foundry configuration. |
python/.env.example |
Updates endpoint terminology. |
dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/README.md |
Normalizes the client endpoint variable. |
dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/Program.cs |
Uses the normalized endpoint variable. |
dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs |
Normalizes endpoint handling. |
dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs |
Normalizes endpoint handling. |
dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md |
Updates required variables. |
dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md |
Normalizes sample setup. |
dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs |
Uses normalized variables. |
dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md |
Corrects the endpoint example. |
dotnet/eng/verify-samples/AgentsSamples.cs |
Aligns verifier environment metadata. |
dotnet/.github/skills/verify-samples-tool/SKILL.md |
Updates verifier guidance. |
.github/workflows/python-sample-validation.yml |
Aligns Python validation variables. |
.github/workflows/dotnet-verify-samples.yml |
Aligns .NET validation variables. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Python, C# Python / code-coverage/pythonThe overall line coverage in commit d634f0f in the Show a line coverage summary of the most covered files.
C# / code-coverage/dotnetThe overall line coverage in commit d634f0f in the Show a line coverage summary of the most covered files.
Updated |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (2 commit(s)): 5a0e5cb11871, 34f2b048954e
Model: gpt-5.6-sol
Overview
The PR consistently moves local samples to project-scoped endpoints and FOUNDRY_* model names, while hosted Python paths generally preserve the azd-managed chat-model fallback and validation workflows exercise the normalized configuration. Repository guidance and client tests reinforce the intended endpoint contract. The memory-store provisioning script does not preserve the previously documented embedding-model variable, leaving existing local configurations unable to provision the store.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py
Jose Alvarez (jpalvarezl)
left a comment
There was a problem hiding this comment.
Approved. The configuration normalization is consistent across the affected Python and .NET samples, compatibility fallbacks are preserved for hosted deployments, and CI is green. One non-blocking documentation nit is noted inline.


Motivation & Context
Agent Framework samples and guidance used a mix of account-root Foundry URLs, project-scoped URLs, and legacy environment-variable names. This made otherwise equivalent Python and .NET samples require different configuration and could direct users to an invalid project endpoint.
Description & Review Guide
/api/projects/<project>throughout affected samples and READMEs.FOUNDRY_PROJECT_ENDPOINT,FOUNDRY_MODEL, andFOUNDRY_EMBEDDING_MODELin sample-facing configuration.AZURE_AI_MODEL_DEPLOYMENT_NAMEcontract in hosted-agent manifests and use it only as a runtime compatibility fallback.FOUNDRY_*configuration and the retained azd-managed hosted-agent variable.Related Issue
N/A
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.