Skip to content
Blog

Building Enterprise-Grade Multi-Agent Systems with the Microsoft Agent Framework

Take multi-agent systems from prototype to production with Microsoft Agent Framework 1.0. Learn graph-based orchestration patterns, checkpointing, human-in-the-loop, and deploying to Foundry Hosted Agents.

Published on August 20, 2026

AI Assistant

A single agent can answer questions. An enterprise system has to triage, escalate, review, and follow policy—across departments, with audit trails and without losing work when a process crashes. That’s the gap the Microsoft Agent Framework (MAF) was built to close.

In April 2026, MAF reached 1.0 GA for both Python and .NET, unifying the enterprise foundations of Semantic Kernel with the multi-agent orchestration research of AutoGen into a single open-source SDK. You get graph-based workflows, checkpointing, human-in-the-loop approvals, observability, and a path to managed deployment—without stitching frameworks together yourself.

In this tutorial, you will learn how to build a production-grade multi-agent system with MAF: composing sequential and conditional workflows, adding human review gates, and deploying to Foundry Hosted Agents.

Prerequisites

  • Python 3.10+ or .NET 8+
  • pip install agent-framework (Python) or the Microsoft.Agents.* packages (.NET)
  • A chat client provider (Azure OpenAI, Microsoft Foundry, OpenAI, or Ollama for local testing)
  • An Azure subscription with Foundry for the deployment section

Why Multi-Agent for the Enterprise

Modern business challenges—customer journey management, multi-source data governance, deep review processes—quickly exceed what one monolithic agent can handle. A single agent holding every instruction, every tool, and every policy in one context window degrades predictably: instructions conflict, tools bloat the schema, and a hallucinated routing decision can bypass business logic.

MAF’s answer is a collaboration graph: connect specialized agents and functional modules into a cohesive, loosely coupled network. Complex tasks get decomposed into traceable sub-task steps. Intermediate data types and business rules choose the next agent at runtime. The whole thing persists checkpoints so long-running processes survive interruptions.

Your First Multi-Agent Workflow

The simplest enterprise pattern is sequential: one agent does the work, a peer reviews it. Here’s a copywriter + reviewer pipeline:

import asyncio
from agent_framework import Agent, Message
from agent_framework_orchestrations import SequentialBuilder
from agent_framework_foundry import FoundryChatClient
from azure.identity import AzureCliCredential
from typing import cast

async def main():
    client = FoundryChatClient(credential=AzureCliCredential())

    writer = Agent(
        client=client,
        name="writer",
        instructions=(
            "You are a concise copywriter. "
            "Provide a single, punchy marketing sentence."
        ),
    )

    reviewer = Agent(
        client=client,
        name="reviewer",
        instructions=(
            "You are a thoughtful reviewer. "
            "Give brief feedback on the previous message."
        ),
    )

    workflow = SequentialBuilder(participants=[writer, reviewer]).build()

    outputs: list[list[Message]] = []
    async for event in workflow.run("Write a tagline for the product.", stream=True):
        if event.type == "output":
            outputs.append(cast(list[Message], event.data))

    if outputs:
        for msg in outputs[-1]:
            print(f"[{msg.author_name or 'user'}]: {msg.text}")

asyncio.run(main())

Sequential is only the beginning. MAF workflows support the full orchestration toolbox: concurrent fan-out/fan-in, conditional branching on intermediate results, and handoff between peers.

The Conditional Review Pattern

Real enterprise flows don’t move in a straight line. A marketing pipeline needs to route based on review verdicts: approve, rework, or route to a human. MAF models this with a selection function that maps an intermediate result to the next executor:

from agent_framework_orchestrations import (
    AgentExecutor, WorkflowBuilder,
)

def select_targets(review: ReviewResult, target_ids: list[str]) -> list[str]:
    handle_id, save_id = target_ids
    return [save_id] if review.review_result == "Yes" else [handle_id]

workflow = (
    WorkflowBuilder()
    .set_start_executor(AgentExecutor(evangelist_agent, id="evangelist"))
    .add_edge("evangelist", to_evangelist_content)
    .add_edge(to_evangelist_content, "reviewer")
    .add_edge("reviewer", to_reviewer_result)
    .add_multi_selection_edge_group(
        to_reviewer_result,
        ["handle_review", "save_draft"],
        selection_func=select_targets,
    )
    .build()
)

The pattern is layered in production: a concurrent search-and-summarize phase, then a conditional branch that routes to automatic publishing or a sequential human-in-the-loop review. Each layer adds structure without coupling the agents.

Checkpointing: Survive the Crash

A workflow that runs for minutes must not restart from zero if a worker dies. MAF’s workflows support checkpointing and hydration: state is persisted at critical execution nodes, so a paused or interrupted process resumes exactly where it stopped.

This is what makes durable, long-running processes possible:

  • Checkpoints persist state at execution nodes for traceability and fault tolerance.
  • Pause/resume lets workflows wait for human approval or external systems.
  • Streaming keeps the UI responsive while the graph runs.

Checkpointing isn’t just a resilience feature—it’s the foundation for human-in-the-loop, where the workflow must stop, wait (possibly for days), and resume with all context intact.

Human-in-the-Loop Approvals

Autonomous agents are only enterprise-safe when decisions can be gated. MAF builds human review into the execution layer with request/response contracts: a workflow pauses at a node, surfaces a decision request, and resumes with the human’s verdict.

# Inside an executor, pause for human input:
async def request_approval(ctx, draft: DraftContent):
    decision = await ctx.human_input(
        message="Approve this draft for publishing?",
        schema={
            "type": "object",
            "properties": {
                "approved": {"type": "boolean"},
                "note": {"type": "string"},
            },
            "required": ["approved"],
        },
    )
    if decision["approved"]:
        await ctx.send_message(ApprovedContent(draft))
    else:
        await ctx.send_message(ReworkRequest(draft, decision.get("note", "")))

Combined with checkpointing, the approval gate can pause for days without holding compute or a socket open. This is the pattern regulators and risk teams actually accept.

Observability: The Golden Triangle

You cannot run a multi-agent system you can’t see. MAF pairs a built-in DevUI—real-time visualization of execution paths, interaction tracking, performance monitoring—with OpenTelemetry export to APM platforms.

# Enable OTLP tracing for the whole workflow chain.
workflow = workflow.with_tracing(
    enabled=True,
    otlp_exporter="https://my-apm.example.com/v1/traces",
)

With DevUI’s visual execution path plus APM trace data, you can diagnose latency bottlenecks, pinpoint failures, and prove compliance to auditors.

Putting It All Together

For a complete, runnable version of an enterprise multi-agent workflow—including a Foundry-hosted deployment with identity and versioned rollouts—see the official samples:

Deploying with Foundry Hosted Agents

Once the agent runs locally, MAF’s one-command deployment path (azd) packages your code into a container, provisions compute, assigns a dedicated Entra ID, and gives you a stable endpoint:

# Turn a local MAF agent into a hosted agent host:
server = ResponsesHostServer(agent)
server.run()

Hosted Agents give you per-session sandboxes with filesystem persistence, versioned immutable deployments with canary/blue-green rollouts, scale-to-zero economics, and Application Insights tracing injected automatically. The same agents and workflows that run locally are the ones running in production.

Conclusion & Next Steps

You now know how to move a multi-agent system to production with MAF: compose graph-based workflows, gate decisions with human-in-the-loop approvals, persist state with checkpointing, and observe everything with OpenTelemetry.

Next steps:

  • Explore the handoff pattern (HandoffBuilder) for router-style triage across specialists.
  • Evaluate the agent harness capabilities: context compaction, file memory, and skills.
  • Add the agent optimizer loop: production traces feed ranked, reviewable improvements.

Multi-agent systems become enterprise systems when orchestration is deterministic, state is durable, and every decision is observable. MAF 1.0 gives you all three out of the box.

References