From c408a2d8c383eac7ca45759c19d418b84d045aed Mon Sep 17 00:00:00 2001 From: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:47:54 +0100 Subject: [PATCH] update the sample to have more relevant background responses prompts and reference official documentation. (#1654) --- .../Agents/Agent_Step17_BackgroundResponses/Program.cs | 6 +++--- .../Agents/Agent_Step17_BackgroundResponses/README.md | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Program.cs b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Program.cs index bae2a2ab93..dbf86cf480 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Program.cs +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Program.cs @@ -14,7 +14,7 @@ AIAgent agent = new AzureOpenAIClient( new Uri(endpoint), new AzureCliCredential()) .GetOpenAIResponseClient(deploymentName) - .CreateAIAgent(instructions: "You are good at telling jokes.", name: "Joker"); + .CreateAIAgent(); // Enable background responses (only supported by OpenAI Responses at this time). AgentRunOptions options = new() { AllowBackgroundResponses = true }; @@ -22,7 +22,7 @@ AgentRunOptions options = new() { AllowBackgroundResponses = true }; AgentThread thread = agent.GetNewThread(); // Start the initial run. -AgentRunResponse response = await agent.RunAsync("Tell me a joke about a pirate.", thread, options); +AgentRunResponse response = await agent.RunAsync("Write a very long novel about otters in space.", thread, options); // Poll until the response is complete. while (response.ContinuationToken is { } token) @@ -45,7 +45,7 @@ thread = agent.GetNewThread(); AgentRunResponseUpdate? lastReceivedUpdate = null; // Start streaming. -await foreach (AgentRunResponseUpdate update in agent.RunStreamingAsync("Tell me a joke about a pirate.", thread, options)) +await foreach (AgentRunResponseUpdate update in agent.RunStreamingAsync("Write a very long novel about otters in space.", thread, options)) { // Output each update. Console.Write(update.Text); diff --git a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md index fa229ae439..64414a7f1e 100644 --- a/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md +++ b/dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/README.md @@ -7,6 +7,8 @@ This sample demonstrates how to use background responses with ChatCompletionAgen > **Note:** Background responses are currently only supported by OpenAI Responses. +For more information, see the [official documentation](https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-background-responses?pivots=programming-language-csharp). + # Prerequisites Before you begin, ensure you have the following prerequisites: