Skip to content

fix(lesson08-dotNET-01): Update obsolete code samples#653

Open
marietta-a wants to merge 3 commits into
microsoft:mainfrom
marietta-a:fix/01.dotnet-agent-framework-workflow-ghmodel-basic.cs
Open

fix(lesson08-dotNET-01): Update obsolete code samples#653
marietta-a wants to merge 3 commits into
microsoft:mainfrom
marietta-a:fix/01.dotnet-agent-framework-workflow-ghmodel-basic.cs

Conversation

@marietta-a

@marietta-a marietta-a commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary
This PR updates lesson 08, 01.dotnet-agent-framework-workflow-ghmodel-basic.cs to align with the latest SDKs and event handling APIs.

Addresses: #639

Changes

  • Bumped dependencies to current versions (Microsoft.Extensions.AI@10.*, Microsoft.Agents.AI.Workflows@1.*, Microsoft.Agents.AI.OpenAI@1.*-*, etc.).
  • Replaced GetOpenAIResponseClient().CreateAIAgent() with GetChatClient().AsAIAgent() (AsAIAgent creates an AI agent from an OpenAI.Chat.ChatClient).
  • Updated ChatClientAgentOptions initialization to use Name and Description properties.
  • Changed obsolete workflow execution from InProcessExecution.StreamAsyncInProcessExecution.RunStreamingAsync.
  • Replaced obsolete AgentRunUpdateEvent with AgentResponseUpdateEvent for 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

  • Verified compilation and execution with .NET 10.0.301 SDK.
  • Validated multi‑agent workflow executes successfully with streaming updates.
  • Verified event handling outputs expected results with AgentResponseUpdateEvent.

Copilot AI review requested due to automatic review settings July 8, 2026 14:50
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

👋 Thanks for contributing @marietta-a! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 == "")
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants