Building Resilient Multi-Step Workflows with Microsoft Agent Framework
Introduction to Durable Workflows in the Microsoft Agent Framework
The Microsoft Agent Framework (MAF) is an open-source, multi-language toolkit for creating, orchestrating, and deploying AI agents. Since its preview announcement, a powerful workflow programming model has been introduced, enabling developers to combine multiple agents and tasks into robust, multi-step pipelines. In this article, we'll explore how to design durable workflows that handle sequential chains, parallel fan-out/fan-in patterns, conditional branching, and human-in-the-loop approvals—all while maintaining state across execution steps.

Core Concepts: Executors and the Workflow Builder
Understanding Executors
An Executor is the fundamental unit of work in a MAF workflow. Each executor receives typed input, processes it, and produces output. You create custom executors by subclassing Executor<TInput, TOutput> and overriding the HandleAsync method. For example, an order cancellation workflow might include executors for looking up an order, cancelling it, and sending a notification email.
Constructing the Workflow Graph
Using the workflow builder, you wire executors into a directed graph that controls execution order, data flow, and error handling. The framework supports sequential chains, parallel execution, conditional branching, and even human-in-the-loop steps. This graph is then executed by a lightweight in-process runner, ideal for local development and rapid prototyping.
Getting Started: A Simple Console Application
To begin building your first durable workflow, create a new .NET console project and add the required NuGet packages:
dotnet add package Microsoft.Agents.AI
dotnet add package Microsoft.Agents.AI.Workflows
Then define your executors. For instance, an order cancellation flow might consist of three executors:
- OrderLookup – Retrieves order details from a data store.
- OrderCancel – Marks the order as cancelled.
- SendEmail – Sends a confirmation email to the customer.
Each executor inherits from Executor<TInput, TOutput> and implements the HandleAsync method. The output of one executor becomes the input of the next, enabling seamless data flow.
Adding Durability and State Persistence
While the in-process runner works for simple scenarios, production workflows often need to survive application restarts or failures. To add durability, you can integrate the workflow engine with an external state store (e.g., Azure Blob Storage, Cosmos DB) or use Azure Functions as the hosting environment. The framework automatically tracks execution progress, so if a step fails, the workflow can resume from the last checkpoint.
Parallel AI Agents and Fan-Out Patterns
One of the framework's strengths is its support for parallel execution. You can define a fan-out step where multiple AI agents or tasks run concurrently, then consolidate their results in a fan-in step. This is ideal for scenarios like processing multiple customer orders simultaneously or analyzing data from several sources.

Human-in-the-Loop Approval Steps
Workflows often require manual intervention. MAF allows you to pause execution and wait for human approval, then resume automatically. This pattern is essential for compliance-heavy processes or any scenario where decisions require human oversight.
Hosting in Azure Functions
For scalable, event-driven execution, you can host your workflows as Azure Functions. By integrating with Azure Durable Functions or the MAF hosting extensions, your workflows gain automatic scaling, monitoring, and fault-tolerance. The same workflow code you built for the console app can be deployed serverless with minimal changes.
Sequential Chains Example
The simplest workflow pattern is a linear chain of executors. For instance, in the order cancellation scenario, the OrderLookup executor passes an Order object to OrderCancel, which then passes it to SendEmail. The framework handles the routing and error propagation automatically.
Parallel Fan-Out/Fan-In Example
Imagine you need to validate an order against multiple business rules simultaneously. You can create a fan-out step that dispatches the order to several validator executors (each running in parallel), then a fan-in step that aggregates the results. MAF ensures all parallel tasks complete before proceeding, and it collects any errors.
Error Handling and Propagation
Each executor can throw exceptions, and the framework provides built-in mechanisms to catch and propagate errors. You can configure retry policies, compensation actions (to undo partial work), or route errors to a dedicated handling executor. This makes your workflows resilient and maintainable.
Conclusion
The Microsoft Agent Framework's workflow programming model offers a flexible and powerful way to build durable, multi-step pipelines for AI agents. From simple sequential chains to complex parallel and human-in-the-loop patterns, the framework handles execution, data flow, and state persistence. By starting with an in-process runner and later migrating to Azure Functions, you can scale from local development to production with confidence. Dive into the documentation to explore advanced features like long-running workflows, versioning, and monitoring.
Related Articles
- SUSE Unveils AI-Native Infrastructure Layer for Enterprise Clouds at KubeCon Europe 2026
- How to Use JetStream 3 for Modern Web Performance Testing
- HP Z6 G5 A Workstation: Powering Linux Creators with AMD Threadripper PRO 9000 and NVIDIA RTX PRO Blackwell
- How to Track AI Spending in Amazon Bedrock with IAM Cost Allocation
- The $5,000 Smart Bed That Almost Ruined My Sleep
- How to Keep Software Delivery Human-Centered When Adopting AI
- Unlock Your Switch’s Hidden Power: The SFP Port That Can Transform Your Network
- Global Internet Blackouts Surge in Q1 2026: Government Shutdowns and Infrastructure Failures Disrupt Connectivity Worldwide