.NET: feat: Implement Magentic Orchestration for .NET#5595
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
MagenticOrchestratorEventderives fromWorkflowEvent, notExecutorEvent. Registering it as a derived type ofExecutorEventcan fail at runtime when building polymorphic metadata (derived type must be assignable to base type). Remove this[JsonDerivedType]fromExecutorEvent(keeping the registration onWorkflowEventis sufficient).
// Copyright (c) Microsoft. All rights reserved.
73b4390 to
0378c87
Compare
8235d6b to
b8f4195
Compare
alliscode
reviewed
May 4, 2026
peibekwe
reviewed
May 5, 2026
peibekwe
reviewed
May 5, 2026
alliscode
approved these changes
May 5, 2026
alliscode
approved these changes
May 7, 2026
This was referenced May 8, 2026
Open
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.
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