Autonomous AI Agents
0/15 complete

Module 03 · Swarm Orchestration

Single-Agent vs. Multi-Agent: When Complexity Pays Off

Multiple agents add coordination, duplicated context, more tool calls, more failure modes, and harder evaluation. They pay off only when work has genuinely separable roles, parallel branches, permission boundaries, or context that one loop cannot manage reliably.

After this lesson, you can compare one-agent, deterministic-pipeline, and multi-agent designs using measured evidence.

// concept

Test the Simplest Baseline

Start with one loop and bounded tools. Then test a deterministic pipeline. Consider multiple agents only if the baseline fails for a documented reason:

  • independent subtasks can run concurrently;
  • specialist contexts or tools should remain isolated;
  • an adversarial reviewer materially improves acceptance quality;
  • work requires different permission identities;
  • task duration benefits from durable worker queues.

Do not create characters to simulate expertise. A role needs a contract, input, output schema, permission set, and evaluation.

// concept

Calculate Coordination Cost

For each design measure:

// prompt — copy me8 lines
task success rate
unsafe/invalid action rate
median and p90 latency
model/tool calls
estimated run cost
duplicate or conflicting outputs
human review minutes
recovery success after failure

The fastest design is not acceptable if it introduces unreviewed actions. The most accurate demo is not viable if cost and recovery are uncontrolled.

// concept

Choose a Pattern

  • Single agent: iterative research or repair with one coherent state.
  • Pipeline: fixed stages such as extract → validate → approve.
  • Parallel workers: independent items share a stable schema.
  • Manager-worker: manager decomposes and reconciles bounded worker results.
  • Reviewer: separate critic checks a draft against a fixed rubric.

// worked_example

Worked Example

A Pakistani ecommerce business translates and checks 100 product descriptions. One agent processing all products exceeds context and is hard to resume. A worker-per-product design can parallelize, but price and inventory remain deterministic source fields.

Workers return {sku, english, roman_urdu, unsupported_claims, source_version}. A deterministic validator checks required fields; a reviewer samples risky claims. The manager does not rewrite all results freely. A comparison shows whether parallel execution improves throughput after accounting for conflicts, cost, and review time.

// failure_cases

Failure Cases to Diagnose

7 cases to diagnose

  • Every role is another model conversation

    merge roles without distinct tools or context.

  • Workers edit the same file or record

    partition resources or serialize commits.

  • Manager trusts worker prose

    require typed results and validators.

  • Same model judges itself with no rubric

    use evidence-based acceptance and human sampling.

  • Parallel calls exceed provider limits

    apply concurrency and rate controls.

  • No baseline

    complexity cannot be justified.

  • “Swarm” used as a scale claim

    measure actual throughput and errors.

// pakistan_angle

Pakistan Angle

Parallel model calls can create foreign-currency cost spikes. Model low, expected, and stress PKR cost using current provider prices and exchange assumptions, then enforce per-run and daily budgets. A slower pipeline can be the professional choice for a small client.

Use separate tenants and permission identities for different client data. Never route one agency client’s document to a “specialist agent” whose context contains another client’s examples. Isolation matters more than role naming.

// hands_on

Hands-On Exercise

5 steps

  1. Implement or diagram a single-agent baseline.

  2. Identify one measured failure.

  3. Compare pipeline and multi-agent alternatives.

  4. Define each role’s schema, tools, and permissions.

  5. Record quality, cost, latency, and recovery metrics.

// completion_rubric

Completion Rubric

6 checks — tick as you verify

0/6

// sources

Sources

// check_yourself

Check yourself

4 questions · answers and options are taken word-for-word from this course

0/4
  1. 1 / 4 · diagnose

    Your work shows this failure mode: “Every role is another model conversation.” What does the lesson tell you to do about it?