fix(lesson08-dotNET-01): Update obsolete code samples#653
Open
marietta-a wants to merge 3 commits into
Open
Conversation
Contributor
|
👋 Thanks for contributing @marietta-a! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Lesson 08 .NET workflow code sample to use the latest Microsoft Agent Framework / Workflows APIs and the newer chat-agent creation + streaming execution/event patterns.
Changes:
- Updated package references and moved to newer SDK surface (e.g.,
GetChatClient(...).AsAIAgent(...)). - Switched streaming execution to
InProcessExecution.RunStreamingAsync. - Updated streaming event handling to use
AgentResponseUpdateEvent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2
to
+8
| #:package Microsoft.Extensions.AI@10.* | ||
| #:package Azure.AI.OpenAI@2.1.0 | ||
| #:package Azure.Identity@1.15.0 | ||
| #:package System.Linq.Async@6.0.3 | ||
| #:package OpenTelemetry.Api@1.0.0 | ||
| #:package Microsoft.Agents.AI.Workflows@1.0.0-preview.251001.3 | ||
| #:package Microsoft.Agents.AI.OpenAI@1.0.0-preview.251001.3 | ||
| #:package OpenTelemetry.Api@1.* | ||
| #:package Microsoft.Agents.AI.Workflows@1.* | ||
| #:package Microsoft.Agents.AI.OpenAI@1.*-* |
Comment on lines
+18
to
20
| using ChatMessage = Microsoft.Extensions.AI.ChatMessage; | ||
| using OpenAI.Chat; | ||
| using DotNetEnv; |
Comment on lines
75
to
79
| { | ||
| if (evt is AgentRunUpdateEvent executorComplete) | ||
| if (evt is AgentResponseUpdateEvent executorComplete) | ||
| { | ||
| if (id == "") | ||
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates lesson 08,
01.dotnet-agent-framework-workflow-ghmodel-basic.csto align with the latest SDKs and event handling APIs.Addresses: #639
Changes
Microsoft.Extensions.AI@10.*,Microsoft.Agents.AI.Workflows@1.*,Microsoft.Agents.AI.OpenAI@1.*-*, etc.).GetOpenAIResponseClient().CreateAIAgent()withGetChatClient().AsAIAgent()(AsAIAgentcreates an AI agent from anOpenAI.Chat.ChatClient).ChatClientAgentOptionsinitialization to useNameandDescriptionproperties.InProcessExecution.StreamAsync→InProcessExecution.RunStreamingAsync.AgentRunUpdateEventwithAgentResponseUpdateEventfor streaming event handling.Why
The previous sample referenced deprecated APIs (
GetOpenAIResponseClient,AgentRunUpdateEvent) that are no longer available in the current SDKs. This update ensures the multi‑agent workflow compiles and runs correctly with the latest stable packages.Testing
.NET 10.0.301 SDK.AgentResponseUpdateEvent.