Skip to content
mentoor

Topic 1 of 5 · 5 min read

Decomposing a goal in the lead agent

Goal: Split a research or coding goal into subtasks that do not overlap and choose a worker count that matches the breadth of the task.

The lead agent's job is to turn one goal into a few subtasks that can run apart from each other, and to pick a worker count that fits the goal. In the orchestrator-worker pattern, the lead plans, workers do narrow jobs, and the lead merges what comes back.

Check yourself · 1 of 3

In an orchestrator-worker design, what is the lead agent's main job?

Choose one answer

Why it matters

A bad split costs more than no split. If two workers cover the same ground, you pay twice for the same answer. If a subtask depends on another one's result, the workers cannot run in parallel and the lead waits. Anthropic's write-up of its research system reports that early versions sent many workers after the same sources because the lead's instructions were vague.

How to split a goal

  1. Write the goal and the finished state in two lines. "Compare three vector databases" is not finished. "A table of three databases by price, hosting model and filter support, each cell with a source" is.
  2. Cut along independent axes. Split by item (one worker per database), by source (docs, issues, benchmarks) or by file area (billing module, auth module). Do not split by step when step two needs step one's output.
  3. Check each subtask for overlap and dependence. Ask: could two workers do the same work? Does any subtask need another's result? If yes, merge them or run them in order.
  4. Scale the count to the task. A simple fact check needs one worker and a few tool calls. A comparison of four things needs four. A broad research question may need ten or more with clearly separate scopes. Put this scaling rule in the lead's prompt, because models tend to overspend on easy questions.
  5. Keep integration for the lead. Workers should not decide the final shape of the answer or edit the same files.

Before and after

Goal: "Find out why checkout latency doubled last week."

Weak plan: worker 1 "look at logs", worker 2 "look at the database", worker 3 "look at the code". The scopes are fuzzy and all three will read the same slow-query log.

Better plan: worker 1 checks the p95 latency per endpoint from the metrics export for the last 14 days. Worker 2 lists deploys and config changes in that window from the release log. Worker 3 runs the slow-query report on the orders table for the two weeks. Each has one source and one question, and none needs another's output.

What goes wrong

  • Splitting by step instead of by axis. The workers run one after another, so you gain nothing and pay for the handoffs.
  • Too many workers for a small task. Each one re-reads the brief and returns text the lead must read.
  • No worker owns a gap. If nobody covers the pricing page, the merged answer has a hole the lead may not notice.

Examples

Splitting a refactor

Goal: rename userId to accountId across a service. Split by package: one worker for api/, one for jobs/, one for db/migrations. The lead owns the shared types.ts file and edits it first, because all three workers import it. Splitting by file inside one package would create merge conflicts.

Sizing a research run

Question A: "What year was the library's 2.0 release?" One worker, under ten tool calls. Question B: "How do five CI services price self-hosted runners?" Five workers, one per service, each told to use that vendor's pricing page and docs only. The lead's prompt states both rules so it does not launch five workers for question A.

Key points

  • Write what a finished answer looks like before you split the goal.
  • Cut subtasks along independent axes such as item, source or file area, not along sequential steps.
  • Check every subtask for overlap with another and for a dependence on another's output.
  • Scale the worker count to the task and put the scaling rule in the lead's prompt.
  • The lead keeps the final structure and the integration; workers do narrow, separate jobs.

Common mistakes

  • Splitting a task into sequential steps and calling it parallel work.
  • Giving workers overlapping scopes such as "research the market" and "research competitors".
  • Always launching the same number of workers regardless of how hard the question is.
  • Letting several workers edit the same shared file.

Check yourself · 2 of 3

A goal needs three facts, and fact 2 can only be found once fact 1 is known. How should the lead plan the work?

Choose one answer

Check yourself · 3 of 3

Which prompt rule helps the lead avoid launching ten workers for a one-line fact check?

Choose one answer

Practice items, not counted towards your mastery.

Start here