Skip to content

Commit 1e2616d

Browse files
authored
.NET: [BREAKING] Rename GetNewSession to CreateSession (#3501)
* Rename GetNewSession to CreateSession * Address copilot feedback * Suppress warning * Suppress warning * Fix further warnings.
1 parent ff7041b commit 1e2616d

File tree

132 files changed

+277
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+277
-261
lines changed

dotnet/samples/A2AClientServer/A2AClient/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private static async Task HandleCommandsAsync(CancellationToken cancellationToke
4242
// Create the Host agent
4343
var hostAgent = new HostClientAgent(loggerFactory);
4444
await hostAgent.InitializeAgentAsync(modelId, apiKey, agentUrls!.Split(";"));
45-
AgentSession session = await hostAgent.Agent!.GetNewSessionAsync(cancellationToken);
45+
AgentSession session = await hostAgent.Agent!.CreateSessionAsync(cancellationToken);
4646
try
4747
{
4848
while (true)

dotnet/samples/AGUIClientServer/AGUIClient/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private static async Task HandleCommandsAsync(CancellationToken cancellationToke
8888
description: "AG-UI Client Agent",
8989
tools: [changeBackground, readClientClimateSensors]);
9090

91-
AgentSession session = await agent.GetNewSessionAsync(cancellationToken);
91+
AgentSession session = await agent.CreateSessionAsync(cancellationToken);
9292
List<ChatMessage> messages = [new(ChatRole.System, "You are a helpful assistant.")];
9393
try
9494
{

dotnet/samples/Durable/Agents/AzureFunctions/01_SingleAgent/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
#pragma warning disable IDE0002 // Simplify Member Access
4+
35
using Azure;
46
using Azure.AI.OpenAI;
57
using Azure.Identity;

dotnet/samples/Durable/Agents/AzureFunctions/02_AgentOrchestration_Chaining/FunctionTriggers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed record TextResponse(string Text);
1919
public static async Task<string> RunOrchestrationAsync([OrchestrationTrigger] TaskOrchestrationContext context)
2020
{
2121
DurableAIAgent writer = context.GetAgent("WriterAgent");
22-
AgentSession writerSession = await writer.GetNewSessionAsync();
22+
AgentSession writerSession = await writer.CreateSessionAsync();
2323

2424
AgentResponse<TextResponse> initial = await writer.RunAsync<TextResponse>(
2525
message: "Write a concise inspirational sentence about learning.",

dotnet/samples/Durable/Agents/AzureFunctions/02_AgentOrchestration_Chaining/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
#pragma warning disable IDE0002 // Simplify Member Access
4+
35
using Azure;
46
using Azure.AI.OpenAI;
57
using Azure.Identity;

dotnet/samples/Durable/Agents/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
#pragma warning disable IDE0002 // Simplify Member Access
4+
35
using Azure;
46
using Azure.AI.OpenAI;
57
using Azure.Identity;

dotnet/samples/Durable/Agents/AzureFunctions/04_AgentOrchestration_Conditionals/FunctionTriggers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static async Task<string> RunOrchestrationAsync([OrchestrationTrigger] Ta
2121

2222
// Get the spam detection agent
2323
DurableAIAgent spamDetectionAgent = context.GetAgent("SpamDetectionAgent");
24-
AgentSession spamSession = await spamDetectionAgent.GetNewSessionAsync();
24+
AgentSession spamSession = await spamDetectionAgent.CreateSessionAsync();
2525

2626
// Step 1: Check if the email is spam
2727
AgentResponse<DetectionResult> spamDetectionResponse = await spamDetectionAgent.RunAsync<DetectionResult>(
@@ -43,7 +43,7 @@ public static async Task<string> RunOrchestrationAsync([OrchestrationTrigger] Ta
4343

4444
// Generate and send response for legitimate email
4545
DurableAIAgent emailAssistantAgent = context.GetAgent("EmailAssistantAgent");
46-
AgentSession emailSession = await emailAssistantAgent.GetNewSessionAsync();
46+
AgentSession emailSession = await emailAssistantAgent.CreateSessionAsync();
4747

4848
AgentResponse<EmailResponse> emailAssistantResponse = await emailAssistantAgent.RunAsync<EmailResponse>(
4949
message:

dotnet/samples/Durable/Agents/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
#pragma warning disable IDE0002 // Simplify Member Access
4+
35
using Azure;
46
using Azure.AI.OpenAI;
57
using Azure.Identity;

dotnet/samples/Durable/Agents/AzureFunctions/05_AgentOrchestration_HITL/FunctionTriggers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static async Task<object> RunOrchestrationAsync(
2424

2525
// Get the writer agent
2626
DurableAIAgent writerAgent = context.GetAgent("WriterAgent");
27-
AgentSession writerSession = await writerAgent.GetNewSessionAsync();
27+
AgentSession writerSession = await writerAgent.CreateSessionAsync();
2828

2929
// Set initial status
3030
context.SetCustomStatus($"Starting content generation for topic: {input.Topic}");

dotnet/samples/Durable/Agents/AzureFunctions/05_AgentOrchestration_HITL/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
#pragma warning disable IDE0002 // Simplify Member Access
4+
35
using Azure;
46
using Azure.AI.OpenAI;
57
using Azure.Identity;

0 commit comments

Comments
 (0)