.Net: Agent Samples - Adding AzureAIAgentsPersistent to Steps (#105)

* Adding Persistent Agent to Steps

* Add comments

* Ensure changes

* Fix format

* Fix formatting

* Adding cancellation token good practice
This commit is contained in:
Roger Barreto
2025-06-26 22:17:59 +00:00
committed by GitHub
parent 06a690685f
commit b46ee00468
11 changed files with 205 additions and 103 deletions
@@ -4,7 +4,6 @@ using Azure.AI.Agents.Persistent;
using Azure.Identity;
using Microsoft.Agents;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.AI.AzureAIAgentsPersistent;
using Microsoft.Shared.Samples;
namespace Providers;
@@ -37,7 +36,7 @@ public sealed class ChatClientAgent_With_AzureAIAgentsPersistent(ITestOutputHelp
// Get the chat client to use for the agent.
using var chatClient = persistentAgentsClient.AsIChatClient(persistentAgent.Id);
// Define the agent
// Define the agent.
ChatClientAgent agent = new(chatClient);
// Start a new thread for the agent conversation.
@@ -38,7 +38,7 @@ public sealed class ChatClientAgent_With_OpenAIAssistant(ITestOutputHelper outpu
// Get the chat client to use for the agent.
using var chatClient = assistantClient.AsIChatClient(assistantId);
// Define the agent
// Define the agent.
ChatClientAgent agent = new(chatClient);
// Start a new thread for the agent conversation.
@@ -34,7 +34,7 @@ public sealed class ChatClientAgent_With_OpenAIChatCompletion(ITestOutputHelper
// Start a new thread for the agent conversation.
AgentThread thread = agent.GetNewThread();
// Respond to user input
// Respond to user input.
await RunAgentAsync("Tell me a joke about a pirate.");
await RunAgentAsync("Now add some emojis to the joke.");
@@ -43,7 +43,7 @@ public sealed class ChatClientAgent_With_OpenAIResponsesChatCompletion(ITestOutp
// Start a new thread for the agent conversation based on the type.
AgentThread thread = agent.GetNewThread();
// Respond to user input
// Respond to user input.
await RunAgentAsync("Tell me a joke about a pirate.");
await RunAgentAsync("Now add some emojis to the joke.");