World’s largest virtual agentic engineering & quality conference

WHENAUG 19-21
WHEREVirtual · Global
WATCH NOW
AI TestingAgent Testing

AutoGen Testing: How to Test Agents and Teams

How to test AutoGen agents and multi-agent teams deterministically, what the framework's maintenance status means for your suite, and how to build assertions that survive a migration to Microsoft Agent Framework.

Author

Anubhav Singhmaar

Author

Author

Samyak Goyal

Reviewer

Last Updated on: August 19, 2026

If you run AutoGen in production, you are maintaining a system whose framework stopped shipping features. The AutoGen repository opens with a maintenance mode notice: "AutoGen is now in maintenance mode. It will not receive new features or enhancements and is community managed going forward." That repository carries more than 60,000 stars.

Its releases page shows the last tagged Python release, python-v0.7.5, published on 2025-09-30.

That does not make the code stop working, and it does not make testing it optional. It changes what a good test suite is for. This guide covers how to test AutoGen agents deterministically using the mock client the framework already ships, and how to write those assertions so they still hold after you migrate. Every example was run against autogen-agentchat 0.7.5 on Python 3.13, and the output is real.

TL;DR

  • The core approach: Test AutoGen agents with ReplayChatCompletionClient, a mock model client that returns canned responses in place of real model calls and makes a full multi-agent team deterministic. Assert on speaker order, stop reasons, and tool calls rather than generated text.
  • Treat AutoGen as a frozen dependency: The AutoGen README states the project receives no new features and is community managed. The last tagged Python release is python-v0.7.5, published 2025-09-30, so pin your version.
  • Use ReplayChatCompletionClient for every unit test: Imported from autogen_ext.models.replay, it takes an ordered list of strings and returns one per agent turn. AutoGen uses it in its own suite, and it needs no API key.
  • A full team test runs in under a second: A two-agent RoundRobinGroupChat driven by the replay client completed in 0.74 seconds with zero model calls, which is fast enough to run on every push.
  • Assert on speaker order, not prose: The TaskResult from run() exposes messages, each carrying a source naming the agent that produced it, so a test can pin the exact turn sequence a team took.
  • Check stop_reason to prove clean termination: A team using TextMentionTermination("APPROVE") that halts correctly returns the stable string "Text 'APPROVE' mentioned", which asserts far more reliably than message text.
  • Always pair a semantic condition with a hard ceiling: MaxMessageTermination and TextMentionTermination compose with the pipe operator into an OrTerminationCondition, bounding a run whose agents never say the trigger word.
  • Write tests as a portable behavior contract: Microsoft names Microsoft Agent Framework as the successor. Assertions on speaker order, tool calls, and stop reasons survive the port, while framework setup code does not.

Where AutoGen Stands in 2026

The comparison with its successor describes the situation better than any commentary. The Microsoft Agent Framework repository carries roughly 13,000 stars, a fraction of AutoGen's count. Checked on 19 August 2026, its latest commit landed that same day, against April 2026 for AutoGen. A large installed base is running on a codebase that has effectively stopped moving.

SignalAutoGenWhat it means for your suite
Project statusMaintenance mode, community managed, per the READMEPin the version. No feature will arrive to fix a gap you find.
Last tagged Python releasepython-v0.7.5, 2025-09-30The API you test against is stable, which makes assertions unusually durable.
SuccessorMicrosoft Agent Framework, named in the READMEWrite tests as a portable behavior contract, not against internal APIs.
StarsOver 60,000, versus roughly 13,000 on the successorMost real-world AutoGen code is legacy code that needs a safety net.

A frozen API is genuinely useful for testing. Nothing upstream will break your assertions, so the suite you write now is the suite you keep until you migrate. Treat it as the specification of what your agents currently do, because that is exactly what a migration needs.

What Actually Breaks in AutoGen Teams

AutoGen's AgentChat layer arranges agents into teams that pass a shared message history between turns. That structure produces failure modes distinct from a single-agent app:

  • Non-termination - The critic never says the magic word, and a team with only a text-mention condition runs until something else stops it. This is the single most expensive AutoGen bug, because the cost is measured in tokens.
  • Turn-order drift - A refactor reorders the participant list and the reviewer now speaks before the writer. Output still arrives and still looks reasonable.
  • Context bloat - Every agent shares the same history, so a long run pushes early instructions out of the window and later turns quietly lose the original constraints.
  • Tool substitution - An agent with several tools picks a different one this run and reaches a plausible answer through the wrong path.

Each of these is a control-flow bug, not a prose bug, which is good news: control flow is exactly what you can assert on deterministically. The broader framing of that problem is covered in our guide to multi agent testing.

The Four AutoGen Testing Surfaces

SurfaceWhat you assert onNeeds an API key?Survives migration?
Replay client testsSpeaker order, stop reason, message types across a full team runNoAssertions yes, setup code no
Tool unit testsYour own Python functions, called directly with no agent involvedNoYes, unchanged
Termination testsThat a runaway loop is bounded and the right condition firedNoConcept yes, class names no
Live endpoint evaluationAccuracy, bias, tone, multi-turn coherence with real model callsYesYes, it never touched the framework

Read the last column as the migration plan. The two surfaces that carry over untouched are the ones worth investing in most heavily, and the one that gets rewritten is the thinnest layer of setup code.

Deterministic Team Tests With ReplayChatCompletionClient

AutoGen ships the mock you need. ReplayChatCompletionClient, from autogen_ext.models.replay, takes an ordered list of strings and hands them out one per model call. AutoGen uses it across its own test suite, so it is a supported testing tool rather than a workaround.

This test drives a complete two-agent team through a full run and asserts on who spoke, in what order, and why it stopped:

import pytest
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.replay import ReplayChatCompletionClient


@pytest.mark.asyncio
async def test_team_stops_on_approval_and_records_speaker_order():
    """The critic approves on its first turn, so the team must stop after two messages."""
    model_client = ReplayChatCompletionClient(
        ["A haiku about testing.", "APPROVE"]
    )
    writer = AssistantAgent("writer", model_client=model_client)
    critic = AssistantAgent("critic", model_client=model_client)

    team = RoundRobinGroupChat(
        [writer, critic],
        termination_condition=TextMentionTermination("APPROVE"),
    )

    result = await team.run(task="Write a haiku about testing.")

    speakers = [m.source for m in result.messages]
    assert speakers == ["user", "writer", "critic"]
    assert result.messages[-1].to_text() == "APPROVE"
    assert result.stop_reason is not None

Running it against autogen-agentchat 0.7.5 gives the actual terminal output below. Note the timing:

$ python -m pytest test_autogen_team.py -v --asyncio-mode=auto
============================= test session starts =============================
platform win32 -- Python 3.13.5, pytest-9.1.1, pluggy-1.6.0
plugins: anyio-4.14.2, asyncio-1.4.0
collected 1 item

test_autogen_team.py::test_team_stops_on_approval_and_records_speaker_order PASSED [100%]

============================== 1 passed in 0.74s ==============================

A complete multi-agent team run in 0.74 seconds, with no API key and no token spend. That is fast enough to run on every push, which is the whole argument for testing this way. Three details make it work:

  • One client, shared by both agents - The replay list is consumed globally in call order, not per agent, so the list is really a script of the whole conversation.
  • The user task counts as a message - The first entry in result.messages has source "user", so speaker assertions must include it.
  • Tests must be async - team.run() is a coroutine, so the suite needs pytest-asyncio, and running with --asyncio-mode=auto saves decorating every test.
Next-generation test execution with TestMu AI

Testing Termination Conditions

Non-termination is the AutoGen failure that costs money rather than correctness, so it deserves its own tests. The AutoGen teams documentation covers the available conditions, including TextMentionTermination, which stops when a word appears, and ExternalTermination, which lets you halt a team from outside the run.

Assert on stop_reason, not on message count. It is a plain string describing why the run halted, and it distinguishes a clean finish from a safety net catching a runaway. On the run above it comes back as:

>>> result.stop_reason
"Text 'APPROVE' mentioned"

Conditions compose with the pipe operator, which produces an OrTerminationCondition. Always pair a semantic condition with a hard ceiling, then write a test proving the ceiling fires:

from autogen_agentchat.conditions import MaxMessageTermination, TextMentionTermination

# The team stops on approval, OR after 5 messages, whichever comes first.
termination = MaxMessageTermination(5) | TextMentionTermination("APPROVE")


@pytest.mark.asyncio
async def test_team_is_bounded_when_critic_never_approves():
    """Feed replies that never contain APPROVE; the message cap must stop the run."""
    model_client = ReplayChatCompletionClient(["Needs work."] * 10)
    writer = AssistantAgent("writer", model_client=model_client)
    critic = AssistantAgent("critic", model_client=model_client)

    team = RoundRobinGroupChat([writer, critic], termination_condition=termination)
    result = await team.run(task="Write a haiku about testing.")

    assert len(result.messages) <= 5
    assert "APPROVE" not in result.stop_reason

A team without a message ceiling is one bad prompt away from an unbounded bill. The replay client makes the never-approves scenario trivial to reproduce, which is why this test is worth writing before the incident rather than after it.

Asserting on Tool Calls Instead of Text

The most durable assertion about an agent is which tool it reached for. Wording changes across model versions; a tool name and its arguments do not. AutoGen returns distinct message classes for tool requests and their results inside TaskResult.messages, so a test can inspect the sequence by type.

def tool_names(result):
    """Pull every tool the run invoked, in order, out of a TaskResult."""
    names = []
    for message in result.messages:
        for call in getattr(message, "content", []) or []:
            name = getattr(call, "name", None)
            if name:
                names.append(name)
    return names


@pytest.mark.asyncio
async def test_agent_uses_live_search_not_cache():
    result = await team.run(task="What changed in the pricing page this week?")
    assert "live_search" in tool_names(result)
    assert "cached_lookup" not in tool_names(result)

Keep the tool implementations themselves out of the agent entirely. An AutoGen tool is a plain Python callable, so the HTTP call, the parsing, and the error handling all belong in an ordinary function that pytest calls directly. The agent-facing wrapper is then thin enough that it barely needs testing. That same split is the backbone of the approach in our CrewAI testing guide, and it is worth applying to whichever framework you land on.

Writing Tests That Survive the Migration

Microsoft names Microsoft Agent Framework as AutoGen's successor and publishes a migration guide, so most AutoGen systems will be ported eventually. The largest structural change is the move from event-driven messaging to graph-based workflows, which rewrites how agents are wired together while leaving what they should accomplish untouched.

That distinction tells you what to assert on. Write the suite as a behavior contract and it becomes the migration's acceptance criteria rather than a casualty of it:

  • Freeze a task set - Pick 15 to 30 representative inputs your system handles today and commit them next to the tests.
  • Record observable behavior, not text - For each task, capture the speaker sequence, the tool-call sequence, and the stop reason. These are the three things a user-visible regression would change.
  • Put the assertions behind a helper - Have the tests call one function that runs a task and returns those three values. After the port, you reimplement that single helper instead of every test.
  • Port the helper, run the old assertions - Any assertion that now fails is either a genuine regression or a deliberate behavior change you should be able to name. Both are worth surfacing.

Teams that skip this step end up comparing generated prose before and after the port, which proves nothing, because the prose was never stable. If you are still deciding which framework to land on, the trade-offs are laid out in our guide to agentic AI frameworks.

Shift from a legacy test platform to TestMu AI

Testing the Agent Real Users Actually Meet

Replay tests have a hard ceiling, and it is worth naming plainly: you wrote every response the agent gave. They prove the team routes, terminates, and calls tools correctly. They cannot tell you the agent invented a refund policy, treated two users differently, or forgot a constraint by turn six.

That layer needs real model calls and synthetic users. TestMu AI's Agent Testing platform connects to a live chat, voice, or phone endpoint and runs 15+ specialized evaluators against it in parallel, each probing one failure mode: a Hallucination Hunter for invented facts, a Bias Detector for differential treatment, a Context Specialist for whether the agent still remembers turn two, plus completeness, tone, escalation, and prompt-injection checks. Upload the spec your agents were built from and it generates 60 to 100+ scenarios across happy paths, edge cases, adversarial inputs, and compliance checks.

For a migrating AutoGen system this layer earns its keep twice. Run it before the port to establish a quality baseline, then again after, and you get a like-for-like comparison the code-level tests cannot give you. The run resolves to a single Green, Yellow, or Red readiness verdict, so the go or no-go call does not require reading every transcript. Connect an endpoint using the chat agent API integration docs.

Note

Note: Migrating off AutoGen changes the plumbing, not the promise your agent makes to users. TestMu AI runs 15+ autonomous evaluators against your live endpoint before and after the port, so you can prove quality did not regress. Try TestMu AI free!

Common AutoGen Testing Mistakes

  • Calling a real model in unit tests - It makes the suite slow, costly, and flaky at once. The replay client removes all three problems and ships with the framework.
  • Counting replay entries per agent - The list is consumed in global call order, not per agent. Short-changing it by one entry produces a confusing mid-run failure.
  • Shipping a team with no message ceiling - A semantic condition alone cannot bound a run whose agents never say the word. Always compose it with MaxMessageTermination.
  • Snapshot-testing generated text - It passes once, then fails on every model or prompt change without indicating a real defect, and teams learn to ignore it.
  • Forgetting the user message in speaker assertions - The task itself occupies the first slot in result.messages, which quietly offsets every index-based assertion.
  • Leaving the version unpinned - AutoGen is community managed now, so an unpinned dependency invites a change nobody at Microsoft is reviewing. Pin it and upgrade deliberately.

For the fast gate that runs ahead of a full suite on every prompt edit, see agent smoke testing.

Conclusion

Write one replay test for your busiest team today. Script the conversation, assert the speaker order and the stop reason, and pin the AutoGen version in the same commit. It runs in under a second, needs no API key, and gives you the first regression signal your agents have ever had, which matters more than usual on a framework that will not be fixed upstream.

Then decide your migration timeline with that suite in hand rather than without it. Before you port, run TestMu AI's Agent Testing against the live endpoint to capture a quality baseline, and run it again afterwards to prove nothing regressed where users can see it. The Agent Testing platform getting started guide covers connecting an endpoint and reading your first readiness verdict.

Author

...

Anubhav Singhmaar

Blogs: 11

  • Linkedin

Anubhav Singhmaar is an AI Product Manager at TestMu AI driving Kane CLI, the command-line tool that brings browser automation to the terminal, turning natural-language flows into runs in a real Chrome browser that return pass or fail with shareable proof. He owns the roadmap and prioritization and works with engineering to ship developer-facing features. Before TestMu AI, he spent over four years at Sprinklr owning enterprise voice AI across APAC and EMEA. A mechanical engineer turned product manager, he grounds guidance in real QA workflows.

Reviewer

...

Samyak Goyal

Reviewer

  • Linkedin

Samyak Goyal is a Senior Member of Technical Staff at TestMu AI engineering Kane CLI, the command-line tool that runs browser automation from the terminal, where a flow described in natural language executes in a real Chrome browser and returns pass or fail with shareable proof. He is a backend engineer with 4+ years of experience, previously an SDE at Innovaccer, where he built APIs, introduced Kafka, and cut deployment from weeks to hours. Samyak also builds multi-agent systems, skill-orchestration frameworks, and a personal copilot that indexes 200+ microservice repositories.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...
TestMu Conf 2026

World's largest virtual agentic engineering & quality conference

...

AUG 19-21, 2026

WATCH NOW

AutoGen Testing FAQs

Did you find this page helpful?

More Related Blogs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests