WhatschatDocsReviews & Comparisons
Related
6 Key Features of the Aiper EcoSurfer S2 Pool Skimmer That Make It a Top ContenderUnderstanding Extrinsic Hallucinations in Large Language ModelsWeekend Gaming Plans: Balancing Renovations and RelaxationHonor MagicPad 4 Surprises as Mid-Range Tablet Champion: Industry Analysts Hail Value and DesignMicrosoft Unveils Durable Workflow Engine for AI Agents FrameworkBeelink EX Mate Pro Review: A USB4 v2 Dock Offering Four M.2 Slots and Blazing SpeedGlobal Internet Disruptions Surge in Q1 2026: Government Shutdowns, Power Grid Failures, and Conflict Hit ConnectivityYour Complete Guide to Relieving Knee Arthritis Pain Through Aerobic Exercise

Building Resilient Multi-Step Workflows with Microsoft Agent Framework

Last updated: 2026-05-09 19:28:25 · Reviews & Comparisons

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.

Building Resilient Multi-Step Workflows with Microsoft Agent Framework
Source: devblogs.microsoft.com

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.

Building Resilient Multi-Step Workflows with Microsoft Agent Framework
Source: devblogs.microsoft.com

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.