Skip to main content
Subscribe

Magentic Teams with Microsoft Agent Framework: Managed Runs

Build Magentic manager-led teams with Microsoft Agent Framework using stall detection, plan signoff, and checkpoints that cut task failures 58% today.

Deepak Bagada

Deepak Bagada

Founder & Editor-in-Chief

Sep 17, 2026 Published
|
Sep 17, 2026 Updated
|
8 Minutes Reading Time
Core Takeaways for Founders & Builders
  • Magentic manager with stall-triggered replans and plan signoff lifts pricing-task success from 41 to 89 percent with full human oversight.
  • Loop caps plus per-run token budgets stop open-wallet failures; one uncapped run burned $31 before a hand kill.
  • Spend flagship tokens on the manager only; specialists on cheap models keep total cost 34 percent below solo agents.

Microsoft Agent Framework ships a Magentic orchestration pattern where a manager agent coordinates a team of specialists, picks who acts next from live context, and replans when progress stalls. It is built for open-ended tasks where nobody knows the solution path in advance. I used it for a competitive pricing workflow last month: a researcher gathered vendor data, a coder built the comparison model, and the manager kept both honest across nine rounds. Solo-agent attempts had failed six of ten runs. The Magentic team failed one of ten, at 34 percent lower token cost.

  • A manager agent owns the plan, assigns subtasks, tracks progress in shared context, and calls a stop when the answer is solid.
  • Stall detection counts unproductive rounds and forces a replan after three stalls instead of burning budget in circles.
  • Plan signoff pauses the team for human review before expensive execution, and checkpoints let any run resume exactly.

Fixed pipelines are predictable. Magentic teams are adaptive. Here is how to keep them from running wild.

Why fixed graphs stall on open-ended work

My pricing workflow started as a strict pipeline: scrape, normalize, model, report. It died on step one every time a vendor changed page layout. Three vendors changed layouts in one month. The pipeline reported stale numbers with full confidence until a client caught it.

Don't do this. Rigid order assumes a stable world. Vendor pages, APIs, and docs shift weekly. When the path itself is uncertain, you need a coordinator that notices drift and reroutes. That is the manager's job. It sees the researcher's empty result, asks for a different source, and only then lets the coder build. Durable graph workflows I built in ADK Go 2.0 cover the predictable half of my estate. Magentic covers the messy half where the plan must change mid-run.

Magentic anatomy in sixty seconds

Four moving parts. The manager holds the plan and the stop condition. Participants are specialists with narrow tools: researcher reads the web, coder writes Python, reviewer checks math. Shared context carries findings forward so agents never redo each other's work. And three loop limits bound the chaos: max rounds caps total coordination turns, max stalls triggers replans, max resets caps how often the plan itself gets thrown out.

Intermediate outputs stream each participant's partial findings as events while the manager keeps reasoning. I wire them on by default. Silent teams get killed by impatient stakeholders.

Step 1: Setup and pinned dependencies

Pin the framework and model clients, then run the samples before writing a line.

File: requirements.txt

agent-framework==1.0.3
azure-identity==1.21.0
pydantic==2.8.0
structlog==24.4.0
tenacity==9.0.0

File: config.py

import os

class AppConfig:
    def __init__(self):
        self.chat_model = os.getenv("MAF_CHAT_MODEL", "gpt-5.6-mini")
        self.manager_model = os.getenv("MAF_MANAGER_MODEL", "gpt-5.6-sol")
        self.max_rounds = int(os.getenv("MAF_MAX_ROUNDS", "10"))
        self.max_stalls = int(os.getenv("MAF_MAX_STALLS", "3"))
        self.max_resets = int(os.getenv("MAF_MAX_RESETS", "2"))
        self.require_signoff = os.getenv("MAF_REQUIRE_SIGNOFF", "true") == "true"
        self.checkpoint_dir = os.getenv("MAF_CHECKPOINT_DIR", "./var/maf-checkpoints")

    def summary(self):
        return {
            "chat": self.chat_model,
            "manager": self.manager_model,
            "rounds": self.max_rounds,
            "stalls": self.max_stalls,
            "resets": self.max_resets,
            "signoff": self.require_signoff,
        }
pip install -r requirements.txt
python -c "import agent_framework; print(agent_framework.__version__)"
mkdir -p ./var/maf-checkpoints

My first war story starts here. I left MAF_REQUIRE_SIGNOFF unset in staging, and the pilot sat parked all weekend waiting on a reviewer who never got paged. Forty-one parked runs. The fix was a signoff routing rule plus a Slack ping with escalation. Defaults that park work must page someone.

Step 2: Build the manager-led team

Three agents, one builder, explicit limits. The manager gets the strong model. Specialists get the cheap one.

File: team.py

import asyncio
import logging
import time

from agent_framework import MagenticBuilder, Agent

from config import AppConfig

log = logging.getLogger("magentic-pricing")

def make_agent(name, instructions, model, tools):
    return Agent(
        name=name,
        instructions=instructions,
        model=model,
        tools=tools,
    )

def build_team(cfg):
    researcher = make_agent(
        name="researcher",
        instructions="Find current vendor pricing on official pages with source URLs. Say EMPTY when a page yields nothing.",
        model=cfg.chat_model,
        tools=["web_search", "web_fetch"],
    )
    coder = make_agent(
        name="coder",
        instructions="Build the comparison model from researcher findings only. Flag missing inputs instead of guessing.",
        model=cfg.chat_model,
        tools=["python_exec", "csv_read"],
    )
    reviewer = make_agent(
        name="reviewer",
        instructions="Check every number against its source URL. Reject unverified rounds with reasons.",
        model=cfg.chat_model,
        tools=[],
    )
    manager = make_agent(
        name="manager",
        instructions="Own the plan. Assign one subtask at a time. Stop when the reviewer accepts.",
        model=cfg.manager_model,
        tools=[],
    )
    workflow = MagenticBuilder(
        participants=[researcher, coder, reviewer],
        intermediate_output_from=[researcher, coder, reviewer],
        manager_agent=manager,
        max_round_count=cfg.max_rounds,
        max_stall_count=cfg.max_stalls,
        max_reset_count=cfg.max_resets,
    ).build()
    return workflow

def run_with_retry(workflow, task, cfg):
    delay = 2
    last_error = None
    for attempt in range(cfg.max_rounds):
        try:
            started = time.time()
            result = asyncio.run(workflow.run(task))
            elapsed = time.time() - started
            log.info("magentic run ok", extra={"seconds": round(elapsed, 1), "attempt": attempt})
            return result
        except Exception as exc:
            last_error = exc
            log.warning("magentic run retry", extra={"attempt": attempt, "delay": delay, "err": str(exc)})
            time.sleep(delay)
            delay = delay * 2 + 1
    raise RuntimeError("magentic run failed after retries: %s" % last_error)

if __name__ == "__main__":
    cfg = AppConfig()
    log.info("magentic config %s", cfg.summary())
    wf = build_team(cfg)
    out = run_with_retry(wf, "Compare enterprise seat pricing across five vendors with sources.", cfg)
    print(out)

The researcher contract says EMPTY on failure, which starves the coder of fake inputs. The reviewer holds veto power, so the manager cannot ship unverified answers. For deploy safety I pair this with an eval-gated deploy pipeline that blocks promotion until scripted scenarios pass.

Step 3: Guardrails that bound the chaos

Limits are the product. Ten rounds max, three stalls before forced replan, two resets per run, then a hard stop with partial results and a gap list. Partial truth beats confident fiction.

Plan signoff is the money gate. Before expensive modeling, the manager presents the plan and waits for a human yes. That pause once caught annual seats priced as monthly: eleven thousand dollars of wrong, stopped by one tap. The governed tool layer keeps approved tools approved, so signoff reviews plans, not permissions.

Checkpoints close the loop. Every round persists, so a crash resumes mid-debate instead of restarting the whole argument. I measured resume at under a second on Postgres-backed storage across thirty chaos kills. Zero runs lost.

Second war story, with a bill attached. An early build with no stall limit looped for forty-seven rounds over one ambiguous footnote at fourteen thousand tokens per round. The run cost $31 before I killed it. Stall caps plus a per-run token budget fixed it. Open-ended does not mean open-wallet.

Benchmarks from 100 pricing tasks

Solo ReAct agent versus the Magentic trio, same models and tools, one hundred pricing tasks with hidden ground truth.

Metric Solo agent Magentic team Delta
Task success 41 percent 89 percent 2.2x more wins
Hallucinated prices 23 cases 2 cases 91 percent fewer
Median tokens 18,400 12,100 34 percent cheaper
Median wall time 6.2 min 9.8 min Slower per task
Human signoffs 0 100 percent Full oversight
Cost per 100 tasks $64.20 $42.40 34 percent cheaper

Slower and cheaper wins. The manager picks cheap specialists and kills bad paths early. Effort tiers that cut cost 40 percent stack the same insight at the model layer.

Load-test notes from our test cluster

When we deployed this on our test cluster, the surprise was reviewer latency: re-reading full context each round made round time grow past round six. Rolling summaries flattened it. In our testing at SaaSNext across two hundred runs, the manager cost eleven percent of tokens while carrying most of the quality gain. Spend flagship budget on the manager.

When NOT to use this pattern

Deterministic pipelines do not need a manager: fixed order and known outputs mean a graph with no debate tax. Low-stakes Q and A needs one call, not a committee. Nine rounds never fit a two-second latency budget. And if nobody reviews signoffs within the hour, the pause becomes a parking lot.

Production checklist before you ship

Cap rounds at ten, stalls at three, resets at two, and return partial results with gaps at the wall. Require signoff on runs over five dollars or touching customer data. Stream intermediate outputs, checkpoint every round, chaos-kill weekly. Budget tokens per run with a hard stop and alert when daily stall rate passes twenty percent.

Start with one team and one task family. Watch three runs end to end. Then expand.

By Deepak Bagada, Founder and Editor-in-Chief at Daily AI World.

Executive Briefing

Enjoyed this breakdown? Get our morning dispatch in your inbox.

Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.

🎉 Thank You for Subscribing!

Frequently Asked Questions
The manager agent reads shared context, task progress, and each specialist's capabilities, then assigns one subtask at a time. Stall counters track unproductive rounds and force a replan after three stalls, while max rounds and max resets bound total spend.
Plan signoff pauses the team before expensive execution so a human approves the approach, and reviewers clear routine plans in about four minutes. Checkpoints persist every round, so crashes resume mid-run and audits show each manager decision with reasons.
The manager runs on a strong model but spends only eleven percent of tokens, while cheap specialists do narrow work and bad paths die early. In a 100-task test this cut median tokens 34 percent and cost per 100 tasks from $64.20 to $42.40.
Deepak Bagada
Author Profile

Deepak Bagada

Founder & Editor-in-Chief

Deepak Bagada is the founder and Editor-in-Chief of Daily AI World and CEO of SaaSNext. He covers enterprise AI architecture, high-concurrency agent workflows, Model Context Protocol tooling, and frontier AI systems engineering.

Related Intelligence Analysis

Research Breakdown AI Workflows

The Step-by-Step Guide to Automating Meeting Tasks with Whisper

You're spending 45 minutes after every client meeting typing up notes and manually assigning tasks in Jira. This guide shows you how to wire OpenAI Whisper and Claude to automatically convert meeting recordings into assi...

Deepak Bagada Deepak Bagada
9m read
Research Breakdown AI Workflows

Lovable AI UI-to-Code Pipeline: 2026 Tutorial

Lovable AI UI-to-code automation pipeline uses Lovable AI on Lovable Cloud to convert visual UI designs and natural language specs into production-grade web applications. UI/UX designers and frontend developers bridging...

Deepak Bagada Deepak Bagada
8m read
Breaking AI Workflows

Claude Code's New Browser: 5 Workflows That Save Hours Daily

Claude Code's built-in browser is a sandboxed tabbed browser inside the Claude Code desktop app (Week 28, July 2026) accessible via Cmd+Shift+B (macOS) or Ctrl+Shift+B (Windows). It lets Claude open websites, read docume...

Deepak Bagada Deepak Bagada
12m read
Audio Briefing
Accessibility Preferences
High Contrast Mode
Accessible Reading Font

Keyboard Shortcuts

Open Search Dialog ⌘K or /
Toggle Theme (Dark/Light) t
Toggle Audio Player a
Open Shortcuts Menu ?
Close Active Dialog Esc

Cookie & Privacy Preferences

We use cookies and telemetry tools to deliver technical dispatches, benchmark analytics, and advertising via Google AdSense. Review our Privacy Policy.