Skip to content

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

Merged
Jacob Alber (lokitoth) merged 11 commits into
mainfrom
dev/dotnet_workflow/magentic
May 7, 2026
Merged

.NET: feat: Implement Magentic Orchestration for .NET#5595
Jacob Alber (lokitoth) merged 11 commits into
mainfrom
dev/dotnet_workflow/magentic

Conversation

@lokitoth

@lokitothJacob Alber (lokitoth) commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

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.

CopilotAI review requested due to automatic review settings April 30, 2026 19:56
@lokitothJacob Alber (lokitoth) added the .NET Usage: [Issues, PRs], Target: .Net label Apr 30, 2026
@lokitothJacob Alber (lokitoth) added agent orchestration workflows Usage: [Issues, PRs], Target: Workflows labels Apr 30, 2026

CopilotAI 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

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

@github-actionsgithub-actionsBot 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.

Automated Code Review

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

Reviewed: Test Coverage, Design Approach


Automated review by lokitoth's agents

@github-actionsgithub-actionsBot 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.

Automated Code Review

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

Reviewed: Test Coverage, Design Approach


Automated review by lokitoth's agents

@moonbox3Evan Mattson (moonbox3) added orchestration Usage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns) and removed agent orchestration labels Jun 17, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NETUsage: [Issues, PRs], Target: .NetorchestrationUsage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns)workflowsUsage: [Issues, PRs], Target: Workflows

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

6 participants

@lokitoth@feynmanloo@alliscode@peibekwe@moonbox3