Divide work without losing control of the result
A multi-agent system divides work among specialized agents and defines how tasks, evidence, status, and ownership move between them. A manager may orchestrate workers, one agent may call another as a tool, or a peer may hand off a task. The benefit comes from useful specialization—not from adding more model calls.
What You Will Learn
- Compare manager-worker, agent-as-tool, and handoff topologies.
- Write a delegation contract with scope, permissions, budget, and success criteria.
- Transfer only necessary context and evidence between agents.
- Keep task ownership and final synthesis explicit.
Calling a specialist is not the same as handing over control
When an agent uses another agent as a tool, the specialist receives a bounded request, returns a result, and control goes back to the original controller. In a handoff, the receiving agent becomes responsible for the conversation or task until another explicit transfer occurs.
Every delegation needs a contract: scope, inputs, expected output, permissions, budget, deadline, and success criteria. Pass evidence and state needed for that contract—not the entire conversation by default. Unless ownership is deliberately handed off, one coordinator remains responsible for resolving conflicts and producing the final answer.
Three multi-agent topologies
Instructional figure
Three multi-agent topologies
Who owns control in manager-worker, agent-as-tool, and handoff designs?
MANAGER–WORKERS
AGENT AS TOOL
HANDOFF
Delegate a task and check what comes back
Use more than one agent only when tasks are genuinely parallel, require different tools, or need distinct expertise.
Choose a topology: manager and workers, agents-as-tools, or a peer-to-peer handoff.
Define a delegation contract with scope, inputs, expected output, permissions, budget, deadline, and success criteria.
Pass the necessary state and evidence—not entire noisy histories—and state who owns updates after a handoff.
Track progress, detect duplicate work or conflicting decisions, validate every returned result, and keep one owner for the final outcome.
Instructional figure
A delegation contract from assignment to integration
What information must cross an agent boundary?
Should this be one agent or several?
A Realistic Example: Preparing a market report through bounded delegation
A coordinator delegates official-statistics research and competitor analysis in parallel. Each specialist returns a structured result with sources and status. A fact-checker examines the combined claims, and the coordinator resolves contradictions before producing one report.
Read the Mechanism in Code
Use the label and note to understand what this block represents before reading each line.
contracts = [
Task(role="statistics", output="sourced_metrics", budget=3),
Task(role="competitors", output="comparison_table", budget=3),
]
statistics, competitors = await_all(
delegate(task) for task in contracts
)
review = fact_checker.run(evidence=[statistics, competitors])
report = coordinator.merge_validated(statistics, competitors, review)Hands-On Runnable Python Lab: Join Two Worker Results Without Hiding a Conflict
Worker A reports a $40 price from P1; worker B reports $45 from P2 and a 30-day refund period from R1. Duration fixtures are 0.8 s and 1.2 s, followed by 0.2 s of coordinator work.
- Collect facts with worker and source IDs.
- Group values by field; preserve both prices instead of last-write-wins.
- Expose the conflict while retaining the uncontested refund fact.
- Calculate latency separately from correctness: faster disagreement is still disagreement.
Parallel workers meet at an explicit conflict-aware join
Independent worker durations determine the ideal critical path. The join preserves the two conflicting prices rather than choosing the last result.
workers = [
{"name": "A", "seconds": 0.8, "facts": {"price_usd": (40, "P1")}},
{"name": "B", "seconds": 1.2,
"facts": {"price_usd": (45, "P2"), "refund_days": (30, "R1")}},
]
grouped = {}
for worker in workers:
for field, (value, source) in worker["facts"].items():
grouped.setdefault(field, []).append((value, source, worker["name"]))
for field, records in sorted(grouped.items()):
values = {record[0] for record in records}
status = "CONFLICT" if len(values) > 1 else "SUPPORTED"
print(field, status, records)
join_seconds = 0.2
serial = sum(worker["seconds"] for worker in workers) + join_seconds
parallel = max(worker["seconds"] for worker in workers) + join_seconds
print(f"serial estimate: {serial:.1f} s")
print(f"ideal parallel estimate: {parallel:.1f} s")
print(f"ideal saving: {serial - parallel:.1f} s")
print("Final price answer: withheld pending source resolution")
price_usd CONFLICT [(40, 'P1', 'A'), (45, 'P2', 'B')]
refund_days SUPPORTED [(30, 'R1', 'B')]
serial estimate: 2.2 s
ideal parallel estimate: 1.4 s
ideal saving: 0.8 s
Final price answer: withheld pending source resolutionWhat This Run Shows
- Multiple sources do not imply conflict when values agree; here 40 and 45 genuinely differ.
- The refund field survives even though the price cannot be finalized.
- Latency comes from supplied timings, not measured model workers.
The coordinator must maintain a consistent result contract, not merely write a fluent synthesis. Explicit ownership, conflict resolution and stop rules matter more than the number of agents.
From the Exercise to an Application
Experiment: Change worker B’s price to 40.
The price becomes SUPPORTED by the merge rule. Agreement still does not prove truth: both workers could share the same bad source.
Summary / Key Takeaways
- Multi-agent systems are useful when work benefits from genuine specialization, parallelism, or separate tool/permission boundaries.
- A manager-worker topology keeps synthesis centralized; agents-as-tools nests specialists under one controller; handoffs transfer control to another agent.
- Delegation should use explicit contracts containing scope, inputs, expected output, permissions, budget, deadline, and success criteria.
- Only necessary context and evidence should cross agent boundaries; transferring entire histories increases noise and cost.
- Ownership of task state and the final answer must remain clear, especially after handoffs.
- Duplicate work, conflicting conclusions, coordination failures, and repeated context can make multi-agent systems worse than one capable agent.
- Use multiple agents only when evaluation shows that the added coordination complexity produces measurable value.
Verified Further Reading
These primary research papers and current official specifications support the concepts and implementation guidance in this lesson. The explanations, analogies, exercises, and code above remain original teaching material.