diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/AgentThreadAndHITL.csproj b/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/AgentThreadAndHITL.csproj
index 40acd79245..7494a69fba 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/AgentThreadAndHITL.csproj
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/AgentThreadAndHITL.csproj
@@ -39,7 +39,7 @@
-
+
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/Program.cs b/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/Program.cs
index 305b9835ed..0abb63623b 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/Program.cs
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/Program.cs
@@ -28,7 +28,7 @@ AIAgent agent = new AzureOpenAIClient(
new AzureCliCredential())
.GetChatClient(deploymentName)
.AsIChatClient()
- .CreateAIAgent(
+ .AsAIAgent(
instructions: "You are a helpful assistant",
tools: [new ApprovalRequiredAIFunction(AIFunctionFactory.Create(GetWeather))]
);
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj
index d6cdf97805..f41d4323f7 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj
@@ -38,6 +38,7 @@
+
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/Program.cs b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/Program.cs
index 0898bc0252..8bcde40ec0 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/Program.cs
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/Program.cs
@@ -29,7 +29,7 @@ AIAgent agent = new AzureOpenAIClient(
new DefaultAzureCredential())
.GetResponsesClient(deploymentName)
.AsIChatClient()
- .CreateAIAgent(
+ .AsAIAgent(
instructions: "You answer questions by searching the Microsoft Learn content only.",
name: "MicrosoftLearnAgent",
tools: [mcpTool]);
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj
index 3c08f4558e..95f5599cba 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/AgentWithTextSearchRag.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/Program.cs b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/Program.cs
index ae94a52f67..d31a72beda 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/Program.cs
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/Program.cs
@@ -9,7 +9,6 @@ using Azure.AI.OpenAI;
using Azure.Identity;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
-using OpenAI.Chat;
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
@@ -28,13 +27,14 @@ AIAgent agent = new AzureOpenAIClient(
new Uri(endpoint),
new DefaultAzureCredential())
.GetChatClient(deploymentName)
- .CreateAIAgent(new ChatClientAgentOptions
+ .AsIChatClient()
+ .AsAIAgent(new ChatClientAgentOptions
{
ChatOptions = new ChatOptions
{
Instructions = "You are a helpful support specialist for Contoso Outdoors. Answer questions using the provided context and cite the source document when available.",
},
- AIContextProviderFactory = ctx => new TextSearchProvider(MockSearchAsync, ctx.SerializedState, ctx.JsonSerializerOptions, textSearchOptions)
+ AIContextProviders = [new TextSearchProvider(MockSearchAsync, textSearchOptions)]
});
await agent.RunAIAgentAsync();
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/AgentWithTools.csproj b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/AgentWithTools.csproj
index 57d5d35de0..9fe52d270c 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/AgentWithTools.csproj
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/AgentWithTools.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj b/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj
index 906c3db8de..ad14a2f70c 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/AgentsInWorkflows.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/Program.cs b/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/Program.cs
index bd37a8311f..b1647fe81c 100644
--- a/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/Program.cs
+++ b/dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/Program.cs
@@ -32,7 +32,7 @@ AIAgent agent = new WorkflowBuilder(frenchAgent)
.AddEdge(frenchAgent, spanishAgent)
.AddEdge(spanishAgent, englishAgent)
.Build()
- .AsAgent();
+ .AsAIAgent();
await agent.RunAIAgentAsync();