AI

Single-Agent vs Multi-Agent Systems

Compare one assistant with a planner, researcher and reviewer. Run an offline Python example and evaluate contracts, failures, latency and token costs.

A single agent is often enough for a research task. Splitting the work between a planner, researchers and a reviewer adds coordination that must earn its cost. This guide is for developers who know basic programming and want to decide whether that split helps their application.

Quick answer

Start with one agent that can use the tools needed to finish the task. Consider multiple agents when independent subtasks benefit from separate working contexts or when specialists need different tools and permissions. Compare both designs on representative tasks: more agents do not automatically mean better answers.

What changes when you add agents?

A single agent owns the task: it decides what to do next, calls tools, examines the results and decides when to stop. It can make many model requests and tool calls. Single-agent does not mean single-call. If this loop is new to you, read what an AI agent is first.

A multi-agent system coordinates multiple model-driven actors. They may use the same underlying model but have separate instructions, working contexts or tool access. A manager can call specialists as tools and keep control, or a handoff can transfer control to another agent. The OpenAI Agents SDK orchestration guide distinguishes these patterns and also describes orchestration controlled by ordinary code.

A fixed planner → researcher → reviewer chain is a workflow. Giving Python functions those names does not make them agents. The example below uses deterministic functions to test the coordination rules before introducing models; it is not a working language-model integration.

The distinction matters when debugging. With one agent, you follow one decision loop. With several, you also need to ask which role saw which evidence, who owns the result and whether a failed subtask can leave a misleading partial answer.

One question, two designs

Suppose an internal assistant must compare upload limits from two approved source cards: Atlas v2 and Beacon v1. Each finding must retain its product ID, source ID, source revision and limit in decimal megabytes (MB). These are fictional products and numbers, chosen so the expected findings are easy to check.

The single-assistant path reads both cards and returns findings. The coordinated path plans a source list, researches each unique source and asks a reviewer to accept or reject the findings. Both paths return a structured draft for human review, not a finished report.

Two sequential research designs: a single assistant reads both approved cards, while a planner, researcher and reviewer pass findings through host-controlled validation and stopping rules.

An offline comparison of responsibilities. Research in this example runs sequentially; the picture does not claim a speed or quality advantage.

Define contracts before prompts

A contract describes the input a role receives, the output it may return and what the host checks. Here, the host is the Python coordinator. It owns the task ID, accepted findings, read cache and role budget.

Stage Receives and returns Host boundary
Single assistant Task and approved reader → two findings Check exact fields, source data and complete coverage
Planner Task → list of source IDs Require both approved sources, at most four entries; skip duplicates
Researcher One source ID and approved reader → one finding Require the requested product and its exact fixture data
Reviewer Copy of accepted findings → Boolean Accept only True or False; rejection stops delivery
Coordinator Role results → draft or handoff state Own state, deduplicate reads and stop before exceeding the callback budget

The reviewer cannot rewrite the host’s accepted findings through its snapshot. Research has access only to the approved reader. In a real service, enforce permissions in tools and infrastructure as well: a Python callback is not a security sandbox.

Run an offline comparison

Save the following as coordination_demo.py. It uses only the Python standard library. The exact listing was executed with Python 3.8.20; no API key, package install or model download is needed.

The source revision is distinct from the product version: the Beacon v1 card below is revision 4 of its guide. Both limits use the same unit, so no conversion is involved.

import copy
import json

TASK = {"id": "compare-17", "sources": ["atlas-v2", "beacon-v1"]}
# Fictional source cards, with decimal MB for both limits.
CATALOG = {
    "atlas-v2": {"source": "atlas-guide", "revision": 2, "limit_mb": 25},
    "beacon-v1": {"source": "beacon-guide", "revision": 4, "limit_mb": 10},
}


class Stop(Exception):
    pass


def assistant(task, read):
    return [read(source) for source in task["sources"]]


def planner(task):
    return task["sources"]


def researcher(source, read):
    return read(source)


def reviewer(findings):
    return len(findings) == 2


def run(mode, plan=planner, research=researcher, review=reviewer,
        assist=assistant, max_roles=4):
    if mode not in ("single", "multi"):
        raise ValueError("invalid_mode")
    if type(max_roles) is not int or not 1 <= max_roles <= 8:
        raise ValueError("invalid_role_budget")
    state = {"task_id": TASK["id"], "findings": {}, "role_calls": 0,
             "document_reads": 0, "events": []}
    cache = {}

    def invoke(role, function, *args):
        if state["role_calls"] >= max_roles:
            raise Stop("role_budget")
        state["role_calls"] += 1
        state["events"].append(role)
        try:
            return function(*args)
        except Exception:
            raise Stop(role + "_error") from None

    def read(source):
        if source not in TASK["sources"]:
            raise ValueError("unapproved_source")
        if source not in cache:
            state["document_reads"] += 1
            cache[source] = {"product": source, **copy.deepcopy(CATALOG[source])}
        return copy.deepcopy(cache[source])

    def retain(row, expected=None):
        if not isinstance(row, dict) or set(row) != {"product", "source", "revision", "limit_mb"}:
            raise Stop("invalid_finding")
        product = row["product"]
        if not isinstance(product, str) or product not in TASK["sources"]:
            raise Stop("invalid_finding")
        if expected is not None and product != expected:
            raise Stop("invalid_finding")
        if product in state["findings"]:
            raise Stop("duplicate_finding")
        if type(row["revision"]) is not int or type(row["limit_mb"]) is not int:
            raise Stop("invalid_finding")
        if row != {"product": product, **CATALOG[product]}:
            raise Stop("invalid_finding")
        state["findings"][product] = copy.deepcopy(row)

    try:
        if mode == "single":
            rows = invoke("assistant", assist, copy.deepcopy(TASK), read)
            if not isinstance(rows, list) or len(rows) != 2:
                raise Stop("incomplete_findings")
            for row in rows:
                retain(row)
        else:
            sources = invoke("planner", plan, copy.deepcopy(TASK))
            if (not isinstance(sources, list) or not 1 <= len(sources) <= 4
                    or any(not isinstance(s, str) or s not in TASK["sources"] for s in sources)
                    or set(sources) != set(TASK["sources"])):
                raise Stop("invalid_plan")
            seen = set()
            for source in sources:
                if source in seen:
                    state["events"].append("skip_duplicate:" + source)
                    continue
                seen.add(source)
                retain(invoke("researcher", research, source, read), expected=source)
            accepted = invoke("reviewer", review, copy.deepcopy(state["findings"]))
            if type(accepted) is not bool:
                raise Stop("invalid_review")
            if not accepted:
                raise Stop("review_rejected")
        if set(state["findings"]) != set(TASK["sources"]):
            raise Stop("incomplete_findings")
        state.update(status="draft", reason="complete")
    except Stop as error:
        state.update(status="handoff", reason=str(error))
    return state


def broken(*args):
    raise RuntimeError("Synthetic failure; do not expose exception details")


if __name__ == "__main__":
    cases = [
        ("single", "single", {}, "draft", "complete"),
        ("multi", "multi", {}, "draft", "complete"),
        ("duplicate plan", "multi", {
            "plan": lambda task: ["atlas-v2", "atlas-v2", "beacon-v1"]
        }, "draft", "complete"),
        ("bad plan", "multi", {"plan": lambda task: ["unknown"]}, "handoff", "invalid_plan"),
        ("research failure", "multi", {"research": broken}, "handoff", "researcher_error"),
        ("review rejection", "multi", {"review": lambda findings: False}, "handoff", "review_rejected"),
        ("role limit", "multi", {"max_roles": 3}, "handoff", "role_budget"),
    ]
    for label, mode, options, status, reason in cases:
        result = run(mode, **options)
        assert (result["status"], result["reason"]) == (status, reason)
        print(label + ": " + status + "/" + reason +
              " roles=" + str(result["role_calls"]) + " reads=" + str(result["document_reads"]))
        if label in ("single", "multi"):
            print("trace:", json.dumps(result["events"]))
    single, multi = run("single"), run("multi")
    assert single["findings"] == multi["findings"]
    print("same findings:", json.dumps(single["findings"], sort_keys=True))
    print("fixture checks: passed")

Run it with python coordination_demo.py. Expected output:

single: draft/complete roles=1 reads=2
trace: ["assistant"]
multi: draft/complete roles=4 reads=2
trace: ["planner", "researcher", "researcher", "reviewer"]
duplicate plan: draft/complete roles=4 reads=2
bad plan: handoff/invalid_plan roles=1 reads=0
research failure: handoff/researcher_error roles=2 reads=0
review rejection: handoff/review_rejected roles=4 reads=2
role limit: handoff/role_budget roles=3 reads=2
same findings: {"atlas-v2": {"limit_mb": 25, "product": "atlas-v2", "revision": 2, "source": "atlas-guide"}, "beacon-v1": {"limit_mb": 10, "product": "beacon-v1", "revision": 4, "source": "beacon-guide"}}
fixture checks: passed

What the trace proves

Both successful paths retain the same two source-backed findings. The single path invokes one role callback; the coordinated path invokes a planner, a researcher twice and a reviewer. Each path reads two documents. A duplicate planned source adds a trace event but no extra researcher invocation or document read.

These are logical callback counts, not model-request counts, token usage or cost estimates. A real single-agent callback could make several model requests. A specialist could also make several requests or retries. Nothing in this simulation measures latency or answer quality.

The host checks findings against a trusted, known catalog. That catalog is a test oracle: it defines the correct answer for this fixture. Real research needs source evaluation, freshness checks and an evaluation set; matching an unknown claim to itself cannot establish truth. The reviewer here checks only the number of findings. It is a control-flow fixture, not independent factual review.

What happens on failure?

An invalid plan stops before research. A researcher exception stops before review. A rejected review preserves the findings for inspection but marks the result handoff, so a caller must not deliver them as a completed draft. The caller must implement the human queue or other recovery route; returning that status does not create a staffed review process.

There are no automatic retries. With a three-callback budget, planning and both research calls finish, but review cannot start. The host returns handoff/role_budget rather than silently skipping approval. If the second research call fails, the first finding can remain in state; partial state is diagnostic evidence, not successful completion.

This budget limits how many callbacks start. It cannot interrupt a callback that hangs, enforce a total deadline or cap model tokens. Production adapters need provider timeouts, cancellation, usage limits, durable state and explicit retry rules. Copying inputs reduces accidental mutation; it does not isolate untrusted code. Never execute model-generated Python in this host process.

When does coordination help?

Use the workload to choose the design, then measure the result. These are candidate scenarios, not guaranteed outcomes.

Workload Starting design Reason and tradeoff
Look up two approved limits Single agent, or a deterministic lookup Little independent reasoning; extra roles add handoffs
Follow a known extraction and validation sequence Code-controlled workflow Explicit steps are easier to inspect; less flexible for unexpected tasks
Research several independent subject areas Manager with bounded specialists Separate contexts can reduce interference; merging evidence and duplicate work need control
Perform actions with different permission levels Separate scoped tools, possibly specialist agents Narrow access can help; separate prompts alone do not enforce authorization
Edit tightly coupled application code Start with one agent Changes share assumptions; parallel actors can conflict and need integration checks

A model call without an agent loop, retrieval plus a response template, or an ordinary workflow may solve the problem with less operational work. Anthropic’s agent architecture guide is useful background on choosing that level of complexity; its older examples are architectural guidance, not current installation instructions.

Latency, tokens and duplicated work

Latency is the time from accepting a request to returning its result. In a sequential chain, each stage waits for the previous stage. Independent researchers can sometimes run concurrently, but planning, merging and review still take time. Parallel execution also needs bounded concurrency, cancellation and rules for incomplete branches; this example implements none of those.

Models process tokens, units of text or other encoded input and output. Multiple actors can repeat instructions, source excerpts and intermediate summaries. Track provider-reported input and output usage across every request, including retries, then calculate cost using the actual models and pricing. Callback counts cannot substitute for that accounting.

The cache here deduplicates document reads. It does not show how to avoid two agents reasoning over the same evidence, copying the same error or producing overlapping summaries. Assign explicit source coverage and merge by stable evidence IDs. A reviewer can reject an answer but can also miss a shared false assumption; several agreeing agents are not proof of correctness.

Anthropic’s research-system report describes a real parallel research system and its evaluation and coordination challenges. Its results concern that system and workload. They do not establish a portable performance or cost ratio for your application.

Evaluate before adding more roles

Keep the question, approved documents, available tools and scoring criteria comparable. First compare both designs under the same declared resource budget. Also measure their intended production configurations, recording differences in models, limits and concurrency so the tradeoff is visible.

For this upload-limit task, score correct values, units, source revisions, complete coverage and appropriate handoff on missing evidence. For a broader research task, use a reviewed evaluation set and a rubric for factual support, coverage and contradictions. Repeat real model runs: one attractive answer is weak evidence.

Record answer quality separately from elapsed time, provider usage, monetary cost, duplicate work and human-review rate. Keep role inputs, source IDs, validation results and stopping reasons in a trace, with sensitive data removed. An improvement in coverage may be worth a higher cost; an extra reviewer may simply add delay. Judge both designs against an explicit acceptance target.

Before connecting models to this fixture, replace each stub with a documented adapter that validates structured output and enforces the role’s tools. Keep state validation and stop decisions in the host. Add fault cases for malformed outputs, stale sources, timeouts and contradictory evidence. Do not remove these checks just because the normal path works.

Choose the smallest design that meets the goal

For two known source cards, start with the single-assistant path or a direct lookup. Try specialists when independent work or distinct working contexts solve a measured problem. Keep the contracts, state ownership and stopping rules explicit, and retain the simpler baseline so you can tell whether coordination earns its cost.

Topics: AI agents, multi-agent systems, orchestration, evaluation, Python

References