Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Benefits and coordination costs of multiple agents

When is another Agent worth adding? Compare sequential reads, parallel tools and isolated deterministic evidence workers under the same evidence contract, diagnose a lost branch result, and explain what would justify a separate model decision loop.

Learning objectives: The value of multiple agents comes from reasoning and context that can be developed independently, not names or numbers. Splitting makes sense only if the new exploration benefits exceed the coordination, repeated calls, and merge losses; shared error sources will not become independent evidence due to multiple votes.

Content checked: 2026-10-30 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Implementation · Build it. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Benefits and coordination costs of multiple agents
The value of multiple agents comes from reasoning and context that can be developed independently, not names or numbers. Splitting makes sense only if the new exploration benefits exceed the coordination, repeated calls, and merge losses; shared error sources will not become independent evidence due to multiple votes.

How does the mechanism work?

Step-by-step explanation
  1. If a single-agent parallel tool has the same effect as a multi-agent tool, which one do you choose?

    First establish the need for independent reasoning, so I/O parallelism gains are not misattributed to multiple agents.

  2. What if two branches use the same source to reach opposite conclusions?

    The most difficult thing after splitting is merging evidence. Consistent sources do not guarantee consistent interpretations.

  3. When a branch times out, how long should the coordinator wait?

    Even with parallel subtasks, overall delivery still has dependencies and time constraints.

Implementation · Build it

Implement the contract · Benefits and coordination costs of multiple agents

Objectives of this level: Implement conflict-preserving aggregation and full cost accounting.

Visual guide · Separate I/O overlap from agency

Separate I/O overlap from agency

A worker process is not automatically an Agent. Independent model reasoning needs its own comparison; all structures still require complete, bound evidence. Select the figure to open it at full size.

Read the completed comparison before writing a merger

The comparison article contains the complete runnable program and authored task set. Copy the files exactly, run the three structures, and keep all trial rows. Record task/input identity, actual tool attempts including failures, worker starts, HTTP response bytes, logical branch-message counts, final decision and elapsed wall time. A terminal result that matches the task contract counts as accepted; eligible is not the universal success state.

The tool service owns the returned evidence. The scheduler reserves attempts before dispatch. Isolated workers receive only their branch input and return structured findings. The coordinator joins by task and source identity, deduplicates origins, preserves conflict and checks required coverage. The acceptance function is shared by all three structures and is not allowed to read a branch's self-reported success.

Do not turn worker counts or HTTP byte counts into token costs. The HTTP waits are controlled experiment inputs, and subprocess startup is measured locally. The article reports these separately from the optional real-provider validation.

Implement the existing bounded merger exercise

The original exercise below remains useful for learning the evidence contract. It is a pure-function exercise, separate from the executed orchestration comparison. Implement it yourself and add a counterexample; the public checks cannot establish unseen model or production behavior.

Same after-sales project

The same after-sales case has policy and order-evidence branches. Two branches quoting reprints of one merchant policy are not independent origins. Separate independent reasoning from parallel I/O and include merge/retry cost. This exercise merges declared claims; it neither launches agents nor measures their quality.

The existing capstone main-return creates a return application; it does not execute a refund. These manifests are independent fictional extensions or policy/evidence/counting exercises. They do not add real refunds, publication, model calls or Java execution to the capstone runtime.

Complete function contract

Implement merge_branch_evidence(payload). required_claims is a unique nonempty-string list. sources has unique nonempty id, nonempty origin and a real bool verified. branches has unique nonempty id, nonnegative integer cost and a claims list. Each claim has id in required_claims, value eligible/ineligible, and source referencing an existing source id. Duplicate claim rows are allowed, but never create extra origins. merge_cost and budget are nonnegative integers, never bool. Lists may be empty. All malformed/unknown/duplicate record IDs raise ValueError:input; extra keys ignored. Sum ALL branch costs plus merge_cost, including unverified branches. For each required id ascending collect values/origins only from verified sources; no values → missing, both values → conflict, one value → supported. Sort unique origins ascending. Return exactly {"status": ..., "cost": int, "claims": [{"id": ..., "status": ..., "origins": [...]}]}. Top status is budget_exceeded when cost > budget; otherwise ready only if every row supported, else needs_review. An empty required list is vacuously ready within budget. supported means internally consistent cited fixture, not true eligibility.

Every listed input key must exist; explicit null is not an absent key. All returns must be JSON-compatible fresh containers, with exact bool/int distinctions, and leave the input unchanged. Every invalid declared field uses exactly ValueError("input"); this includes malformed nested fields. Do not swallow NotImplementedError or return a self-declared passed flag.

Own blank implementation

Download the full local package, extract it and work in its lab_runner.py directory. Runner and this case manifest are alternatives: save the runner and cases/multi-agent-worth-cost.json with that exact directory layout. The manifest contains all public fixed inputs/expected outputs; it contains no general solution. It is not an unseen assessment. Python 3.9+ and standard library only; no model keys or network calls are needed while grading.

def merge_branch_evidence(payload):
    raise NotImplementedError("Implement the documented contract yourself")
python3 lab_runner.py scaffold --course multi-agent-worth-cost --out student.py
python3 lab_runner.py grade --course multi-agent-worth-cost --module student.py --out report.json

The untouched scaffold must exit 1. Fill the function yourself and rerun; all 10 public checks must pass for exit 0. Submit student.py, the generated report.json, your source diff and one additional condition-changing test. The runner imports and calls your function on each actual payload, compares exact output/error, checks input preservation and container independence, and records runner/cases/student SHA. A manual passed flag is not accepted. Its 5-second process timeout is a hang guard, not an enterprise latency requirement.

code example

Boundary check

Admission happens before dispatch. A failed worker can consume a reservation without reaching the service. The two counts are different facts and must be reconciled rather than silently equated.

Acceptance task for this level

Copy and run the complete comparison files from the linked article. Submit the generated results, source/input hashes and a per-strategy reconciliation of read reservations and observed HTTP requests. Then implement the original merger function independently as a separate exercise.

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Why report both reserved attempts and service HTTP observations?

Further explanations and practice

When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.

All linked explanations and exercises (1 )

Sources and verification scope

The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.