.NET: Update Migration Samples for SK OpenAIResponsesAgent Step 1 & 2 (#1010)

* Addressing a SK bug where threads can't be reused + threads should be capture after the request, not created before

* Using storedenabled to align with AF default behavior

* Address copilot comment

* Address Azure + OpenAI remaining sample improvements
This commit is contained in:
Roger Barreto
2025-09-30 15:49:16 +00:00
committed by GitHub
parent 4866936041
commit ff8b97cc72
4 changed files with 23 additions and 17 deletions
@@ -25,14 +25,16 @@ async Task SKAgentAsync()
{
Name = "Joker",
Instructions = "You are good at telling jokes.",
StoreEnabled = true
};
var agentOptions = new OpenAIResponseAgentInvokeOptions() { ResponseCreationOptions = new() { MaxOutputTokenCount = 1000 } };
Microsoft.SemanticKernel.Agents.AgentThread? thread = new OpenAIResponseAgentThread(responseClient);
Microsoft.SemanticKernel.Agents.AgentThread? thread = null;
await foreach (var item in agent.InvokeAsync(userInput, thread, agentOptions))
{
Console.WriteLine(item.Message);
thread = item.Thread;
}
Console.WriteLine("---");