DEV Community

Cover image for What Can Be Built with Durable Workflows in Microsoft Agent Framework
Vikrant Bagal
Vikrant Bagal

Posted on

What Can Be Built with Durable Workflows in Microsoft Agent Framework

The Microsoft Agent Framework has revolutionized how we build AI-powered applications. With its April 2026 v1.0 release, developers now have a production-ready SDK for creating intelligent agents that can orchestrate complex multi-step workflows. But what exactly can you build with Durable Workflows? Let's explore the possibilities.

The Foundation: Understanding Durable Workflows

Durable Workflows in Microsoft Agent Framework allow you to build stateful, long-running AI orchestrations that survive process restarts and failures. Unlike in-process execution (which is great for development), durable workflows use the Durable Task Scheduler (DTS) to persist workflow state and coordinate execution across distributed systems.

Key Features of Durable Workflows

  • Stateful execution: Workflows survive process restarts and failures
  • Automatic checkpointing: Progress is saved after each step
  • Distributed execution: Executors can run across different machines
  • Long-running orchestrations: Workflows can run for minutes, hours, or even days
  • Observability: Built-in dashboard for monitoring workflow executions

1. Customer Support Systems with Specialized Agents

One of the most practical applications of Durable Workflows is building intelligent customer support systems. Instead of a single monolithic chatbot, you can create a network of specialized agents that work together.

The Architecture

User Query → Triage Agent → 
  ├─ Technical Issues → Technical Support Agent
  ├─ Billing Questions → Billing Agent
  ├─ Account Management → Account Agent
  └─ Escalation → Human Agent (HITL)
Enter fullscreen mode Exit fullscreen mode

Why This Works

The Handoff Orchestration pattern allows agents to transfer complete control to another agent with full conversation context. This is different from the Agent-as-Tools pattern where a primary agent delegates subtasks while retaining overall responsibility.

Key Differences:

Aspect Handoff Agent-as-Tools
Control Flow Agent transfers entire task Primary agent delegates subtasks
Task Ownership New agent owns the task Primary agent retains responsibility
Context Full conversation context transferred Limited context to tools

Implementation Example

// Create specialized support agents
ChatClientAgent technicalSupport = new(client,
    "You are a technical support specialist. Help users troubleshoot software issues.",
    "technical_support", "Technical Support Agent");

ChatClientAgent billingSupport = new(client,
    "You handle billing inquiries, refunds, and payment issues.",
    "billing_support", "Billing Support Agent");

ChatClientAgent triageAgent = new(client,
    "Route customer queries to the appropriate specialist.",
    "triage_agent", "Triage Agent");

// Configure handoff rules
var workflow = AgentWorkflowBuilder.CreateHandoffBuilderWith(triageAgent)
    .WithHandoffs(triageAgent, [technicalSupport, billingSupport])
    .Build();
Enter fullscreen mode Exit fullscreen mode

Benefits:

  • Each agent specializes in a specific domain
  • Customers get accurate, expert responses
  • Seamless handoffs with full context preservation
  • Durable execution across service restarts

2. Content Creation and Review Pipeline

Content creation workflows benefit enormously from durable execution, especially when dealing with long-running tasks like research, drafting, and review.

The Architecture

Content Request → Research Agent → 
  ↓
Draft Creation Agent → 
  ↓
Review Agent (Editorial) → 
  ↓
Approval Agent (Human-in-Loop) → 
  ↓
Publishing Agent
Enter fullscreen mode Exit fullscreen mode

Implementation Pattern

// Define executors for each pipeline stage
internal sealed class ResearchExecutor 
    : Executor<ContentRequest, ResearchData>("Research")
{
    public override async ValueTask<ResearchData> HandleAsync(
        ContentRequest request, IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Gather information from multiple sources
        var sources = await ResearchSourcesAsync(request.Topic);
        return new ResearchData(sources, request.Topic);
    }
}

internal sealed class DraftExecutor 
    : Executor<ResearchData, DraftContent>("Draft")
{
    public override async ValueTask<DraftContent> HandleAsync(
        ResearchData research, IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Generate draft content
        return await GenerateDraftAsync(research);
    }
}

internal sealed class ReviewExecutor 
    : Executor<DraftContent, ReviewResult>("Review")
{
    public override async ValueTask<ReviewResult> HandleAsync(
        DraftContent draft, IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Editorial review with feedback
        return await ReviewContentAsync(draft);
    }
}

internal sealed class ApprovalExecutor 
    : Executor<ReviewResult, ApprovalStatus>("Approval")
{
    public override async ValueTask<ApprovalStatus> HandleAsync(
        ReviewResult review, IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Queue for human approval
        return await RequestHumanApprovalAsync(review);
    }
}

// Build the workflow
var contentPipeline = new WorkflowBuilder(researchExecutor)
    .WithName("ContentCreationPipeline")
    .WithDescription("Research → Draft → Review → Approval → Publish")
    .AddEdge(researchExecutor, draftExecutor)
    .AddEdge(draftExecutor, reviewExecutor)
    .AddEdge(reviewExecutor, approvalExecutor)
    .Build();
Enter fullscreen mode Exit fullscreen mode

Why Durable Matters Here:

  • Research can take hours across multiple sources
  • Drafting and review may span multiple days
  • Approval workflows can involve multiple stakeholders
  • Workflow state survives server restarts and failures

3. Multi-Agent Translation Pipeline

A practical example from Microsoft's documentation shows how to build a translation pipeline using multiple specialized agents.

The Architecture

Input Text → French Translator → Spanish Translator → English Translator → Output
Enter fullscreen mode Exit fullscreen mode

Implementation

// Create translation agents for different languages
AIAgent frenchAgent = await GetTranslationAgentAsync("French", aiProjectClient, deploymentName);
AIAgent spanishAgent = await GetTranslationAgentAsync("Spanish", aiProjectClient, deploymentName);
AIAgent englishAgent = await GetTranslationAgentAsync("English", aiProjectClient, deploymentName);

// Build sequential workflow
var workflow = new WorkflowBuilder(frenchAgent)
    .AddEdge(frenchAgent, spanishAgent)
    .AddEdge(spanishAgent, englishAgent)
    .Build();

// Execute with streaming to observe real-time updates
await using StreamingRun run = await InProcessExecution.RunStreamingAsync(
    workflow, 
    new ChatMessage(ChatRole.User, "Hello World!"));

await run.TrySendMessageAsync(new TurnToken(emitEvents: true));

await foreach (var evt in run.WatchStreamAsync())
{
    if (evt is ExecutorCompletedEvent completed)
    {
        Console.WriteLine($"{completed.ExecutorId}: {completed.Data}");
    }
}
Enter fullscreen mode Exit fullscreen mode

Key Features:

  • Sequential agent chaining with type safety
  • Real-time streaming updates
  • Each agent specializes in translation between specific languages
  • Durable execution for long-running translations

4. Enterprise AI Orchestration with Microsoft 365

For enterprise scenarios, Microsoft Agent Framework enables sophisticated multi-agent workflows integrated with Microsoft 365 services.

The Architecture

Enterprise Request → 
  ├─ HR Agent (Employee data, policies)
  ├─ Finance Agent (Budgets, expenses)
  ├─ IT Agent (System access, troubleshooting)
  └─ Compliance Agent (Policy verification)
Enter fullscreen mode Exit fullscreen mode

Diamond Orchestration Pattern

Enterprise workflows often use a diamond orchestration pattern where multiple agents work in parallel, then results are merged and processed further.

var workflow = new WorkflowBuilder(inputAgent)
    // Fan-out to multiple specialized agents
    .AddFanOutEdge(inputAgent, [hrAgent, financeAgent, itAgent, complianceAgent])
    // Wait for all to complete
    .AddFanInBarrierEdge([hrAgent, financeAgent, itAgent, complianceAgent], mergeAgent)
    // Process merged results
    .AddEdge(mergeAgent, finalProcessingAgent)
    .Build();
Enter fullscreen mode Exit fullscreen mode

Benefits for Enterprises:

  • Specialized agents for different business domains
  • Parallel processing for faster response times
  • Integration with existing Microsoft 365 infrastructure
  • Distributed execution across Azure resources

5. Order Processing Systems

A practical example from the Microsoft blog shows how to build a durable order processing workflow.

The Architecture

Order Request → Order Lookup → Order Cancel → Send Email → Complete
Enter fullscreen mode Exit fullscreen mode

Implementation

internal sealed class OrderLookup 
    : Executor<OrderCancelRequest, Order>("OrderLookup")
{
    public override async ValueTask<Order> HandleAsync(
        OrderCancelRequest message, 
        IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Lookup order from database
        await Task.Delay(TimeSpan.FromMilliseconds(100), cancellationToken);
        return new Order(
            Id: message.OrderId,
            OrderDate: DateTime.UtcNow.AddDays(-1),
            IsCancelled: false,
            CancelReason: message.Reason,
            Customer: new Customer("Jerry", "jerry@example.com"));
    }
}

internal sealed class OrderCancel 
    : Executor<Order, Order>("OrderCancel")
{
    public override async ValueTask<Order> HandleAsync(
        Order message,
        IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken);
        return message with { IsCancelled = true };
    }
}

internal sealed class SendEmail 
    : Executor<Order, string>("SendEmail")
{
    public override ValueTask<string> HandleAsync(
        Order message,
        IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        return ValueTask.FromResult(
            $"Cancellation email sent for order {message.Id} " +
            $"to {message.Customer.Email}.");
    }
}

// Build workflow
var cancelOrder = new WorkflowBuilder(orderLookup)
    .WithName("CancelOrder")
    .WithDescription("Cancel an order and notify the customer")
    .AddEdge(orderLookup, orderCancel)
    .AddEdge(orderCancel, sendEmail)
    .Build();
Enter fullscreen mode Exit fullscreen mode

Running with Durable Execution

// Add durable packages
dotnet add package Microsoft.Agents.AI.DurableTask --prerelease
dotnet add package Microsoft.DurableTask.Client.AzureManaged
dotnet add package Microsoft.DurableTask.Worker.AzureManaged

// Configure durable workflow
IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        services.ConfigureDurableWorkflows(
            workflowOptions => 
                workflowOptions.AddWorkflow(cancelOrder),
            workerBuilder: builder =>
                builder.UseDurableTaskScheduler(dtsConnectionString),
            clientBuilder: builder =>
                builder.UseDurableTaskScheduler(dtsConnectionString));
    })
    .Build();

// Start the host and run workflow
await host.StartAsync();

IWorkflowClient workflowClient = 
    host.Services.GetRequiredService<IWorkflowClient>();

var request = new OrderCancelRequest("12345", "Wrong color");
var run = await workflowClient.RunAsync(cancelOrder, request);

string result = await run.WaitForCompletionAsync<string>();
Console.WriteLine($"Workflow completed: {result}");
Enter fullscreen mode Exit fullscreen mode

Durability Benefits:

  • State persists across process restarts
  • Automatic checkpointing after each step
  • Observable execution timeline in DTS Dashboard
  • Can resume from failure without losing work

6. Human-in-the-Loop Approval Workflows

For sensitive operations, Durable Workflows enable human approval checkpoints integrated into the automation pipeline.

Use Cases

  • Financial transactions requiring manager approval
  • Content publishing requiring editorial review
  • Data access requests requiring security approval
  • Contract negotiations requiring legal review

Implementation Pattern

internal sealed class HumanApprovalExecutor 
    : Executor<ApprovalRequest, ApprovalResponse>("HumanApproval")
{
    public override async ValueTask<ApprovalResponse> HandleAsync(
        ApprovalRequest request,
        IWorkflowContext context,
        CancellationToken cancellationToken = default)
    {
        // Queue approval request to external system
        var approvalId = await QueueApprovalRequestAsync(request);

        // Wait for human response (could be hours/days)
        var response = await WaitForHumanResponseAsync(approvalId, cancellationToken);

        // Return approval result to workflow
        return new ApprovalResponse(request, response.Approved, response.Notes);
    }
}
Enter fullscreen mode Exit fullscreen mode

Key Features:

  • Workflows can pause for hours or days
  • State persists across server restarts
  • Seamless integration with external approval systems
  • Full audit trail of approval decisions

7. Parallel Processing with Fan-Out/Fan-In

For tasks that require parallel execution, the fan-out/fan-in pattern enables efficient processing.

Example: Document Analysis

var workflow = new WorkflowBuilder(inputAgent)
    // Fan-out: Process input in parallel
    .AddFanOutEdge(inputAgent, [
        researchAgent,      // Researches the topic
        analysisAgent,      // Analyzes data
        summaryAgent,       // Creates summary
        citationAgent       // Generates citations
    ])
    // Fan-in: Wait for all to complete
    .AddFanInBarrierEdge([
        researchAgent,
        analysisAgent,
        summaryAgent,
        citationAgent
    ], mergeAgent)
    // Process merged results
    .AddEdge(mergeAgent, finalOutputAgent)
    .Build();
Enter fullscreen mode Exit fullscreen mode

Benefits:

  • Reduces processing time through parallelism
  • Each agent specializes in a specific task
  • Automatic synchronization at merge point
  • Scalable across multiple machines

Running Durable Workflows Locally

For development, you can run the DTS emulator locally:

docker run -d --name dts-emulator \
  -p 8080:8080 -p 8082:8082 \
  mcr.microsoft.com/dts/dts-emulator:latest
Enter fullscreen mode Exit fullscreen mode

Access the Dashboard:

Conclusion

Durable Workflows in Microsoft Agent Framework enable you to build sophisticated AI-powered applications that:

  1. Survive failures - State persists across restarts and crashes
  2. Run for extended periods - Workflows can execute for minutes, hours, or days
  3. Scale horizontally - Executors can run across multiple machines
  4. Provide observability - Built-in dashboard for monitoring and debugging
  5. Integrate with enterprise systems - Works with Azure, Microsoft 365, and more

Whether you're building customer support systems, content pipelines, enterprise orchestrations, or approval workflows, Durable Workflows provide the foundation for reliable, production-ready AI applications.


Ready to get started? Check out the Microsoft Agent Framework GitHub repository and the official documentation for more examples and tutorials.


This article is based on Microsoft's official documentation and blog posts from May 2026. All code examples are adapted from the official Microsoft Agent Framework samples.

Additional Resources


About the Author

This article was researched and written as part of a comprehensive technical blog series exploring the latest developments in .NET and AI agent frameworks.


LinkedIn Profile: https://www.linkedin.com/in/vikrant-bagal

Top comments (0)