diff --git a/.github/workflows/dotnet-verify-samples.yml b/.github/workflows/dotnet-verify-samples.yml index 3855914f6c9..2d4546d8dbe 100644 --- a/.github/workflows/dotnet-verify-samples.yml +++ b/.github/workflows/dotnet-verify-samples.yml @@ -106,12 +106,9 @@ jobs: AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }} AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }} # Microsoft Foundry - AZURE_AI_PROJECT_ENDPOINT: ${{ vars.AZURE_AI_PROJECT_ENDPOINT }} - AZURE_AI_MODEL_DEPLOYMENT_NAME: ${{ vars.AZURE_AI_MODEL_DEPLOYMENT_NAME }} - AZURE_AI_BING_CONNECTION_ID: ${{ vars.AZURE_AI_BING_CONNECTION_ID }} - # Foundry FOUNDRY_PROJECT_ENDPOINT: ${{ vars.FOUNDRY_PROJECT_ENDPOINT }} FOUNDRY_MODEL: ${{ vars.FOUNDRY_MODEL }} + AZURE_AI_BING_CONNECTION_ID: ${{ vars.AZURE_AI_BING_CONNECTION_ID }} - name: Write Job Summary if: always() diff --git a/.github/workflows/python-sample-validation.yml b/.github/workflows/python-sample-validation.yml index 28ca36b9f1b..a54b3c7ba3d 100644 --- a/.github/workflows/python-sample-validation.yml +++ b/.github/workflows/python-sample-validation.yml @@ -628,7 +628,6 @@ jobs: FOUNDRY_PROJECT_ENDPOINT: ${{ vars.FOUNDRY_PROJECT_ENDPOINT }} FOUNDRY_MODEL: ${{ vars.FOUNDRY_MODEL }} # Foundry hosted agent configuration - AZURE_AI_MODEL_DEPLOYMENT_NAME: ${{ vars.FOUNDRY_MODEL }} FOUNDRY_PROJECT_ID: ${{ vars.FOUNDRY_PROJECT_ID }} AZURE_CONTAINER_REGISTRY_ENDPOINT: ${{ vars.AZURE_CONTAINER_REGISTRY_ENDPOINT }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index ede113551eb..d8ea282064f 100644 --- a/README.md +++ b/README.md @@ -150,8 +150,8 @@ using Azure.AI.Projects; using Azure.Identity; using Microsoft.Agents.AI; -string endpoint = Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set."); -string deploymentName = Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-5.4-mini"; +string endpoint = Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); +string deploymentName = Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5.4-mini"; AIAgent agent = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential()) diff --git a/dotnet/.github/skills/verify-samples-tool/SKILL.md b/dotnet/.github/skills/verify-samples-tool/SKILL.md index 3c154e56d59..ca71bd9b5ee 100644 --- a/dotnet/.github/skills/verify-samples-tool/SKILL.md +++ b/dotnet/.github/skills/verify-samples-tool/SKILL.md @@ -45,7 +45,7 @@ The tool itself needs: - `AZURE_OPENAI_ENDPOINT` — for the AI verification agent - `AZURE_OPENAI_DEPLOYMENT_NAME` (optional, defaults to `gpt-5-mini`) -Individual samples require their own env vars (e.g., `AZURE_AI_PROJECT_ENDPOINT`). The tool automatically checks and skips samples with missing env vars. +Individual samples require their own env vars (for example, `FOUNDRY_PROJECT_ENDPOINT`). The tool automatically checks and skips samples with missing env vars. ### Output Files @@ -188,8 +188,8 @@ new SampleDefinition { Name = "FoundryAgent_Hosted_MCP", ProjectPath = "samples/02-agents/ModelContextProtocol/FoundryAgent_Hosted_MCP", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["Y", "Y", "Y", "Y", "Y"], InputDelayMs = 5000, ExpectedOutputDescription = ["The output should show an agent using the Microsoft Learn MCP tool with approval prompts."], @@ -203,8 +203,8 @@ new SampleDefinition { Name = "Workflow_Declarative_FunctionTools", ProjectPath = "samples/03-workflows/Declarative/FunctionTools", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["What are today's specials?", "EXIT"], InputDelayMs = 8000, ExpectedOutputDescription = ["The output should show a workflow calling function tools to answer a question about restaurant specials."], @@ -224,4 +224,3 @@ new SampleDefinition }, ``` - diff --git a/dotnet/eng/verify-samples/AgentsSamples.cs b/dotnet/eng/verify-samples/AgentsSamples.cs index f8cc340e9cb..3caac4bb037 100644 --- a/dotnet/eng/verify-samples/AgentsSamples.cs +++ b/dotnet/eng/verify-samples/AgentsSamples.cs @@ -54,8 +54,8 @@ internal static class AgentsSamples { Name = "Agent_With_AzureAIProject", ProjectPath = "samples/02-agents/AgentProviders/azure/Agent_With_AzureAIProject", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], MustContain = ["Latest agent version id:"], ExpectedOutputDescription = [ @@ -69,7 +69,7 @@ internal static class AgentsSamples Name = "Agent_With_AzureFoundryModel", ProjectPath = "samples/02-agents/AgentProviders/azure/Agent_With_AzureFoundryModel", RequiredEnvironmentVariables = ["AZURE_OPENAI_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_OPENAI_API_KEY", "AZURE_AI_MODEL_DEPLOYMENT_NAME"], + OptionalEnvironmentVariables = ["AZURE_OPENAI_API_KEY", "FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain a joke about a pirate.", @@ -464,8 +464,8 @@ internal static class AgentsSamples { Name = "AgentWithMemory_Step04_MemoryUsingFoundry", ProjectPath = "samples/02-agents/AgentWithMemory/AgentWithMemory_Step04_MemoryUsingFoundry", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MEMORY_STORE_ID", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "AZURE_AI_EMBEDDING_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["AZURE_AI_MEMORY_STORE_ID", "FOUNDRY_MODEL", "AZURE_AI_EMBEDDING_DEPLOYMENT_NAME"], MustContain = [ ">> Setting up Foundry Memory Store", @@ -590,8 +590,8 @@ internal static class AgentsSamples { Name = "AgentWithRAG_Step04_FoundryServiceRAG", ProjectPath = "samples/02-agents/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], MustContain = [">> Asking about returns", ">> Asking about shipping", ">> Asking about product care"], ExpectedOutputDescription = [ @@ -608,8 +608,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step00_FoundryAgentLifecycle", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step00_FoundryAgentLifecycle", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain a joke about a pirate.", @@ -621,8 +621,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step01_Basics", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step01_Basics", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain a joke response from the agent.", @@ -634,8 +634,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step02.1_MultiturnConversation", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step02.1_MultiturnConversation", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain multiple joke responses showing a multi-turn conversation.", @@ -648,8 +648,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step02.2_MultiturnWithServerConversations", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step02.2_MultiturnWithServerConversations", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain multiple joke responses showing a multi-turn conversation.", @@ -661,8 +661,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step03_UsingFunctionTools", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step03_UsingFunctionTools", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain weather information about Amsterdam from a function tool.", @@ -676,8 +676,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step04_UsingFunctionToolsWithApprovals", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step04_UsingFunctionToolsWithApprovals", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["Y", "Y", "Y"], InputDelayMs = 3000, ExpectedOutputDescription = @@ -692,8 +692,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step05_StructuredOutput", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step05_StructuredOutput", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], MustContain = ["Assistant Output:", "Name:"], ExpectedOutputDescription = [ @@ -707,8 +707,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step06_PersistedConversations", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step06_PersistedConversations", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain a pirate joke, then after session persistence, a second response retelling the joke in pirate voice with emojis.", @@ -720,8 +720,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step08_DependencyInjection", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step08_DependencyInjection", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["Tell me a joke about a pirate", ""], InputDelayMs = 5000, ExpectedOutputDescription = @@ -735,8 +735,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step10_UsingImages", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step10_UsingImages", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should describe an image of a nature walkway or boardwalk scene.", @@ -749,8 +749,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step11_AsFunctionTool", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should be a response about the weather in Amsterdam, written in French.", @@ -763,8 +763,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step12_Middleware", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step12_Middleware", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["Y", "Y", "Y"], InputDelayMs = 3000, ExpectedOutputDescription = @@ -779,8 +779,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step13_Plugins", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step13_Plugins", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain information about both the current time and the weather in Seattle.", @@ -793,8 +793,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step14_CodeInterpreter", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step14_CodeInterpreter", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should show the code interpreter being used to solve sin(x) + x^2 = 42, including a 'Code Input:' section with Python code.", @@ -808,8 +808,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step16_FileSearch", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step16_FileSearch", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], MustContain = ["--- Running File Search Agent ---"], ExpectedOutputDescription = [ @@ -822,8 +822,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step17_OpenAPITools", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step17_OpenAPITools", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should contain the current EUR exchange rate against USD and GBP as numeric values.", @@ -964,8 +964,8 @@ internal static class AgentsSamples { Name = "Agent_Step07_AsMcpTool", ProjectPath = "samples/02-agents/Agents/Agent_Step07_AsMcpTool", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], SkipReason = "Runs as an MCP stdio server that does not exit on its own.", }, @@ -973,7 +973,7 @@ internal static class AgentsSamples { Name = "Agent_Step15_DeepResearch", ProjectPath = "samples/02-agents/Agents/Agent_Step15_DeepResearch", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "AZURE_AI_BING_CONNECTION_ID"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "FOUNDRY_MODEL", "AZURE_AI_BING_CONNECTION_ID"], OptionalEnvironmentVariables = ["AZURE_AI_REASONING_DEPLOYMENT_NAME"], SkipReason = "Requires Microsoft Foundry project with Bing search connection.", }, @@ -1168,8 +1168,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step07_Observability", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step07_Observability", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME", "APPLICATIONINSIGHTS_CONNECTION_STRING"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL", "APPLICATIONINSIGHTS_CONNECTION_STRING"], SkipReason = "Requires Application Insights / OpenTelemetry infrastructure.", }, @@ -1177,8 +1177,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step09_UsingMcpClientAsTools", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step09_UsingMcpClientAsTools", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should show an agent using the Microsoft Learn MCP tool to search or retrieve documentation.", @@ -1199,7 +1199,7 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step18_BingCustomSearch", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step18_BingCustomSearch", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "AZURE_AI_CUSTOM_SEARCH_CONNECTION_ID", "AZURE_AI_CUSTOM_SEARCH_INSTANCE_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "FOUNDRY_MODEL", "AZURE_AI_CUSTOM_SEARCH_CONNECTION_ID", "AZURE_AI_CUSTOM_SEARCH_INSTANCE_NAME"], SkipReason = "Requires Bing Custom Search connection.", }, @@ -1207,7 +1207,7 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step19_SharePoint", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step19_SharePoint", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "SHAREPOINT_PROJECT_CONNECTION_ID"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "FOUNDRY_MODEL", "SHAREPOINT_PROJECT_CONNECTION_ID"], SkipReason = "Requires SharePoint connection.", }, @@ -1215,7 +1215,7 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step20_MicrosoftFabric", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step20_MicrosoftFabric", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "FABRIC_PROJECT_CONNECTION_ID"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "FOUNDRY_MODEL", "FABRIC_PROJECT_CONNECTION_ID"], SkipReason = "Requires Microsoft Fabric connection.", }, @@ -1223,8 +1223,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step21_WebSearch", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step21_WebSearch", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = [ "The output should show an agent using web search to answer a question, with response text and citation annotations.", @@ -1236,7 +1236,7 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step22_MemorySearch", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step22_MemorySearch", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT", "AZURE_AI_MODEL_DEPLOYMENT_NAME", "AZURE_AI_EMBEDDING_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "FOUNDRY_MODEL", "AZURE_AI_EMBEDDING_DEPLOYMENT_NAME"], OptionalEnvironmentVariables = ["AZURE_AI_MEMORY_STORE_ID"], MustContain = ["Agent created with Memory Search tool. Starting conversation..."], ExpectedOutputDescription = @@ -1250,8 +1250,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Step23_LocalMCP", ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step23_LocalMCP", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], ExpectedOutputDescription = ["The output should show an agent using the Microsoft Learn MCP server to search for documentation and provide a response."], }, @@ -1259,8 +1259,8 @@ internal static class AgentsSamples { Name = "FoundryAgent_Hosted_MCP", ProjectPath = "samples/02-agents/ModelContextProtocol/FoundryAgent_Hosted_MCP", - RequiredEnvironmentVariables = ["AZURE_AI_PROJECT_ENDPOINT"], - OptionalEnvironmentVariables = ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT"], + OptionalEnvironmentVariables = ["FOUNDRY_MODEL"], Inputs = ["Y", "Y", "Y", "Y", "Y"], InputDelayMs = 5000, ExpectedOutputDescription = ["The output should contain a summary or information about Azure AI documentation from Microsoft Learn."], diff --git a/dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md b/dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md index ca2ffac65b1..2b6215c06d7 100644 --- a/dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md +++ b/dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md @@ -37,7 +37,7 @@ Set the following environment variables: ```powershell # Replace with your Microsoft Foundry project endpoint -$env:FOUNDRY_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com/" +$env:FOUNDRY_PROJECT_ENDPOINT="https://your-account.services.ai.azure.com/api/projects/your-project" # Replace with your Bing Grounding connection ID (full ARM resource URI) $env:AZURE_AI_BING_CONNECTION_ID="/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts//projects//connections/" diff --git a/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs b/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs index 4bb77901e01..29b30e93eff 100644 --- a/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs +++ b/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs @@ -26,8 +26,8 @@ using Microsoft.Agents.AI; using Microsoft.Extensions.AI; -var endpoint = Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set."); -var deploymentName = Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-5.4"; +var endpoint = Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); +var deploymentName = Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5.4"; // The HarnessAgent pre-configures function invocation, per-service-call chat history persistence, and // context-window compaction. These bounds size the in-loop compaction window. diff --git a/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md b/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md index ea5b3421e01..a3ebb03a175 100644 --- a/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md +++ b/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md @@ -41,10 +41,10 @@ Set the following environment variables: ```bash # Required: Your Microsoft Foundry project endpoint -export AZURE_AI_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com/api/projects/your-project" +export FOUNDRY_PROJECT_ENDPOINT="https://your-account.services.ai.azure.com/api/projects/your-project" # Optional: Model deployment name (defaults to gpt-5.4) -export AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-5.4" +export FOUNDRY_MODEL="gpt-5.4" ``` ## Running the Sample diff --git a/dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md b/dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md index b601f40299d..51154e6da99 100644 --- a/dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md +++ b/dotnet/samples/03-workflows/Declarative/AotCheckpointing/README.md @@ -91,8 +91,8 @@ Prerequisites: | Setting | Description | | --- | --- | - | `AZURE_AI_PROJECT_ENDPOINT` | Foundry project endpoint URL. | - | `AZURE_AI_MODEL_DEPLOYMENT_NAME` | Model deployment name. | + | `FOUNDRY_PROJECT_ENDPOINT` | Foundry project endpoint URL. | + | `FOUNDRY_MODEL` | Model deployment name. | See the [parent README](../README.md) for the full walkthrough. diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/.env.example index 506721e1823..860eb3b9589 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/Program.cs index 9af0e7b81f0..d9ef3b622ea 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/Program.cs @@ -34,8 +34,8 @@ string endpoint = System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); string deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o")!; string skillNames = FirstNonBlank(System.Environment.GetEnvironmentVariable("SKILL_NAMES")) ?? throw new InvalidOperationException("SKILL_NAMES is not set. Provide a comma-separated list of skill names (e.g., support-style,escalation-policy)."); diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/README.md index 40536036de6..d25a7e73363 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AgentSkills/README.md @@ -45,7 +45,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o PROVISION_SAMPLE_SKILLS=true SKILL_NAMES=support-style,escalation-policy ASPNETCORE_URLS=http://+:8088 diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/.env.example index 814f9e44c8f..32b9d46eb90 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/Program.cs index a013f49d435..8087ceef64e 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/Program.cs @@ -23,8 +23,8 @@ string projectEndpoint = System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); string deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o")!; string searchEndpoint = FirstNonBlank(System.Environment.GetEnvironmentVariable("AZURE_SEARCH_ENDPOINT")) diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/README.md index 5175244abe8..0b01706c8b6 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-AzureSearchRag/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o AZURE_SEARCH_ENDPOINT=https://.search.windows.net AZURE_SEARCH_INDEX_NAME= ASPNETCORE_URLS=http://+:8088 diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/.env.example index 77c6b4cfa36..115e840e83e 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. The Dockerfile sets this for the container; a plain diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/Program.cs index 2461d871dcb..82d94082641 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/Program.cs @@ -25,8 +25,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var model = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-chat-client-agent-docker"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/README.md index 048302530fc..16c5a4bfcd6 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent-Dockerfile/README.md @@ -57,7 +57,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/.env.example index 1677d79d830..5b55d864c69 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/Program.cs index 9b2484b19fe..8ac84afe5d8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/Program.cs @@ -21,8 +21,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var model = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-chat-client-agent"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/README.md index 99b5ebfdd9e..eada65ad288 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ChatClientAgent/README.md @@ -45,7 +45,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/Program.cs index e2307497922..c2ec4505e86 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/Program.cs @@ -20,7 +20,8 @@ // // Required environment variables: // FOUNDRY_PROJECT_ENDPOINT - Foundry project endpoint -// AZURE_AI_MODEL_DEPLOYMENT_NAME - Model deployment name (default: gpt-4o) +// FOUNDRY_MODEL (or AZURE_AI_MODEL_DEPLOYMENT_NAME) +// - Model deployment name (default: gpt-4o) // // Optional: // AGENT_NAME - Agent name (default: hosted-files) @@ -48,8 +49,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-files"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/README.md index 6ff22143345..7486ec0b69d 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Files/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/Program.cs index c0db659fb48..f170ad9fc8d 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/Program.cs @@ -36,8 +36,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-local-codeact"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md index 7d9f94dffb4..6da69188dc5 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/Program.cs index 174df75bf93..fc778af6d70 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/Program.cs @@ -26,8 +26,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-local-tools"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/README.md index 377e16e5983..178a8898780 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalTools/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/Program.cs index 0b303d2b607..3827568f71f 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/Program.cs @@ -29,8 +29,8 @@ var projectEndpoint = new Uri(System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.")); -var deployment = System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") - ?? System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL") +var deployment = System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL") + ?? System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-4o"; // WARNING: DefaultAzureCredential is convenient for development but requires careful diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/README.md index a2155e95a1d..1c7ab10c031 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-McpTools/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/.env.example index 6f2791c52e9..a0cf7464fb0 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind @@ -18,4 +18,4 @@ AZURE_TOKEN_CREDENTIALS=dev # Memory store and embedding deployment (must already exist in your project). AZURE_AI_MEMORY_STORE_ID= -AZURE_AI_EMBEDDING_DEPLOYMENT_NAME= +FOUNDRY_EMBEDDING_MODEL= diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/Program.cs index 4f37da942ab..15fbe8ca6fa 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/Program.cs @@ -30,10 +30,11 @@ System.Environment.GetEnvironmentVariable("AGENT_NAME"), "hosted-memory-agent")!; var deployment = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o")!; var embeddingDeployment = FirstNonBlank( + System.Environment.GetEnvironmentVariable("FOUNDRY_EMBEDDING_MODEL"), System.Environment.GetEnvironmentVariable("AZURE_AI_EMBEDDING_DEPLOYMENT_NAME"), "text-embedding-ada-002")!; var memoryStoreName = FirstNonBlank( diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/README.md index 83a4e2fdbee..8d5a438d423 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-MemoryAgent/README.md @@ -1,6 +1,6 @@ # Hosted-MemoryAgent -A hosted agent with long-term memory backed by a Foundry Memory store and an embedding deployment. Requires AZURE_AI_MEMORY_STORE_ID and AZURE_AI_EMBEDDING_DEPLOYMENT_NAME to be set to resources that exist in your project. +A hosted agent with long-term memory backed by a Foundry Memory store and an embedding deployment. Set `AZURE_AI_MEMORY_STORE_ID` and `FOUNDRY_EMBEDDING_MODEL` to resources that exist in your project. Hosted deployments retain `AZURE_AI_EMBEDDING_DEPLOYMENT_NAME` as the azd-managed fallback. This sample deploys to Foundry **directly from source (code / ZIP upload)**: the platform builds and runs your code with no container image, so there is no Dockerfile to author or container registry to manage. Source deploy is the default for .NET. @@ -45,9 +45,9 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o AZURE_AI_MEMORY_STORE_ID= -AZURE_AI_EMBEDDING_DEPLOYMENT_NAME= +FOUNDRY_EMBEDDING_MODEL= ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/Program.cs index 29633c92be3..7b4f0cb947d 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/Program.cs @@ -26,8 +26,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-observability"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/README.md index 3a0ffbad48f..7658141fcf0 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Observability/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/.env.example index 7bc60bb435f..3d534bfdaa5 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only ASPNETCORE_URLS=http://+:8088 diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/Program.cs index aa5df92e3e8..8306dc61f0f 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Steering/Program.cs @@ -14,8 +14,8 @@ var projectEndpoint = new Uri(System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.")); var deployment = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-steering"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/Program.cs index 1eaaf73a91a..71655bf92c0 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/Program.cs @@ -24,8 +24,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-text-rag"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/README.md index 5c1dae30baf..6e139c6a53b 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-TextRag/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/.env.example index f0742d3aff7..883ee9f20ec 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs index 1f96eeb4431..832d289601a 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/Program.cs @@ -10,15 +10,14 @@ // README.md. // // Required environment variables: -// AZURE_AI_PROJECT_ENDPOINT (local-dev) OR FOUNDRY_PROJECT_ENDPOINT (hosted runtime) -// - Foundry project endpoint. The Foundry hosted -// runtime auto-injects FOUNDRY_PROJECT_ENDPOINT; locally -// set AZURE_AI_PROJECT_ENDPOINT (the AF-repo convention). +// FOUNDRY_PROJECT_ENDPOINT - Foundry project endpoint. The Foundry hosted +// runtime auto-injects it; set it locally for `dotnet run`. // TOOLBOX_NAME - Name of the Foundry Toolbox to load // (default: auth-paths-toolbox) // // Optional: -// AZURE_AI_MODEL_DEPLOYMENT_NAME - Model deployment name (default: gpt-4o) +// FOUNDRY_MODEL (or AZURE_AI_MODEL_DEPLOYMENT_NAME) +// - Model deployment name (default: gpt-4o) // AGENT_NAME - Defaults to "hosted-toolbox-auth-paths-agent". // // The Foundry.Hosting package builds the toolbox proxy URL from FOUNDRY_PROJECT_ENDPOINT @@ -40,18 +39,10 @@ // Load .env file if present (for local development) Env.TraversePath().Load(); -// Project endpoint resolution order: -// 1. FOUNDRY_PROJECT_ENDPOINT — auto-injected by the Foundry hosted runtime. -// 2. AZURE_AI_PROJECT_ENDPOINT — the convention developers set locally for `dotnet run`. -// When deployed, only (1) is available; the AF-repo sample convention to set (2) at -// deploy time fails silently because the platform reserves all FOUNDRY_* env-var names -// and rejects them at agent-create time. Read both, prefer the platform-injected one. string endpoint = System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") - ?? System.Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") - ?? throw new InvalidOperationException( - "Neither FOUNDRY_PROJECT_ENDPOINT (platform-injected in hosted runtime) " + - "nor AZURE_AI_PROJECT_ENDPOINT (local-dev convention) is set."); + ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); string deploymentName = FirstNonBlank( + System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o")!; string toolboxName = FirstNonBlank( diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/README.md index ae7936f8e4a..5cfed48179c 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox-AuthPaths/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o TOOLBOX_NAME= ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/.env.example index 8e3d0ddfceb..9d4c838f26c 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs index c0df6baced1..ec05f6346b8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs @@ -6,10 +6,8 @@ // call tools provided by the Foundry platform's managed MCP proxy. // // Required environment variables: -// FOUNDRY_PROJECT_ENDPOINT (hosted runtime) OR AZURE_AI_PROJECT_ENDPOINT (local-dev) -// - Foundry project endpoint. The Foundry hosted -// runtime auto-injects FOUNDRY_PROJECT_ENDPOINT; locally -// set AZURE_AI_PROJECT_ENDPOINT. +// FOUNDRY_PROJECT_ENDPOINT - Foundry project endpoint. The Foundry hosted +// runtime auto-injects it; set it locally for `dotnet run`. // // Optional: // FOUNDRY_MODEL (or AZURE_AI_MODEL_DEPLOYMENT_NAME) @@ -34,13 +32,10 @@ Env.TraversePath().Load(); string endpoint = System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") - ?? System.Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") - ?? throw new InvalidOperationException( - "Neither FOUNDRY_PROJECT_ENDPOINT (platform-injected in hosted runtime) " + - "nor AZURE_AI_PROJECT_ENDPOINT (local-dev convention) is set."); + ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); string deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o")!; string toolboxName = FirstNonBlank( System.Environment.GetEnvironmentVariable("TOOLBOX_NAME"), diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/README.md index c12b99a1727..f4c29e88027 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o TOOLBOX_NAME= ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/.env.example index a9258982d80..84338c619bd 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/Program.cs index 00dc5330122..8137959d28b 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/Program.cs @@ -11,8 +11,8 @@ // TOOLBOX_NAME - Name of the Foundry Toolbox to connect to // // Optional: -// AZURE_AI_MODEL_DEPLOYMENT_NAME - Model deployment name (default: gpt-5) -// FOUNDRY_MODEL - Legacy local-development fallback +// FOUNDRY_MODEL (or AZURE_AI_MODEL_DEPLOYMENT_NAME) +// - Model deployment name (default: gpt-5) // // NOTE: All FOUNDRY_* and AGENT_* env-var prefixes (other than the platform-injected ones // listed above) are reserved by the Foundry container platform and rejected at agent-create. @@ -34,8 +34,8 @@ var projectEndpoint = System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); var deployment = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-5"); var toolboxName = FirstNonBlank(System.Environment.GetEnvironmentVariable("TOOLBOX_NAME")) ?? throw new InvalidOperationException("TOOLBOX_NAME is not set."); diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/README.md index 22eae291cae..d5d06e5eb1f 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-ToolboxMcpSkills/README.md @@ -46,7 +46,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o TOOLBOX_NAME= ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/.env.example index 7bc60bb435f..3d534bfdaa5 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only ASPNETCORE_URLS=http://+:8088 diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/Program.cs index fd67681f7aa..e3eb3c05f13 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Resilient/Program.cs @@ -17,8 +17,8 @@ var projectEndpoint = new Uri(System.Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.")); var deployment = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-workflow-resilient"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/.env.example b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/.env.example index 857e3b584ef..433a7e465a8 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/.env.example +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/.env.example @@ -2,7 +2,7 @@ FOUNDRY_PROJECT_ENDPOINT= # Model deployment name in your Foundry project. -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o # Local development only. Bind the app to the port Foundry probes for readiness, which is the # port the Using-Samples REPLs expect. Recent Microsoft.Agents.AI.Foundry.Hosting versions bind diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/Program.cs index 4566d02ea69..e7e7c968872 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/Program.cs @@ -25,8 +25,8 @@ // environment does not define the variable referenced from azure.yaml. An empty string is not // null, so a plain ?? chain would pass the blank straight through and fail deep inside the SDK. var deploymentName = FirstNonBlank( - System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL"), + System.Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME"), "gpt-4o"); var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") ?? "hosted-workflow-simple"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/README.md index a21c268cae8..6bff9bb97d6 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Simple/README.md @@ -43,7 +43,7 @@ cp .env.example .env ```env FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +FOUNDRY_MODEL=gpt-4o ASPNETCORE_URLS=http://+:8088 AZURE_TOKEN_CREDENTIALS=dev ``` diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/Program.cs index 2231bbf7c21..9995f623736 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/Program.cs @@ -24,7 +24,7 @@ // approvals use the native OpenAI mcp_approval_response item. // // Required environment variables: -// AZURE_AI_PROJECT_ENDPOINT - Foundry project endpoint, or the local dev server base +// FOUNDRY_PROJECT_ENDPOINT - Foundry project endpoint, or the local dev server base // (e.g. http://localhost:8088/api/projects/local). // AZURE_AI_AGENT_NAME - The registered server-side agent name // (default: hosted-toolbox-auth-paths-agent). @@ -44,9 +44,8 @@ // Load .env file if present (for local development) Env.TraversePath().Load(); -Uri projectEndpoint = new(Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") - ?? Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") - ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set.")); +Uri projectEndpoint = new(Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT") + ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.")); string agentName = Environment.GetEnvironmentVariable("AZURE_AI_AGENT_NAME") ?? "hosted-toolbox-auth-paths-agent"; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/README.md b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/README.md index 3dfe8cd3e98..3116e9dc43e 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/README.md +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/Hosted-Toolbox-AuthPaths-Client/README.md @@ -66,11 +66,11 @@ The client never sees the user's token. Consent and the on-behalf-of token excha cd Hosted-Toolbox-AuthPaths-Client # Against the local dev server (the {project} segment is a wildcard the server ignores): -$env:AZURE_AI_PROJECT_ENDPOINT = "http://localhost:8088/api/projects/local" +$env:FOUNDRY_PROJECT_ENDPOINT = "http://localhost:8088/api/projects/local" $env:AZURE_AI_AGENT_NAME = "hosted-toolbox-auth-paths-agent" # Or against a deployed agent: -# $env:AZURE_AI_PROJECT_ENDPOINT = "https://.services.ai.azure.com/api/projects/" +# $env:FOUNDRY_PROJECT_ENDPOINT = "https://.services.ai.azure.com/api/projects/" # $env:AZURE_AI_AGENT_NAME = "hosted-toolbox-auth-paths-agent" dotnet run --tl:off @@ -85,5 +85,5 @@ approval prompt appears, enter `Y` to let the agent execute `load_skill`. | Variable | Required | Default | Notes | |---|---|---|---| -| `AZURE_AI_PROJECT_ENDPOINT` | yes | — | Foundry project endpoint, or the local dev server base. `FOUNDRY_PROJECT_ENDPOINT` is read as a fallback. | +| `FOUNDRY_PROJECT_ENDPOINT` | yes | — | Foundry project endpoint, or the local dev server base. | | `AZURE_AI_AGENT_NAME` | no | `hosted-toolbox-auth-paths-agent` | Registered server-side agent name. | diff --git a/python/.env.example b/python/.env.example index f9f3a953c4e..d785b54d942 100644 --- a/python/.env.example +++ b/python/.env.example @@ -21,7 +21,7 @@ AZURE_SEARCH_INDEX_NAME="" AZURE_SEARCH_SEMANTIC_CONFIG="" AZURE_SEARCH_KNOWLEDGE_BASE_NAME="" # Note: For agentic mode Knowledge Bases, also set AZURE_OPENAI_ENDPOINT below -# (different from AZURE_AI_PROJECT_ENDPOINT - Knowledge Base needs OpenAI endpoint for model calls) +# (different from FOUNDRY_PROJECT_ENDPOINT - Knowledge Base needs OpenAI endpoint for model calls) # OpenAI OPENAI_API_KEY="" OPENAI_CHAT_COMPLETION_MODEL="" diff --git a/python/packages/azure-contentunderstanding/README.md b/python/packages/azure-contentunderstanding/README.md index 3d6cdde5582..69771f63601 100644 --- a/python/packages/azure-contentunderstanding/README.md +++ b/python/packages/azure-contentunderstanding/README.md @@ -56,7 +56,7 @@ cu = ContentUnderstandingContextProvider( ) client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4.1", credential=credential, ) @@ -114,8 +114,8 @@ Set these in your shell or in a `.env` file: ```bash AZURE_CONTENTUNDERSTANDING_ENDPOINT=https://your-cu-resource.cognitiveservices.azure.com/ -AZURE_AI_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com -AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4.1 +FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project +FOUNDRY_MODEL=gpt-4.1 ``` You also need to be logged in with `az login` (for `AzureCliCredential`). diff --git a/python/packages/azure-cosmos-memory/AGENTS.md b/python/packages/azure-cosmos-memory/AGENTS.md index ed45db0f826..19a45e41663 100644 --- a/python/packages/azure-cosmos-memory/AGENTS.md +++ b/python/packages/azure-cosmos-memory/AGENTS.md @@ -17,7 +17,7 @@ from agent_framework_azure_cosmos_memory import CosmosMemoryContextProvider provider = CosmosMemoryContextProvider( cosmos_endpoint="https://.documents.azure.com:443/", cosmos_database="ai_memory", - foundry_endpoint="https://.services.ai.azure.com", + foundry_endpoint="https://.services.ai.azure.com/api/projects/", credential=DefaultAzureCredential(), ) ``` diff --git a/python/packages/azure-cosmos-memory/README.md b/python/packages/azure-cosmos-memory/README.md index e5516ae8f0c..5a99b4f30ed 100644 --- a/python/packages/azure-cosmos-memory/README.md +++ b/python/packages/azure-cosmos-memory/README.md @@ -24,7 +24,7 @@ from agent_framework.foundry import FoundryChatClient from agent_framework_azure_cosmos_memory import CosmosMemoryContextProvider # A single AI Foundry endpoint powers both memory and the chat agent -foundry_endpoint = "https://.services.ai.azure.com" +foundry_endpoint = "https://.services.ai.azure.com/api/projects/" # Create the memory provider memory_provider = CosmosMemoryContextProvider( @@ -56,7 +56,9 @@ The provider supports the same authentication modes as other Azure integrations: - **Managed identity / RBAC** (recommended): Pass `DefaultAzureCredential()` - **Connection string**: Set environment variables -- **Environment variables**: `COSMOS_ENDPOINT`, `COSMOS_DATABASE`, `FOUNDRY_ENDPOINT` +- **Environment variables**: `COSMOS_ENDPOINT`, `COSMOS_DATABASE`, `FOUNDRY_PROJECT_ENDPOINT` + +Existing configurations can continue using `FOUNDRY_ENDPOINT`; the provider treats it as a legacy fallback. ### Development Setup @@ -148,14 +150,14 @@ Ensure your virtual environment is activated, then: ```bash # Bash/Linux/macOS export COSMOS_ENDPOINT="https://.documents.azure.com:443/" -export FOUNDRY_ENDPOINT="https://.services.ai.azure.com" +export FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" python samples/basic_usage.py ``` ```powershell # PowerShell $env:COSMOS_ENDPOINT="https://.documents.azure.com:443/" -$env:FOUNDRY_ENDPOINT="https://.services.ai.azure.com" +$env:FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" python samples/basic_usage.py ``` @@ -188,7 +190,7 @@ This sample shows **real-world usage** with Agent Framework. It demonstrates: 3. **Configure environment variables** - Set these in your activated virtual environment. - > **Note:** A **single** `FOUNDRY_ENDPOINT` powers everything: + > **Note:** A **single** `FOUNDRY_PROJECT_ENDPOINT` powers everything: > - The **memory provider** uses it internally for embeddings + memory extraction. > - The **chat agent** you talk to uses it via `FoundryChatClient`. > @@ -201,7 +203,7 @@ This sample shows **real-world usage** with Agent Framework. It demonstrates: export COSMOS_DATABASE="ai_memory" # AI Foundry - used by BOTH the memory provider and the chat agent - export FOUNDRY_ENDPOINT="https://.services.ai.azure.com" + export FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" export EMBEDDING_MODEL="text-embedding-3-large" export CHAT_MODEL="gpt-4o-mini" ``` @@ -213,7 +215,7 @@ This sample shows **real-world usage** with Agent Framework. It demonstrates: $env:COSMOS_DATABASE="ai_memory" # AI Foundry - used by BOTH the memory provider and the chat agent - $env:FOUNDRY_ENDPOINT="https://.services.ai.azure.com" + $env:FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" $env:EMBEDDING_MODEL="text-embedding-3-large" $env:CHAT_MODEL="gpt-4o-mini" ``` @@ -445,7 +447,7 @@ All configuration can be provided via environment variables: ```bash COSMOS_ENDPOINT=https://.documents.azure.com:443/ COSMOS_DATABASE=ai_memory -FOUNDRY_ENDPOINT=https://.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ EMBEDDING_MODEL=text-embedding-3-large CHAT_MODEL=gpt-4o-mini @@ -462,14 +464,14 @@ Bash/Linux/macOS: ```bash export COSMOS_ENDPOINT=https://.documents.azure.com:443/ export COSMOS_DATABASE=ai_memory -export FOUNDRY_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ ``` PowerShell: ```powershell $env:COSMOS_ENDPOINT="https://.documents.azure.com:443/" $env:COSMOS_DATABASE="ai_memory" -$env:FOUNDRY_ENDPOINT="https://.services.ai.azure.com" +$env:FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" ``` ## See Also diff --git a/python/packages/azure-cosmos-memory/agent_framework_azure_cosmos_memory/_context_provider.py b/python/packages/azure-cosmos-memory/agent_framework_azure_cosmos_memory/_context_provider.py index 4c2412e97ef..d316455b43d 100644 --- a/python/packages/azure-cosmos-memory/agent_framework_azure_cosmos_memory/_context_provider.py +++ b/python/packages/azure-cosmos-memory/agent_framework_azure_cosmos_memory/_context_provider.py @@ -11,6 +11,7 @@ import asyncio import inspect import logging +import os import sys from collections.abc import Mapping, Sequence from contextlib import AbstractAsyncContextManager @@ -111,7 +112,8 @@ def __init__( cosmos_database: Cosmos DB database name. Can be set via ``COSMOS_DATABASE``. foundry_endpoint: Azure AI Foundry project endpoint for LLM and embeddings. - Can be set via ``FOUNDRY_ENDPOINT``. + Can be set via ``FOUNDRY_PROJECT_ENDPOINT``. The legacy + ``FOUNDRY_ENDPOINT`` name remains supported as a fallback. embedding_model: Embedding model deployment name. Required (no default) when the provider builds the client; can be set via ``EMBEDDING_MODEL``. There is no safe long-term default, so an unset value raises rather than silently targeting a model @@ -194,7 +196,9 @@ def __init__( CosmosMemorySettings, cosmos_endpoint=cosmos_endpoint, cosmos_database=cosmos_database, - foundry_endpoint=foundry_endpoint, + # Prefer the repository-wide project endpoint name. ``load_settings`` still + # resolves the legacy FOUNDRY_ENDPOINT variable when this override is absent. + foundry_endpoint=foundry_endpoint or os.getenv("FOUNDRY_PROJECT_ENDPOINT"), embedding_model=embedding_model, chat_model=chat_model, required_fields=["cosmos_endpoint", "foundry_endpoint", "embedding_model", "chat_model"], diff --git a/python/packages/azure-cosmos-memory/samples/basic_usage.py b/python/packages/azure-cosmos-memory/samples/basic_usage.py index 945ade958cf..c6832c10e17 100644 --- a/python/packages/azure-cosmos-memory/samples/basic_usage.py +++ b/python/packages/azure-cosmos-memory/samples/basic_usage.py @@ -16,7 +16,8 @@ Set these environment variables (or put them in a ``.env`` file) before running: COSMOS_ENDPOINT Azure Cosmos DB account endpoint - FOUNDRY_ENDPOINT Azure AI Foundry project endpoint (chat + embeddings) + FOUNDRY_PROJECT_ENDPOINT + Azure AI Foundry project endpoint (chat + embeddings) Optional: COSMOS_DATABASE Database name (default: ai_memory) @@ -38,11 +39,16 @@ from agent_framework_azure_cosmos_memory import CosmosMemoryContextProvider +def _foundry_project_endpoint() -> str: + """Read the preferred project endpoint variable with legacy compatibility.""" + return os.environ.get("FOUNDRY_PROJECT_ENDPOINT") or os.environ["FOUNDRY_ENDPOINT"] + + def _build_agent(provider: CosmosMemoryContextProvider, credential: DefaultAzureCredential) -> Agent: """Build an agent that uses the memory provider and the same Foundry endpoint for chat.""" return Agent( client=FoundryChatClient( - project_endpoint=os.environ["FOUNDRY_ENDPOINT"], + project_endpoint=_foundry_project_endpoint(), model=os.getenv("CHAT_MODEL", "gpt-4o-mini"), credential=credential, ), @@ -57,7 +63,7 @@ async def user_scoped_memory() -> None: credential = DefaultAzureCredential() provider = CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], + foundry_endpoint=_foundry_project_endpoint(), embedding_model=os.getenv("EMBEDDING_MODEL", "text-embedding-3-large"), chat_model=os.getenv("CHAT_MODEL", "gpt-4o-mini"), credential=credential, @@ -87,7 +93,7 @@ async def session_scoped_memory() -> None: credential = DefaultAzureCredential() provider = CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], + foundry_endpoint=_foundry_project_endpoint(), embedding_model=os.getenv("EMBEDDING_MODEL", "text-embedding-3-large"), chat_model=os.getenv("CHAT_MODEL", "gpt-4o-mini"), credential=credential, diff --git a/python/packages/azure-cosmos-memory/samples/interactive_chat.py b/python/packages/azure-cosmos-memory/samples/interactive_chat.py index 43fc6ee913d..70f9ac17580 100644 --- a/python/packages/azure-cosmos-memory/samples/interactive_chat.py +++ b/python/packages/azure-cosmos-memory/samples/interactive_chat.py @@ -15,7 +15,8 @@ Set these environment variables (or put them in a ``.env`` file) before running: COSMOS_ENDPOINT Azure Cosmos DB account endpoint - FOUNDRY_ENDPOINT Azure AI Foundry project endpoint (chat + embeddings) + FOUNDRY_PROJECT_ENDPOINT + Azure AI Foundry project endpoint (chat + embeddings) Optional: COSMOS_DATABASE Database name (default: ai_memory) @@ -41,9 +42,9 @@ def create_agent_with_memory() -> tuple[Agent, CosmosMemoryContextProvider]: """Create an agent wired to Cosmos DB long-term memory.""" cosmos_endpoint = os.environ.get("COSMOS_ENDPOINT") - foundry_endpoint = os.environ.get("FOUNDRY_ENDPOINT") + foundry_endpoint = os.environ.get("FOUNDRY_PROJECT_ENDPOINT") or os.environ.get("FOUNDRY_ENDPOINT") if not cosmos_endpoint or not foundry_endpoint: - print("ERROR: set COSMOS_ENDPOINT and FOUNDRY_ENDPOINT (see this file's docstring).") + print("ERROR: set COSMOS_ENDPOINT and FOUNDRY_PROJECT_ENDPOINT (see this file's docstring).") sys.exit(1) # A single Foundry endpoint powers both the memory pipeline (embeddings + extraction) diff --git a/python/packages/azure-cosmos-memory/samples/interactive_chat_custom_extraction.py b/python/packages/azure-cosmos-memory/samples/interactive_chat_custom_extraction.py index 7f871d59cbb..37952e7cbc6 100644 --- a/python/packages/azure-cosmos-memory/samples/interactive_chat_custom_extraction.py +++ b/python/packages/azure-cosmos-memory/samples/interactive_chat_custom_extraction.py @@ -29,7 +29,8 @@ Set these environment variables (or put them in a ``.env`` file) before running: COSMOS_ENDPOINT Azure Cosmos DB account endpoint - FOUNDRY_ENDPOINT Azure AI Foundry project endpoint (chat + embeddings) + FOUNDRY_PROJECT_ENDPOINT + Azure AI Foundry project endpoint (chat + embeddings) Optional: COSMOS_DATABASE Database name (default: ai_memory) @@ -105,9 +106,9 @@ def _build_custom_prompts_dir() -> str: def create_agent_with_memory(prompts_dir: str) -> tuple[Agent, CosmosMemoryContextProvider]: """Create an agent wired to Cosmos DB memory that uses the custom extraction prompt.""" cosmos_endpoint = os.environ.get("COSMOS_ENDPOINT") - foundry_endpoint = os.environ.get("FOUNDRY_ENDPOINT") + foundry_endpoint = os.environ.get("FOUNDRY_PROJECT_ENDPOINT") or os.environ.get("FOUNDRY_ENDPOINT") if not cosmos_endpoint or not foundry_endpoint: - print("ERROR: set COSMOS_ENDPOINT and FOUNDRY_ENDPOINT (see this file's docstring).") + print("ERROR: set COSMOS_ENDPOINT and FOUNDRY_PROJECT_ENDPOINT (see this file's docstring).") sys.exit(1) credential = DefaultAzureCredential() diff --git a/python/packages/azure-cosmos-memory/tests/test_context_provider.py b/python/packages/azure-cosmos-memory/tests/test_context_provider.py index 3ed16fd0a09..f48c7602102 100644 --- a/python/packages/azure-cosmos-memory/tests/test_context_provider.py +++ b/python/packages/azure-cosmos-memory/tests/test_context_provider.py @@ -177,21 +177,42 @@ def test_init_wires_explicit_credential(self) -> None: def test_init_raises_without_endpoints(self, monkeypatch: pytest.MonkeyPatch) -> None: """Raises SettingNotFoundError when the Cosmos endpoint is not provided.""" - for var in ("COSMOS_ENDPOINT", "COSMOS_DATABASE", "FOUNDRY_ENDPOINT", "EMBEDDING_MODEL", "CHAT_MODEL"): + for var in ( + "COSMOS_ENDPOINT", + "COSMOS_DATABASE", + "FOUNDRY_PROJECT_ENDPOINT", + "FOUNDRY_ENDPOINT", + "EMBEDDING_MODEL", + "CHAT_MODEL", + ): monkeypatch.delenv(var, raising=False) with pytest.raises(SettingNotFoundError, match="cosmos_endpoint"): CosmosMemoryContextProvider() def test_init_raises_without_foundry(self, monkeypatch: pytest.MonkeyPatch) -> None: """Raises SettingNotFoundError when the Foundry endpoint is not provided.""" - for var in ("COSMOS_ENDPOINT", "COSMOS_DATABASE", "FOUNDRY_ENDPOINT", "EMBEDDING_MODEL", "CHAT_MODEL"): + for var in ( + "COSMOS_ENDPOINT", + "COSMOS_DATABASE", + "FOUNDRY_PROJECT_ENDPOINT", + "FOUNDRY_ENDPOINT", + "EMBEDDING_MODEL", + "CHAT_MODEL", + ): monkeypatch.delenv(var, raising=False) with pytest.raises(SettingNotFoundError, match="foundry_endpoint"): CosmosMemoryContextProvider(cosmos_endpoint="https://test.documents.azure.com:443/") def test_init_raises_without_models(self, monkeypatch: pytest.MonkeyPatch) -> None: """Raises when the chat/embedding models are not provided (no silent default).""" - for var in ("COSMOS_ENDPOINT", "COSMOS_DATABASE", "FOUNDRY_ENDPOINT", "EMBEDDING_MODEL", "CHAT_MODEL"): + for var in ( + "COSMOS_ENDPOINT", + "COSMOS_DATABASE", + "FOUNDRY_PROJECT_ENDPOINT", + "FOUNDRY_ENDPOINT", + "EMBEDDING_MODEL", + "CHAT_MODEL", + ): monkeypatch.delenv(var, raising=False) # Endpoints resolve, but the models do not: rather than defaulting to a model that may not # be deployed, construction must raise so the caller knows to set one. @@ -201,6 +222,44 @@ def test_init_raises_without_models(self, monkeypatch: pytest.MonkeyPatch) -> No foundry_endpoint="https://test.ai.azure.com", ) + def test_init_prefers_foundry_project_endpoint_env(self, monkeypatch: pytest.MonkeyPatch) -> None: + """FOUNDRY_PROJECT_ENDPOINT takes precedence over the legacy environment variable.""" + monkeypatch.setenv("FOUNDRY_PROJECT_ENDPOINT", "https://preferred.ai.azure.com/api/projects/test") + monkeypatch.setenv("FOUNDRY_ENDPOINT", "https://legacy.ai.azure.com/api/projects/test") + + with patch( + "agent_framework_azure_cosmos_memory._context_provider.AsyncCosmosMemoryClient" + ) as mock_client_class: + mock_client_class.return_value = AsyncMock() + + CosmosMemoryContextProvider( + cosmos_endpoint="https://test.documents.azure.com:443/", + embedding_model="text-embedding-3-large", + chat_model="gpt-4o-mini", + ) + + _, kwargs = mock_client_class.call_args + assert kwargs["ai_foundry_endpoint"] == "https://preferred.ai.azure.com/api/projects/test" + + def test_init_accepts_legacy_foundry_endpoint_env(self, monkeypatch: pytest.MonkeyPatch) -> None: + """FOUNDRY_ENDPOINT remains supported for existing configurations.""" + monkeypatch.delenv("FOUNDRY_PROJECT_ENDPOINT", raising=False) + monkeypatch.setenv("FOUNDRY_ENDPOINT", "https://legacy.ai.azure.com/api/projects/test") + + with patch( + "agent_framework_azure_cosmos_memory._context_provider.AsyncCosmosMemoryClient" + ) as mock_client_class: + mock_client_class.return_value = AsyncMock() + + CosmosMemoryContextProvider( + cosmos_endpoint="https://test.documents.azure.com:443/", + embedding_model="text-embedding-3-large", + chat_model="gpt-4o-mini", + ) + + _, kwargs = mock_client_class.call_args + assert kwargs["ai_foundry_endpoint"] == "https://legacy.ai.azure.com/api/projects/test" + def test_init_processor_config_forwarded_to_built_client(self) -> None: """processor_config is forwarded to the built client via cadence_thresholds.""" with patch( diff --git a/python/packages/azure-cosmos-memory/tests/test_integration.py b/python/packages/azure-cosmos-memory/tests/test_integration.py index 4c47f2d431f..bcb87260529 100644 --- a/python/packages/azure-cosmos-memory/tests/test_integration.py +++ b/python/packages/azure-cosmos-memory/tests/test_integration.py @@ -6,10 +6,12 @@ These tests require valid Azure credentials and environment variables: - COSMOS_ENDPOINT: Cosmos DB account endpoint - COSMOS_DATABASE: Database name (will be created if not exists) -- FOUNDRY_ENDPOINT: AI Foundry project endpoint +- FOUNDRY_PROJECT_ENDPOINT: AI Foundry project endpoint - EMBEDDING_MODEL: Embedding model deployment - CHAT_MODEL: Chat model deployment +The legacy ``FOUNDRY_ENDPOINT`` name remains supported. + Run with: pytest -m integration tests/ """ @@ -44,13 +46,14 @@ REQUIRED_ENV_VARS = [ "COSMOS_ENDPOINT", - "FOUNDRY_ENDPOINT", ] def _check_env_vars() -> tuple[bool, list[str]]: """Check if required environment variables are set.""" missing = [var for var in REQUIRED_ENV_VARS if not os.getenv(var)] + if not (os.getenv("FOUNDRY_PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")): + missing.append("FOUNDRY_PROJECT_ENDPOINT") return len(missing) == 0, missing @@ -68,7 +71,6 @@ async def live_provider(skip_if_no_env: None) -> AsyncGenerator[CosmosMemoryCont provider = CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], cosmos_database=os.getenv("COSMOS_DATABASE", "test_agent_memory"), - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], embedding_model=os.getenv("EMBEDDING_MODEL", "text-embedding-3-large"), chat_model=os.getenv("CHAT_MODEL", "gpt-4o-mini"), credential=DefaultAzureCredential(), @@ -222,7 +224,6 @@ async def test_custom_memory_types(self, skip_if_no_env: None, test_user_id: str provider = CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], cosmos_database=os.getenv("COSMOS_DATABASE", "test_agent_memory"), - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], credential=DefaultAzureCredential(), memory_types=["fact", "episodic", "procedural"], min_confidence=0.8, @@ -248,7 +249,6 @@ async def test_processor_config(self, skip_if_no_env: None, test_user_id: str, t provider = CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], cosmos_database=os.getenv("COSMOS_DATABASE", "test_agent_memory"), - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], credential=DefaultAzureCredential(), processor_config={ "FACT_EXTRACTION_EVERY_N": 1, @@ -287,7 +287,6 @@ def _build_provider(self) -> CosmosMemoryContextProvider: return CosmosMemoryContextProvider( cosmos_endpoint=os.environ["COSMOS_ENDPOINT"], cosmos_database=os.getenv("COSMOS_DATABASE", "test_agent_memory"), - foundry_endpoint=os.environ["FOUNDRY_ENDPOINT"], credential=DefaultAzureCredential(), top_k=5, min_confidence=0.3, diff --git a/python/samples/01-get-started/01_hello_agent.py b/python/samples/01-get-started/01_hello_agent.py index 1ed709f4a79..8f85af11f52 100644 --- a/python/samples/01-get-started/01_hello_agent.py +++ b/python/samples/01-get-started/01_hello_agent.py @@ -19,7 +19,7 @@ async def main() -> None: # client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/samples/01-get-started/02_add_tools.py b/python/samples/01-get-started/02_add_tools.py index 9d38ea71206..37eca46ed59 100644 --- a/python/samples/01-get-started/02_add_tools.py +++ b/python/samples/01-get-started/02_add_tools.py @@ -39,7 +39,7 @@ def get_weather( async def main() -> None: client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/samples/01-get-started/03_multi_turn.py b/python/samples/01-get-started/03_multi_turn.py index 9e6984dada9..f1ab3123d0a 100644 --- a/python/samples/01-get-started/03_multi_turn.py +++ b/python/samples/01-get-started/03_multi_turn.py @@ -17,7 +17,7 @@ async def main() -> None: # client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/samples/01-get-started/04_memory.py b/python/samples/01-get-started/04_memory.py index 7e0b1e2d5f4..92f38d5e5e5 100644 --- a/python/samples/01-get-started/04_memory.py +++ b/python/samples/01-get-started/04_memory.py @@ -67,7 +67,7 @@ async def after_run( async def main() -> None: # client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/samples/02-agents/context_providers/azure_content_understanding/README.md b/python/samples/02-agents/context_providers/azure_content_understanding/README.md index ffefee9d9e2..41a8160770f 100644 --- a/python/samples/02-agents/context_providers/azure_content_understanding/README.md +++ b/python/samples/02-agents/context_providers/azure_content_understanding/README.md @@ -7,7 +7,7 @@ These samples demonstrate how to use the `agent-framework-azure-contentunderstan 1. Azure CLI logged in: `az login` 2. Environment variables set (or `.env` file in the `python/` directory): ``` - FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com + FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4.1 AZURE_CONTENTUNDERSTANDING_ENDPOINT=https://your-cu-resource.cognitiveservices.azure.com/ ``` diff --git a/python/samples/02-agents/devui/.env.example b/python/samples/02-agents/devui/.env.example index b52c21a4e89..ea3544e554a 100644 --- a/python/samples/02-agents/devui/.env.example +++ b/python/samples/02-agents/devui/.env.example @@ -3,7 +3,7 @@ # Run `az login` before starting Azure-backed samples. # Microsoft Foundry samples -FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4o # Azure OpenAI workflow sample diff --git a/python/samples/02-agents/devui/README.md b/python/samples/02-agents/devui/README.md index 7a0019270f9..7290b5e8ae1 100644 --- a/python/samples/02-agents/devui/README.md +++ b/python/samples/02-agents/devui/README.md @@ -128,7 +128,7 @@ Alternatively, set environment variables globally: ```bash # Foundry-backed samples -export FOUNDRY_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com" +export FOUNDRY_PROJECT_ENDPOINT="https://your-account.services.ai.azure.com/api/projects/your-project" export FOUNDRY_MODEL="gpt-4o" # Azure OpenAI workflow_with_agents sample diff --git a/python/samples/02-agents/devui/agent_content_understanding_file_search_azure_openai/README.md b/python/samples/02-agents/devui/agent_content_understanding_file_search_azure_openai/README.md index 7a72416b118..c65c6804f1a 100644 --- a/python/samples/02-agents/devui/agent_content_understanding_file_search_azure_openai/README.md +++ b/python/samples/02-agents/devui/agent_content_understanding_file_search_azure_openai/README.md @@ -14,7 +14,7 @@ Interactive web UI for uploading and chatting with documents, images, audio, and 1. Set environment variables (or create a `.env` file in `python/`): ```bash - FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/ + FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME=gpt-4.1 AZURE_CONTENTUNDERSTANDING_ENDPOINT=https://your-cu-resource.services.ai.azure.com/ ``` diff --git a/python/samples/02-agents/devui/agent_content_understanding_file_search_foundry/README.md b/python/samples/02-agents/devui/agent_content_understanding_file_search_foundry/README.md index 6f07c701b07..f3e3f4b5c99 100644 --- a/python/samples/02-agents/devui/agent_content_understanding_file_search_foundry/README.md +++ b/python/samples/02-agents/devui/agent_content_understanding_file_search_foundry/README.md @@ -17,7 +17,7 @@ This is the **Foundry** variant. For the Azure OpenAI Responses API variant, see 1. Set environment variables (or create a `.env` file in `python/`): ```bash - FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/ + FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4.1 AZURE_CONTENTUNDERSTANDING_ENDPOINT=https://your-cu-resource.services.ai.azure.com/ ``` diff --git a/python/samples/02-agents/devui/agent_foundry/.env.example b/python/samples/02-agents/devui/agent_foundry/.env.example index 2fef3a5c81d..0d59c9fa7fc 100644 --- a/python/samples/02-agents/devui/agent_foundry/.env.example +++ b/python/samples/02-agents/devui/agent_foundry/.env.example @@ -1,5 +1,5 @@ # Microsoft Foundry Configuration # Make sure to run 'az login' before starting devui -FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4o diff --git a/python/samples/02-agents/devui/agent_weather/.env.example b/python/samples/02-agents/devui/agent_weather/.env.example index 2fef3a5c81d..0d59c9fa7fc 100644 --- a/python/samples/02-agents/devui/agent_weather/.env.example +++ b/python/samples/02-agents/devui/agent_weather/.env.example @@ -1,5 +1,5 @@ # Microsoft Foundry Configuration # Make sure to run 'az login' before starting devui -FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4o diff --git a/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/README.md b/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/README.md index 069cfa6492b..48b462ac3ed 100644 --- a/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/README.md +++ b/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/README.md @@ -16,8 +16,9 @@ agents and uploads this folder only. ## Environment ```bash -export FOUNDRY_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com/api/projects/your-project" +export FOUNDRY_PROJECT_ENDPOINT="https://your-account.services.ai.azure.com/api/projects/your-project" export FOUNDRY_MODEL="your-local-model-deployment" +# azd-managed hosted deployment variable: export AZURE_AI_MODEL_DEPLOYMENT_NAME="your-hosted-model-deployment" ``` diff --git a/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/hosted.py b/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/hosted.py index 7192ed02b57..8b540f71102 100644 --- a/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/hosted.py +++ b/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/hosted.py @@ -32,7 +32,7 @@ Environment variables: FOUNDRY_PROJECT_ENDPOINT — Microsoft Foundry project endpoint URL - AZURE_AI_MODEL_DEPLOYMENT_NAME — Model deployment name for the hosted agent + FOUNDRY_MODEL — Model deployment name for local runs TOOLBOX_MCP_SERVER_URL — Optional Foundry Toolbox MCP endpoint URL PURVIEW_CLIENT_APP_ID — Optional app/client ID; enables Purview ENABLE_SENSITIVE_DATA — Enables sensitive telemetry capture (prompts/responses) when true @@ -107,7 +107,7 @@ async def create_agent() -> Agent: config, context = AgentConfig.from_env(), get_request_context() scope = FoundryRequestScope.from_context(config, context, local_session_id="local-development") endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if config.is_hosted diff --git a/python/samples/02-agents/multimodal_input/README.md b/python/samples/02-agents/multimodal_input/README.md index da99e710578..a96df45fddb 100644 --- a/python/samples/02-agents/multimodal_input/README.md +++ b/python/samples/02-agents/multimodal_input/README.md @@ -44,7 +44,7 @@ Optionally for Azure OpenAI: # Example: Pass the Foundry project endpoint directly client = FoundryChatClient( credential=AzureCliCredential(), - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="your-deployment-name", ) ``` diff --git a/python/samples/02-agents/observability/README.md b/python/samples/02-agents/observability/README.md index 903dc7982b4..f456f93dd7d 100644 --- a/python/samples/02-agents/observability/README.md +++ b/python/samples/02-agents/observability/README.md @@ -123,7 +123,7 @@ from agent_framework.foundry import FoundryChatClient from azure.identity import AzureCliCredential client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/samples/02-agents/providers/foundry/foundry_agent_basic.py b/python/samples/02-agents/providers/foundry/foundry_agent_basic.py index 83c24a3691f..6433dabd358 100644 --- a/python/samples/02-agents/providers/foundry/foundry_agent_basic.py +++ b/python/samples/02-agents/providers/foundry/foundry_agent_basic.py @@ -21,7 +21,7 @@ async def main() -> None: agent = FoundryAgent( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", agent_name="my-prompt-agent", agent_version="1.0", credential=AzureCliCredential(), diff --git a/python/samples/04-hosting/a2a/.env.example b/python/samples/04-hosting/a2a/.env.example index b44278e19e4..927a9d3a8ae 100644 --- a/python/samples/04-hosting/a2a/.env.example +++ b/python/samples/04-hosting/a2a/.env.example @@ -1,5 +1,5 @@ # Microsoft Foundry Configuration (required for a2a_server.py and a2a_agent_as_function_tools.py) -FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/api/projects/your-project +FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project FOUNDRY_MODEL=gpt-4o # A2A Client Configuration (required for agent_with_a2a.py and a2a_agent_as_function_tools.py) diff --git a/python/samples/04-hosting/af-hosting/local_responses/README.md b/python/samples/04-hosting/af-hosting/local_responses/README.md index d3539c1d0e9..906068cfa7e 100644 --- a/python/samples/04-hosting/af-hosting/local_responses/README.md +++ b/python/samples/04-hosting/af-hosting/local_responses/README.md @@ -64,7 +64,7 @@ the box. ## Run ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano az login diff --git a/python/samples/04-hosting/af-hosting/local_responses/app.py b/python/samples/04-hosting/af-hosting/local_responses/app.py index 54ac3856c48..852d5c8f133 100644 --- a/python/samples/04-hosting/af-hosting/local_responses/app.py +++ b/python/samples/04-hosting/af-hosting/local_responses/app.py @@ -33,7 +33,7 @@ uv sync az login - export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com + export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano uv run hypercorn app:app --bind 0.0.0.0:8000 diff --git a/python/samples/04-hosting/af-hosting/local_responses_harness/README.md b/python/samples/04-hosting/af-hosting/local_responses_harness/README.md index af8aafedb58..c093e48c27c 100644 --- a/python/samples/04-hosting/af-hosting/local_responses_harness/README.md +++ b/python/samples/04-hosting/af-hosting/local_responses_harness/README.md @@ -71,7 +71,7 @@ store by tenant/user as appropriate for your application. ## Run ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano az login diff --git a/python/samples/04-hosting/af-hosting/local_responses_harness/app.py b/python/samples/04-hosting/af-hosting/local_responses_harness/app.py index b9bef6cab0b..8b94b78f80e 100644 --- a/python/samples/04-hosting/af-hosting/local_responses_harness/app.py +++ b/python/samples/04-hosting/af-hosting/local_responses_harness/app.py @@ -55,7 +55,7 @@ uv sync az login - export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com + export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano uv run hypercorn app:app --bind 0.0.0.0:8000 diff --git a/python/samples/04-hosting/af-hosting/local_responses_workflow/README.md b/python/samples/04-hosting/af-hosting/local_responses_workflow/README.md index 88aca57eef1..b0680a5e600 100644 --- a/python/samples/04-hosting/af-hosting/local_responses_workflow/README.md +++ b/python/samples/04-hosting/af-hosting/local_responses_workflow/README.md @@ -37,7 +37,7 @@ by tenant/user as appropriate for your application. ## Run ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano az login diff --git a/python/samples/04-hosting/af-hosting/local_responses_workflow/app.py b/python/samples/04-hosting/af-hosting/local_responses_workflow/app.py index b7396881a3e..026b56e7e12 100644 --- a/python/samples/04-hosting/af-hosting/local_responses_workflow/app.py +++ b/python/samples/04-hosting/af-hosting/local_responses_workflow/app.py @@ -29,7 +29,7 @@ uv sync az login - export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com + export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano uv run hypercorn app:app --bind 0.0.0.0:8000 diff --git a/python/samples/04-hosting/af-hosting/local_telegram/README.md b/python/samples/04-hosting/af-hosting/local_telegram/README.md index 4320fdb4a52..ab81de63c83 100644 --- a/python/samples/04-hosting/af-hosting/local_telegram/README.md +++ b/python/samples/04-hosting/af-hosting/local_telegram/README.md @@ -27,7 +27,7 @@ supported media, callback-query data, and the commands `/start`, `/help`, Create a Telegram bot with BotFather, then configure: ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano export TELEGRAM_BOT_TOKEN=... az login @@ -44,7 +44,7 @@ Configure the public HTTPS URL that Telegram should call and a random secret used to authenticate webhook deliveries: ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano export TELEGRAM_BOT_TOKEN=... export TELEGRAM_WEBHOOK_URL=https:///telegram/webhook diff --git a/python/samples/04-hosting/container/hyperlight_codeact/.env.example b/python/samples/04-hosting/container/hyperlight_codeact/.env.example index 2a38d9c9b81..b637c3c9c1a 100644 --- a/python/samples/04-hosting/container/hyperlight_codeact/.env.example +++ b/python/samples/04-hosting/container/hyperlight_codeact/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." diff --git a/python/samples/04-hosting/container/hyperlight_codeact/main.py b/python/samples/04-hosting/container/hyperlight_codeact/main.py index 0650df3c39f..3decf0336e0 100644 --- a/python/samples/04-hosting/container/hyperlight_codeact/main.py +++ b/python/samples/04-hosting/container/hyperlight_codeact/main.py @@ -57,7 +57,7 @@ def main(): # 1. Create the Foundry chat client. client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), function_invocation_configuration={"include_detailed_errors": True}, ) diff --git a/python/samples/04-hosting/foundry-hosted-agents/README.md b/python/samples/04-hosting/foundry-hosted-agents/README.md index 50ce84c621c..381b0064d56 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/README.md @@ -138,7 +138,7 @@ This will create the following Azure resources: ```bash export FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" -export AZURE_AI_MODEL_DEPLOYMENT_NAME="" +export FOUNDRY_MODEL="" # And any other environment variables required by the sample ``` @@ -146,7 +146,7 @@ Or in PowerShell: ```powershell $env:FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" -$env:AZURE_AI_MODEL_DEPLOYMENT_NAME="" +$env:FOUNDRY_MODEL="" # And any other environment variables required by the sample ``` @@ -280,7 +280,7 @@ azd deploy > The Foundry hosting infrastructure will inject the following environment variables into your agent at runtime: > > - `FOUNDRY_PROJECT_ENDPOINT`: The endpoint URL for the Foundry project where the agent is deployed. -> - `AZURE_AI_MODEL_DEPLOYMENT_NAME`: The name of the model deployment in your Foundry project. This is configured during the agent initialization process with `azd ai agent init`. +> - `AZURE_AI_MODEL_DEPLOYMENT_NAME`: The azd-managed model deployment name configured by `azd ai agent init`. Sample code prefers `FOUNDRY_MODEL` for local runs and falls back to this hosted value. > - `APPLICATIONINSIGHTS_CONNECTION_STRING`: The connection string for Application Insights to enable telemetry for your agent. This will package your agent and deploy it to the Foundry environment, making it accessible through the Foundry project endpoint. Once it's deployed, you can also access the agent through the Foundry UI. diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/.env.example b/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/main.py b/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/main.py index e6b98f2f159..457eb7c1c8d 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/basic/main.py @@ -42,7 +42,7 @@ def prepare_options(_request: Request, options: dict[str, Any]) -> dict[str, Any def main() -> None: client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ) diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/.env.example b/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py b/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py index 18e5e2f7a0e..b72879adc16 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/break_glass/main.py @@ -24,7 +24,7 @@ # Create the agent client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ) diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/.env.example b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/.env.example index 262ceb61410..dbb1a551353 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/.env.example @@ -1,5 +1,5 @@ FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ -AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-5.6-luna +FOUNDRY_MODEL=gpt-5.6-luna ENABLE_SENSITIVE_DATA=true AZURE_COSMOS_ENDPOINT=https://.documents.azure.com:443/ AZURE_COSMOS_DATABASE_NAME=telegram-agent diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/azure.yaml b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/azure.yaml index 586f734a7c7..d5989239be9 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/azure.yaml +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/azure.yaml @@ -45,6 +45,6 @@ services: version: 2.0.0 ai-project: host: azure.ai.project - endpoint: ${AZURE_AI_PROJECT_ENDPOINT} + endpoint: ${FOUNDRY_PROJECT_ENDPOINT} infra: provider: microsoft.foundry diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/deploy.sh b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/deploy.sh index 3ff17a7525b..e9be961210a 100755 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/deploy.sh +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/deploy.sh @@ -275,7 +275,6 @@ azd_command env set AZURE_SUBSCRIPTION_ID "$SUBSCRIPTION_ID" azd_command env set AZURE_LOCATION "$AZURE_LOCATION" azd_command env set AZURE_RESOURCE_GROUP "$RESOURCE_GROUP_NAME" azd_command env set AZURE_AI_PROJECT_ID "$PROJECT_ID" -azd_command env set AZURE_AI_PROJECT_ENDPOINT "$PROJECT_ENDPOINT" azd_command env set FOUNDRY_PROJECT_ENDPOINT "$PROJECT_ENDPOINT" azd_command env set AZURE_AI_MODEL_DEPLOYMENT_NAME "$MODEL_DEPLOYMENT_NAME" azd_command env set AZURE_COSMOS_ENDPOINT "$COSMOS_ENDPOINT" diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/main.py b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/main.py index 22d75bce427..c21ccb64365 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/main.py @@ -112,7 +112,7 @@ async def get_runtime() -> Runtime: ) client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=credential, ) await client.configure_azure_monitor( diff --git a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/tests/test_main.py b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/tests/test_main.py index 012effe9010..c9fa4abadee 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/tests/test_main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/invocations/telegram/tests/test_main.py @@ -68,7 +68,7 @@ async def test_runtime_configures_azure_monitor_with_sensitive_data(monkeypatch: monkeypatch.setenv("AZURE_COSMOS_DATABASE_NAME", "telegram") monkeypatch.setenv("AZURE_COSMOS_CONTAINER_NAME", "history") monkeypatch.setenv("FOUNDRY_PROJECT_ENDPOINT", "https://sample.services.ai.azure.com/api/projects/sample") - monkeypatch.setenv("AZURE_AI_MODEL_DEPLOYMENT_NAME", "gpt-5.6-luna") + monkeypatch.setenv("FOUNDRY_MODEL", "gpt-5.6-luna") client = SimpleNamespace(configure_azure_monitor=AsyncMock()) agent_constructor = Mock(return_value=SimpleNamespace()) diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/.env.example index 4a2d919abee..e36d82d99fe 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/.env.example @@ -1,4 +1,4 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." AZURE_SEARCH_ENDPOINT="https://.search.windows.net" AZURE_SEARCH_INDEX_NAME="contoso-outdoors" diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/main.py index a97ff62db0f..2b02d3e27a0 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/azure_search_rag/main.py @@ -34,7 +34,7 @@ def create_agent() -> Agent: """Allocate a new Search provider and close its transports after this request.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] search_endpoint = os.environ["AZURE_SEARCH_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] credential = ( diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/.env.example index 6bc4afcd8c3..0dd74fe0cf6 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/.env.example @@ -1,3 +1,3 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." FOUNDRY_AGENT_NAME="agent-framework-agent-basic-responses" \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/README.md b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/README.md index 6510e1a3e3a..d9b46fcd7f0 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/README.md @@ -22,7 +22,7 @@ stored requests. In none of these cases is the caller's `response.id` the downstream service ID. Run one entry point at a time. The deployment manifest targets `main.py`; select another script to deploy a different -mode. Set `FOUNDRY_PROJECT_ENDPOINT` and `AZURE_AI_MODEL_DEPLOYMENT_NAME` in `.env`, then run `python main.py`. +mode. Set `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL` in `.env`, then run `python main.py`. Follow the [parent hosting guide](../../README.md) for local and deployed setup. ## Outer response storage and background diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/agent_history.py b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/agent_history.py index ddd03a02218..3d4712f01df 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/agent_history.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/agent_history.py @@ -17,7 +17,7 @@ def main() -> None: agent = Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ), instructions="Be concise.", diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/main.py index 6fc1e5a766e..2a5158046ff 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/main.py @@ -16,7 +16,7 @@ def main() -> None: client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ) diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/options.py b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/options.py index 8b98afc6f22..f78719b9bd4 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/options.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/options.py @@ -25,7 +25,7 @@ def main() -> None: agent = Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ), instructions="Be concise.", diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/provider_background.py b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/provider_background.py index 46909f6e1c1..dc8b8d71b9f 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/provider_background.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/provider_background.py @@ -18,7 +18,7 @@ def create_agent() -> Agent: return Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ), instructions="Write thorough research reports.", diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/service_history.py b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/service_history.py index ded7e8ddd06..658c5752c62 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/basic/service_history.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/basic/service_history.py @@ -17,7 +17,7 @@ def main() -> None: agent = Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ), instructions="Be concise.", diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/.env.example index cd863e9f23e..7a605975ed1 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/.env.example @@ -1,5 +1,5 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." AZURE_COSMOS_ENDPOINT="https://.documents.azure.com:443/" COSMOS_DATABASE_NAME="..." COSMOS_CONTAINER_NAME="..." diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/README.md b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/README.md index 06499456c6d..340bf9b4cf3 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/README.md @@ -78,7 +78,7 @@ calls use `AzureCliCredential` (`az login`); they do not require Cosmos. ## Run -Set `FOUNDRY_PROJECT_ENDPOINT` and `AZURE_AI_MODEL_DEPLOYMENT_NAME`, then follow +Set `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL`, then follow the [parent local-host instructions](../../README.md#running-the-agent-host-locally). ```bash diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/main.py index 59ce7b7a6be..2175e0bc684 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/custom_storage/main.py @@ -223,7 +223,7 @@ async def close(self) -> None: def create_agent() -> Agent: """Create and clean up the request's own Foundry transports and credential.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/.env.example index 2a38d9c9b81..b637c3c9c1a 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/main.py index eda4e21d7b0..73469924197 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/declarative_customer_support/main.py @@ -58,7 +58,7 @@ def __init__( try: client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=self.credential, ) except BaseException: diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/files/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/files/.env.example index aefa98fe6fd..1e51656a707 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/files/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/files/.env.example @@ -1,3 +1,3 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." TOOLBOX_ENDPOINT="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md b/python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md index dfb81edf78e..245f0dbbc6f 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md @@ -19,7 +19,7 @@ to an unsafe sandbox reader. The hosted-upload helper can run on Windows. ## Prerequisites and lifecycle -Set `FOUNDRY_PROJECT_ENDPOINT` and `AZURE_AI_MODEL_DEPLOYMENT_NAME`, plus either +Set `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL`, plus either `TOOLBOX_ENDPOINT` or `TOOLBOX_NAME`. The Toolbox needs a code-interpreter tool; see the [Toolbox sample](../foundry_toolbox/). Authenticate local runs with `az login`. Deployed runs use the sandbox's managed identity. diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py index 2eb7a213423..59577a64a98 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py @@ -48,7 +48,7 @@ def read_file(filename: str) -> str: def create_agent() -> Agent: """Create the client and MCP connection inside the current request context.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/.env.example index 769c40ef3c4..877e8e37193 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/.env.example @@ -1,7 +1,7 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." # Embedding model deployment (only needed by provision_memory_store.py). -AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME="text-embedding-3-small" +FOUNDRY_EMBEDDING_MODEL="text-embedding-3-small" # Name of the Foundry Memory Store the agent should read/write to. MEMORY_STORE_NAME="agent_framework_memory" # Explicit single-user local scope; never used as a fallback on hosted requests. diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/README.md b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/README.md index 8c7ed49af51..bdafbc199cd 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/README.md @@ -74,8 +74,8 @@ From this directory, with the venv activated and `az login` done: ```bash export FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" -export AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4.1-mini" -export AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME="text-embedding-3-small" +export FOUNDRY_MODEL="gpt-4.1-mini" +export FOUNDRY_EMBEDDING_MODEL="text-embedding-3-small" export MEMORY_STORE_NAME="agent_framework_memory" python provision_memory_store.py ``` @@ -84,12 +84,15 @@ Or in PowerShell: ```powershell $env:FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" -$env:AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4.1-mini" -$env:AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME="text-embedding-3-small" +$env:FOUNDRY_MODEL="gpt-4.1-mini" +$env:FOUNDRY_EMBEDDING_MODEL="text-embedding-3-small" $env:MEMORY_STORE_NAME="agent_framework_memory" python provision_memory_store.py ``` +Existing configurations can continue using `AZURE_AI_MODEL_DEPLOYMENT_NAME` and +`AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME` as compatibility fallbacks. + Expected output (first run): ```text diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/main.py index a996940f7ea..eddfe5602fc 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/main.py @@ -55,7 +55,7 @@ def create_agent() -> Agent: config, context = AgentConfig.from_env(), get_request_context() scope = memory_scope(config, context) endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] store_name = os.environ["MEMORY_STORE_NAME"] headers = context.platform_headers() credential = ( diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py index 7fe42215d20..e2c894f656b 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_memory/provision_memory_store.py @@ -24,8 +24,8 @@ Required env vars (also read from a local ``.env`` file if present): FOUNDRY_PROJECT_ENDPOINT e.g. https://.services.ai.azure.com/api/projects/ - AZURE_AI_MODEL_DEPLOYMENT_NAME Chat model deployment used by the memory store - AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME Embedding model deployment used by the memory store + FOUNDRY_MODEL Chat model deployment used by the memory store + FOUNDRY_EMBEDDING_MODEL Embedding model deployment used by the memory store MEMORY_STORE_NAME Name of the memory store to create Your identity needs ``Foundry User`` (formerly ``Azure AI User``) on the project scope. @@ -49,8 +49,10 @@ async def main() -> None: endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] memory_store_name = os.environ["MEMORY_STORE_NAME"] - chat_model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] - embedding_model = os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"] + chat_model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + embedding_model = ( + os.environ.get("FOUNDRY_EMBEDDING_MODEL") or os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"] + ) async with ( AzureCliCredential() as credential, diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/.env.example index aefa98fe6fd..1e51656a707 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/.env.example @@ -1,3 +1,3 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." TOOLBOX_ENDPOINT="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py index 0af3721f6e3..9e001275d88 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py @@ -32,7 +32,7 @@ def create_agent() -> Agent: """Create tools inside this request so the MCP writer captures its call ID.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/.env.example index 66888c85cbe..81d35a04e4a 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/.env.example @@ -1,5 +1,5 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." # Full versioned MCP endpoint of the skills toolbox the agent consumes. # Copy this from the output of `azd ai toolbox create ... --from-file ./toolbox.yaml`. # Example: https://.services.ai.azure.com/api/projects//toolboxes/maf-skills-toolbox/versions/1/mcp?api-version=v1 diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md index e6443b7ab48..d91b2e0108d 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md @@ -123,7 +123,7 @@ When running the host with plain `python`, put the same value in a `.env` file n ## Running the agent host -Follow the [Running the Agent Host Locally](../../README.md#running-the-agent-host-locally) section of the parent README to run the host with either `azd ai agent run` or plain `python main.py`. This sample requires `TOOLBOX_ENDPOINT` to be set (see Step 3) in addition to the standard `FOUNDRY_PROJECT_ENDPOINT` and `AZURE_AI_MODEL_DEPLOYMENT_NAME` variables. +Follow the [Running the Agent Host Locally](../../README.md#running-the-agent-host-locally) section of the parent README to run the host with either `azd ai agent run` or plain `python main.py`. This sample requires `TOOLBOX_ENDPOINT` to be set (see Step 3) in addition to the standard `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL` variables. ## Interacting with the agent diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py index b2384b0c3d4..772ed9aa90c 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py @@ -32,7 +32,7 @@ def create_agent() -> Agent: """Keep skill caches, credentials and the MCP writer within this request.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/.env.example index bdda1d3404d..563af361db7 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/.env.example @@ -1,3 +1,3 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." GITHUB_PAT="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/main.py index f954619af72..71199574799 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/mcp/main.py @@ -31,7 +31,7 @@ def create_agent() -> Agent: """Build fresh tool configuration without accepting caller-supplied credentials.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] github_pat = os.environ.get("GITHUB_PAT") if not github_pat or not github_pat.strip(): raise RuntimeError("Configure GITHUB_PAT separately before using the GitHub MCP sample.") diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/monty_codeact/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/monty_codeact/main.py index 6eca781d123..67cb53086ea 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/monty_codeact/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/monty_codeact/main.py @@ -73,7 +73,7 @@ def fetch_data( def create_agent() -> Agent: """Create a new interpreter provider and client for the current request.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/observability/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/observability/.env.example index bf9bff74050..6ffdb0ac581 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/observability/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/observability/.env.example @@ -1,3 +1,3 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." +FOUNDRY_MODEL="..." ENABLE_SENSITIVE_DATA=true \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/observability/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/observability/main.py index a8f788760ad..17bc13a5806 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/observability/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/observability/main.py @@ -51,7 +51,7 @@ def get_weather( def create_agent() -> Agent: """Let incoming telemetry context parent each freshly constructed agent.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/resilient_long_running_workflow/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/resilient_long_running_workflow/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/resilient_long_running_workflow/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/resilient_long_running_workflow/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/main.py index 1f37842d505..42c7db60aa2 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/steerable_long_running_agent/main.py @@ -9,7 +9,7 @@ Environment variables: FOUNDRY_PROJECT_ENDPOINT: Microsoft Foundry project endpoint. - AZURE_AI_MODEL_DEPLOYMENT_NAME: Model deployment name. + FOUNDRY_MODEL: Model deployment name. """ import os @@ -26,7 +26,7 @@ def main() -> None: client = FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], - model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], + model=os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], credential=DefaultAzureCredential(), ) diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/tools/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/tools/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/tools/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/tools/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/tools/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/tools/main.py index d2763cef95d..65b40799bae 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/tools/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/tools/main.py @@ -68,7 +68,7 @@ def run_bash(command: str) -> str: def create_agent() -> Agent: """Create client state per request rather than keeping history on the agent.""" endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] credential = ( ManagedIdentityCredential(client_id=os.environ.get("FOUNDRY_AGENT_INSTANCE_CLIENT_ID")) if AgentConfig.from_env().is_hosted diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/.env.example b/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/.env.example index 4d268b931b4..24355872182 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/.env.example +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/.env.example @@ -1,2 +1,2 @@ FOUNDRY_PROJECT_ENDPOINT="..." -AZURE_AI_MODEL_DEPLOYMENT_NAME="..." \ No newline at end of file +FOUNDRY_MODEL="..." \ No newline at end of file diff --git a/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/main.py b/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/main.py index 94de4f6c556..a45c406ea24 100644 --- a/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/main.py +++ b/python/samples/04-hosting/foundry-hosted-agents/responses/workflows/main.py @@ -40,7 +40,7 @@ class SloganAgent(Agent): def __init__(self, name: str, instructions: str) -> None: endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] - model = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] + model = os.environ.get("FOUNDRY_MODEL") or os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] self.credential = DefaultAzureCredential() try: client = FoundryChatClient(project_endpoint=endpoint, model=model, credential=self.credential) diff --git a/python/samples/04-hosting/mcp/README.md b/python/samples/04-hosting/mcp/README.md index ee9bbad97df..12e19922d68 100644 --- a/python/samples/04-hosting/mcp/README.md +++ b/python/samples/04-hosting/mcp/README.md @@ -116,7 +116,7 @@ uv run workflow_app.py The agent samples require Microsoft Foundry configuration: ```bash -export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +export FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ export FOUNDRY_MODEL=gpt-5-nano az login ``` diff --git a/python/samples/05-end-to-end/evaluation/self_reflection/.env.example b/python/samples/05-end-to-end/evaluation/self_reflection/.env.example index 8c24539c3cf..9538877391b 100644 --- a/python/samples/05-end-to-end/evaluation/self_reflection/.env.example +++ b/python/samples/05-end-to-end/evaluation/self_reflection/.env.example @@ -1 +1 @@ -FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ diff --git a/python/samples/05-end-to-end/evaluation/self_reflection/README.md b/python/samples/05-end-to-end/evaluation/self_reflection/README.md index 7a95a103999..b66e8285c41 100644 --- a/python/samples/05-end-to-end/evaluation/self_reflection/README.md +++ b/python/samples/05-end-to-end/evaluation/self_reflection/README.md @@ -19,7 +19,7 @@ This sample demonstrates the self-reflection pattern using Agent Framework and M ### Environment Variables ```bash -FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com +FOUNDRY_PROJECT_ENDPOINT=https://.services.ai.azure.com/api/projects/ ``` ## Running the Sample diff --git a/python/samples/SAMPLE_GUIDELINES.md b/python/samples/SAMPLE_GUIDELINES.md index f3239bc3cef..9faef116dec 100644 --- a/python/samples/SAMPLE_GUIDELINES.md +++ b/python/samples/SAMPLE_GUIDELINES.md @@ -68,7 +68,7 @@ Sample docstring explaining what the sample does. async def main() -> None: client = FoundryChatClient( - project_endpoint="https://your-project.services.ai.azure.com", + project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project", model="gpt-4o", credential=AzureCliCredential(), ) diff --git a/python/scripts/sample_validation/skills/foundry-hosted-agent-validation/SKILL.md b/python/scripts/sample_validation/skills/foundry-hosted-agent-validation/SKILL.md index de8f9a9841d..c21c4ac672d 100644 --- a/python/scripts/sample_validation/skills/foundry-hosted-agent-validation/SKILL.md +++ b/python/scripts/sample_validation/skills/foundry-hosted-agent-validation/SKILL.md @@ -95,11 +95,13 @@ Create `.env` from `.env.example` with the **real** values: ``` FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/" -AZURE_AI_MODEL_DEPLOYMENT_NAME="" +FOUNDRY_MODEL="" ``` Start the server (`python main.py`) — it listens on `http://localhost:8088`. `main.py` uses `DefaultAzureCredential`, so `az login` must be current. +The sample code prefers `FOUNDRY_MODEL` locally and falls back to the +azd-managed `AZURE_AI_MODEL_DEPLOYMENT_NAME` when hosted. Invoke (single turn), capture the returned `response_id`, then reuse it for a follow-up turn to confirm memory: