Skip to content

.NET: feat: Implement Magentic Orchestration for .NET#5595

Merged
lokitoth merged 11 commits intomainfrom
dev/dotnet_workflow/magentic
May 7, 2026
Merged

.NET: feat: Implement Magentic Orchestration for .NET#5595
lokitoth merged 11 commits intomainfrom
dev/dotnet_workflow/magentic

Conversation

@lokitoth
Copy link
Copy Markdown
Member

@lokitoth lokitoth commented Apr 30, 2026

Motivation and Context

Magentic Orchestration allows users to build task-solving teams of Agents easily by relying on intelligent planning and orchestration of the plan using the available team, by routing dynamically around the workflow.

Description

Implement Magentic Orchestration

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@lokitoth lokitoth self-assigned this Apr 30, 2026
Copilot AI review requested due to automatic review settings April 30, 2026 19:56
@lokitoth lokitoth added the .NET label Apr 30, 2026
@lokitoth lokitoth added agent orchestration Issues related to agent orchestration workflows Related to Workflows in agent-framework labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Implements Magentic Orchestration for .NET, adding a manager-driven planning + progress-ledger loop, orchestration events, and a fluent workflow builder.

Changes:

  • Added Magentic orchestrator/manager/task-context and prompt templates to plan, coordinate rounds, track progress, and reset/replan.
  • Introduced Magentic progress ledger + JSON extraction helpers and tool-call/result matching for transcript rendering.
  • Added unit tests covering JSON extraction and progress-ledger state update/formatting behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs Extends replay agent to support multi-turn scripted outputs for orchestrator tests.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs Adds a test fixture for progress-ledger JSON state + validation helpers.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticProgressLedgerTests.cs Adds tests for extracting JSON from chat messages and validating ledger init/update/schema.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MagenticManagerTests.cs Adds tests for plan updates, progress-ledger retries, and final-answer preparation.
dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowEvent.cs Registers Magentic orchestration events for polymorphic serialization.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/StreamingToolCallResultPairMatcher.cs Adds helper to pair tool calls with tool results across streaming updates.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/PromptTemplates.cs Adds prompt templates for facts, plans, progress ledger, and final answer.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticTaskContext.cs Adds task context/state export + counters/limits and ledger integration.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs Adds the core Magentic orchestration loop, replanning, events, and HITL plan review.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs Adds manager agent interactions for plan creation, ledger updates with retry, and final answer.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticConstants.cs Adds constants for checkpoint persistence keys.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/ExecutorAgentHarness.cs Adds an agent harness that optionally streams updates and tracks sessions.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/ChatMessageExtensions.cs Adds transcript text extraction + fenced/embedded JSON extraction.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs Adds agent reset handling and exposes a stable executor id helper.
dotnet/src/Microsoft.Agents.AI.Workflows/ResetChatSignal.cs Adds a signal type to request agent executors reset state/session.
dotnet/src/Microsoft.Agents.AI.Workflows/MagenticWorkflowBuilder.cs Adds a fluent builder to assemble Magentic workflows and wire executors/edges.
dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs Adds progress-ledger state management + question/schema formatting.
dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs Adds HITL plan review response type.
dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewRequest.cs Adds HITL plan review request type + helpers to approve or revise.
dotnet/src/Microsoft.Agents.AI.Workflows/ExecutorEvent.cs Updates executor events’ polymorphic serialization attributes.
Comments suppressed due to low confidence (1)

dotnet/src/Microsoft.Agents.AI.Workflows/ExecutorEvent.cs:1

  • MagenticOrchestratorEvent derives from WorkflowEvent, not ExecutorEvent. Registering it as a derived type of ExecutorEvent can fail at runtime when building polymorphic metadata (derived type must be assignable to base type). Remove this [JsonDerivedType] from ExecutorEvent (keeping the registration on WorkflowEvent is sufficient).
// Copyright (c) Microsoft. All rights reserved.

Comment thread dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs Outdated
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 2 | Confidence: 94% | Result: All clear

Reviewed: Test Coverage, Design Approach


Automated review by lokitoth's agents

@lokitoth lokitoth force-pushed the dev/dotnet_workflow/magentic branch from 73b4390 to 0378c87 Compare May 4, 2026 18:29
@lokitoth lokitoth moved this to In Progress in Agent Framework May 4, 2026
@lokitoth lokitoth marked this pull request as ready for review May 4, 2026 18:47
@lokitoth lokitoth moved this from In Progress to In Review in Agent Framework May 4, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 2 | Confidence: 93% | Result: All clear

Reviewed: Test Coverage, Design Approach


Automated review by lokitoth's agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent orchestration Issues related to agent orchestration .NET workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

.NET: [Feature]: When will .NET support Workflows Orchestrations - Magentic .NET: Add support for Magentic Orchestration

5 participants