Skip to content

.NET: Migrate .NET samples to Foundry-first ProjectResponsesClient#4394

Open
alliscode wants to merge 3 commits intomicrosoft:mainfrom
alliscode:update-foundry-samples
Open

.NET: Migrate .NET samples to Foundry-first ProjectResponsesClient#4394
alliscode wants to merge 3 commits intomicrosoft:mainfrom
alliscode:update-foundry-samples

Conversation

@alliscode
Copy link
Member

Switch all non-declarative .NET samples from AzureOpenAIClient (ChatCompletion) and CRUD PersistentAgentsClient patterns to code-first ProjectResponsesClient from Azure.AI.Projects.OpenAI, mirroring the Python Foundry-first approach.

Changes:

  • 01-get-started (6 samples): Rewritten with ProjectResponsesClient + snippet tags
  • 02-agents/Agents (16 samples): AzureOpenAIClient -> ProjectResponsesClient
  • 02-agents/FoundryAgents: 13 duplicates deleted, 8 unique samples migrated to code-first
  • Other samples (OpenTelemetry, Memory, RAG, Skills): Migrated to ProjectResponsesClient
  • 03-workflows/FoundryAgent: PersistentAgentsClient -> ProjectResponsesClient
  • Env vars normalized to AZURE_AI_PROJECT_ENDPOINT + AZURE_AI_MODEL_DEPLOYMENT_NAME
  • READMEs, AGENTS.md, start-demo.ps1 updated; SAMPLE_GUIDELINES.md created

Motivation and Context

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings March 2, 2026 16:14
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET workflows Related to Workflows in agent-framework labels Mar 2, 2026
@github-actions github-actions bot changed the title Migrate .NET samples to Foundry-first ProjectResponsesClient .NET: Migrate .NET samples to Foundry-first ProjectResponsesClient Mar 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the .NET samples to a Foundry-first approach by switching from Azure OpenAI ChatCompletions / CRUD agent patterns to code-first ProjectResponsesClient (Azure.AI.Projects.OpenAI) usage, aligning the .NET samples with the Python “Foundry-first” model.

Changes:

  • Rewires sample clients/agents to use ProjectResponsesClient + IChatClient / ChatClientAgent, and normalizes environment variables to AZURE_AI_PROJECT_ENDPOINT + AZURE_AI_MODEL_DEPLOYMENT_NAME.
  • Streamlines FoundryAgents samples by deleting duplicates and focusing the folder on Foundry-specific features (server-side tools, lifecycle/evals).
  • Updates sample docs and adds dotnet/samples/SAMPLE_GUIDELINES.md (including snippet-tag guidance for doc integration).

Reviewed changes

Copilot reviewed 127 out of 128 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
dotnet/samples/SAMPLE_GUIDELINES.md Adds .NET sample conventions, env vars, and snippet-tag requirements for doc integration.
dotnet/samples/AGENTS.md Updates the default provider guidance to Foundry ProjectResponsesClient and the new env var names.
dotnet/samples/03-workflows/Agents/FoundryAgent/Program.cs Migrates workflow sample to code-first agents backed by ProjectResponsesClient (no server-side agent CRUD).
dotnet/samples/03-workflows/Agents/FoundryAgent/FoundryAgent.csproj Updates dependencies to Azure.AI.Projects.OpenAI + MEAI OpenAI and removes persistent-agent provider reference.
dotnet/samples/02-agents/FoundryAgents/README.md Repositions the folder as Foundry-specific features and points general agent scenarios to 02-agents/Agents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step23_LocalMCP/Program.cs Switches to code-first ChatClientAgent + ProjectResponsesClient for MCP tool usage.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step23_LocalMCP/FoundryAgents_Step23_LocalMCP.csproj Updates package/project references to Foundry-first dependencies and core Microsoft.Agents.AI.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step21_WebSearch/Program.cs Moves web-search sample to code-first agent + ProjectResponsesClient with HostedWebSearchTool.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step21_WebSearch/FoundryAgents_Step21_WebSearch.csproj Updates package/project references for Foundry-first web search sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step20_MicrosoftFabric/Program.cs Migrates Fabric tool sample to code-first agent + ProjectResponsesClient.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step20_MicrosoftFabric/FoundryAgents_Step20_MicrosoftFabric.csproj Updates dependencies for Fabric tool sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step19_SharePoint/Program.cs Migrates SharePoint grounding tool sample to code-first agent + ProjectResponsesClient.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step19_SharePoint/FoundryAgents_Step19_SharePoint.csproj Updates dependencies for SharePoint grounding sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step18_BingCustomSearch/Program.cs Migrates Bing Custom Search tool sample to code-first agent + ProjectResponsesClient.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step18_BingCustomSearch/FoundryAgents_Step18_BingCustomSearch.csproj Updates dependencies for Bing Custom Search sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step17_OpenAPITools/Program.cs Migrates OpenAPI tools sample to code-first agent + ProjectResponsesClient.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step17_OpenAPITools/FoundryAgents_Step17_OpenAPITools.csproj Updates dependencies for OpenAPI tools sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step16_FileSearch/Program.cs Splits resource mgmt (files/vector stores) from agent creation; uses code-first agent with HostedFileSearchTool.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step16_FileSearch/FoundryAgents_Step16_FileSearch.csproj Adds Foundry OpenAI package + MEAI OpenAI and updates project reference to core AI.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/Program.cs Migrates code interpreter sample to code-first ChatClientAgent and ResponseTool -> AITool conversion path.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/FoundryAgents_Step14_CodeInterpreter.csproj Updates dependencies for code interpreter sample.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step13_Plugins/README.md Removes duplicate FoundryAgents plugin README (samples moved/covered elsewhere).
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step13_Plugins/Program.cs Removes duplicate FoundryAgents plugin sample implementation.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step13_Plugins/FoundryAgents_Step13_Plugins.csproj Removes duplicate FoundryAgents plugin project file.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step12_Middleware/README.md Removes duplicate FoundryAgents middleware README.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step12_Middleware/Program.cs Removes duplicate FoundryAgents middleware sample implementation.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step12_Middleware/FoundryAgents_Step12_Middleware.csproj Removes duplicate FoundryAgents middleware project file.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/README.md Removes duplicate nested-agent README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/Program.cs Removes duplicate nested-agent sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/FoundryAgents_Step11_AsFunctionTool.csproj Removes duplicate nested-agent project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step10_UsingImages/README.md Removes duplicate vision README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step10_UsingImages/Program.cs Removes duplicate vision sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step10_UsingImages/FoundryAgents_Step10_UsingImages.csproj Removes duplicate vision project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/README.md Removes duplicate MCP README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/Program.cs Removes duplicate MCP client sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/FoundryAgents_Step09_UsingMcpClientAsTools.csproj Removes duplicate MCP project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step08_DependencyInjection/README.md Removes duplicate DI README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step08_DependencyInjection/Program.cs Removes duplicate DI sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step08_DependencyInjection/FoundryAgents_Step08_DependencyInjection.csproj Removes duplicate DI project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step07_Observability/README.md Removes duplicate observability README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step07_Observability/Program.cs Removes duplicate observability sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step07_Observability/FoundryAgents_Step07_Observability.csproj Removes duplicate observability project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step06_PersistedConversations/README.md Removes duplicate persisted conversations README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs Removes duplicate persisted conversations sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step06_PersistedConversations/FoundryAgents_Step06_PersistedConversations.csproj Removes duplicate persisted conversations project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step05_StructuredOutput/README.md Removes duplicate structured output README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step05_StructuredOutput/Program.cs Removes duplicate structured output sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step05_StructuredOutput/FoundryAgents_Step05_StructuredOutput.csproj Removes duplicate structured output project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/README.md Removes duplicate HITL approvals README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/Program.cs Removes duplicate HITL approvals sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/FoundryAgents_Step04_UsingFunctionToolsWithApprovals.csproj Removes duplicate HITL approvals project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/README.md Removes duplicate function-tools README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/Program.cs Removes duplicate function-tools sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/FoundryAgents_Step03_UsingFunctionTools.csproj Removes duplicate function-tools project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/README.md Removes duplicate multi-turn README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/Program.cs Removes duplicate multi-turn sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step02_MultiturnConversation.csproj Removes duplicate multi-turn project file under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step01.2_Running/README.md Removes duplicate “running” README under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step01.2_Running/Program.cs Removes duplicate “running” sample under FoundryAgents.
dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step01.2_Running.csproj Removes duplicate “running” project file under FoundryAgents.
dotnet/samples/02-agents/Agents/README.md Updates Agents README to describe Foundry ProjectResponsesClient as the default provider.
dotnet/samples/02-agents/Agents/Agent_Step17_AdditionalAIContext/Program.cs Migrates to Foundry ProjectResponsesClient and new env vars.
dotnet/samples/02-agents/Agents/Agent_Step17_AdditionalAIContext.csproj Swaps Azure.AI.OpenAI -> Azure.AI.Projects.OpenAI and updates project references.
dotnet/samples/02-agents/Agents/Agent_Step16_Declarative/Program.cs Migrates to Foundry ProjectResponsesClient-based IChatClient.
dotnet/samples/02-agents/Agents/Agent_Step16_Declarative.csproj Updates package and project references for Foundry-first client usage.
dotnet/samples/02-agents/Agents/Agent_Step14_BackgroundResponses/README.md Updates docs to Foundry env vars / provider wording.
dotnet/samples/02-agents/Agents/Agent_Step14_BackgroundResponses/Program.cs Migrates background responses agent construction to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step14_BackgroundResponses.csproj Updates packages/project references for Foundry-first approach.
dotnet/samples/02-agents/Agents/Agent_Step13_ChatReduction/Program.cs Migrates agent creation to Foundry ProjectResponsesClient with in-memory reducer wiring.
dotnet/samples/02-agents/Agents/Agent_Step13_ChatReduction.csproj Updates packages/project references to Foundry-first dependencies.
dotnet/samples/02-agents/Agents/Agent_Step12_Plugins/Program.cs Migrates plugin-based tooling sample to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step12_Plugins.csproj Updates dependencies for plugin tooling sample.
dotnet/samples/02-agents/Agents/Agent_Step11_Middleware/README.md Updates middleware sample docs to Foundry provider + new env vars.
dotnet/samples/02-agents/Agents/Agent_Step11_Middleware/Program.cs Migrates chat-client pipeline middleware sample to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step11_Middleware.csproj Updates dependencies to Foundry-first packages and core references.
dotnet/samples/02-agents/Agents/Agent_Step10_BackgroundResponsesWithToolsAndPersistence/README.md Updates docs to Foundry provider + new env vars.
dotnet/samples/02-agents/Agents/Agent_Step10_BackgroundResponsesWithToolsAndPersistence/Program.cs Migrates background responses + tools sample to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step10_BackgroundResponsesWithToolsAndPersistence.csproj Updates dependencies for background responses + tools sample.
dotnet/samples/02-agents/Agents/Agent_Step09_AsFunctionTool/Program.cs Migrates nested-agent-as-tool sample to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step09_AsFunctionTool.csproj Updates dependencies for nested-agent-as-tool sample.
dotnet/samples/02-agents/Agents/Agent_Step08_UsingImages/README.md Updates vision sample docs to Foundry env vars/provider wording.
dotnet/samples/02-agents/Agents/Agent_Step08_UsingImages/Program.cs Migrates vision agent construction to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step08_UsingImages.csproj Updates dependencies for vision sample.
dotnet/samples/02-agents/Agents/Agent_Step07_AsMcpTool/Program.cs Migrates MCP tool exposure sample from persistent agents to code-first Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step07_AsMcpTool.csproj Updates dependencies (removes persistent agents, adds Foundry OpenAI package).
dotnet/samples/02-agents/Agents/Agent_Step06_DependencyInjection/Program.cs Migrates DI sample to register Foundry ProjectResponsesClient-backed IChatClient.
dotnet/samples/02-agents/Agents/Agent_Step06_DependencyInjection.csproj Updates dependencies for DI sample.
dotnet/samples/02-agents/Agents/Agent_Step05_Observability/Program.cs Migrates OTel sample agent creation to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step05_Observability.csproj Updates dependencies for observability sample.
dotnet/samples/02-agents/Agents/Agent_Step04_3rdPartyChatHistoryStorage/Program.cs Migrates sample agent creation to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step04_3rdPartyChatHistoryStorage.csproj Updates dependencies for 3rd-party storage sample.
dotnet/samples/02-agents/Agents/Agent_Step03_PersistedConversations/Program.cs Migrates persisted conversations sample to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step03_PersistedConversations.csproj Updates dependencies for persisted conversations sample.
dotnet/samples/02-agents/Agents/Agent_Step02_StructuredOutput/README.md Updates structured output sample docs to Foundry env vars/provider wording.
dotnet/samples/02-agents/Agents/Agent_Step02_StructuredOutput/Program.cs Migrates structured output sample to IChatClient from Foundry ProjectResponsesClient.
dotnet/samples/02-agents/Agents/Agent_Step02_StructuredOutput.csproj Updates dependencies for structured output sample.
dotnet/samples/02-agents/Agents/Agent_Step01_UsingFunctionToolsWithApprovals/Program.cs Migrates approvals sample to Foundry ProjectResponsesClient and new env vars.
dotnet/samples/02-agents/Agents/Agent_Step01_UsingFunctionToolsWithApprovals.csproj Updates dependencies for approvals sample.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs Migrates chat agent to Foundry ProjectResponsesClient while keeping embeddings separate.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource.csproj Updates dependencies and project references for Foundry-first agent construction.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md Updates docs for Foundry-first agent chat + separate Azure OpenAI embeddings.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/Program.cs Migrates chat agent to Foundry ProjectResponsesClient and keeps embeddings via AzureOpenAIClient.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG.csproj Adds Foundry OpenAI package and updates project references.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/Program.cs Migrates chat agent to Foundry ProjectResponsesClient and keeps embeddings via AzureOpenAIClient.
dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG.csproj Adds Foundry OpenAI package and updates project references.
dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs Migrates agent construction to Foundry ProjectResponsesClient with Mem0 integration.
dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0.csproj Updates dependencies for Mem0 memory sample.
dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/Program.cs Migrates chat agent to Foundry ProjectResponsesClient while keeping embedding client for memory store.
dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory.csproj Adds Foundry OpenAI package and updates project references.
dotnet/samples/02-agents/AgentSkills/Agent_Step01_BasicSkills/README.md Updates skill sample docs to Foundry env vars/provider wording.
dotnet/samples/02-agents/AgentSkills/Agent_Step01_BasicSkills/Program.cs Migrates skills agent construction to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/AgentSkills/Agent_Step01_BasicSkills.csproj Updates dependencies for skills sample.
dotnet/samples/02-agents/AgentOpenTelemetry/start-demo.ps1 Updates demo startup checks/messages to new Foundry env vars.
dotnet/samples/02-agents/AgentOpenTelemetry/README.md Updates demo docs to Foundry provider + new env vars.
dotnet/samples/02-agents/AgentOpenTelemetry/Program.cs Migrates instrumented chat client construction to Foundry ProjectResponsesClient.
dotnet/samples/02-agents/AgentOpenTelemetry/AgentOpenTelemetry.csproj Updates dependencies and removes direct OpenAI package reference.
dotnet/samples/01-get-started/06_host_your_agent/Program.cs Migrates Functions-hosted agent to ProjectResponsesClient + snippet tags.
dotnet/samples/01-get-started/06_host_your_agent/06_host_your_agent.csproj Updates dependencies to Foundry OpenAI + MEAI OpenAI and core AI reference.
dotnet/samples/01-get-started/05_first_workflow/Program.cs Adds snippet tags around workflow construction and execution.
dotnet/samples/01-get-started/04_memory/Program.cs Migrates memory sample to Foundry ProjectResponsesClient, explicit ChatClientAgent, and snippet tags.
dotnet/samples/01-get-started/04_memory/04_memory.csproj Updates dependencies to Foundry OpenAI + core AI reference.
dotnet/samples/01-get-started/03_multi_turn/Program.cs Migrates multi-turn sample to Foundry ProjectResponsesClient + explicit ChatClientAgent + snippet tags.
dotnet/samples/01-get-started/03_multi_turn/03_multi_turn.csproj Updates dependencies to Foundry OpenAI + core AI reference.
dotnet/samples/01-get-started/02_add_tools/Program.cs Migrates tools sample to Foundry ProjectResponsesClient, explicit agent, and snippet tags.
dotnet/samples/01-get-started/02_add_tools/02_add_tools.csproj Updates dependencies to Foundry OpenAI + core AI reference.
dotnet/samples/01-get-started/01_hello_agent/Program.cs Migrates hello agent to Foundry ProjectResponsesClient, explicit agent, and snippet tags.
dotnet/samples/01-get-started/01_hello_agent/01_hello_agent.csproj Updates dependencies to Foundry OpenAI + core AI reference (adds Azure.AI.Projects reference).

@alliscode
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Switch all .NET samples from model: prefix on AgentReference (which sends
'placeholder' over the wire via MEAI adapter) to ChatOptions.ModelId pattern.

Changes:
- All 36 sample Program.cs files updated to use ChatClientAgentOptions with
  ChatOptions.ModelId = deploymentName instead of defaultAgent: new
  AgentReference(model:deploymentName)
- AGENTS.md and SAMPLE_GUIDELINES.md updated with correct code patterns
- dotnet format applied to all changed projects

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 134 out of 135 changed files in this pull request and generated 2 comments.

Comment on lines 29 to 32
```powershell
$env:AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/" # Replace with your Azure OpenAI resource endpoint
$env:AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini" # Optional, defaults to gpt-4o-mini
$env:AZURE_AI_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com" # Replace with your Azure AI Foundry project endpoint
$env:AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o-mini" # Optional, defaults to gpt-4o-mini
```
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The AZURE_AI_PROJECT_ENDPOINT example value is missing the /api/projects/<project> path segment required for Foundry project endpoints. With ProjectResponsesClient, using the base host URL will cause requests to target the wrong endpoint.

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 27
```powershell
$env:AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/" # Replace with your Azure OpenAI resource endpoint
$env:AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o-mini" # Optional, defaults to gpt-4o-mini
$env:AZURE_AI_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com" # Replace with your Azure AI Foundry project endpoint
$env:AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o-mini" # Optional, defaults to gpt-4o-mini
``` No newline at end of file
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The AZURE_AI_PROJECT_ENDPOINT example is a base host URL, but ProjectResponsesClient expects a full Foundry project endpoint including /api/projects/<project>. As written, users following these instructions are likely to configure a non-working endpoint.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants