Skip to main content
Back to all articles
AI Engineering 7 min readUpdated August 31, 2026

Multi-Agent Systems Need Ownership Boundaries More Than More Agents

Adding agents does not automatically add capability. A practical orchestrator-worker design for tasks that genuinely divide into independent workstreams, with explicit contracts, bounded budgets, cancellation, merge rules, and shared-state isolation.

By Salman Butt · Senior Full-Stack & Generative AI Engineer
#multi-agent#ai-agents#orchestration#worker-pattern#distributed-systems#concurrency#typescript#python
On this page

The easiest way to make an agent system harder to debug is to add three more agents before deciding what the first one actually owns.

Multi-agent architecture is attractive because many engineering tasks really do have parallel structure. A repository audit can inspect frontend, backend, infrastructure, and tests independently. A research task can investigate several sources at once. A migration review can split schema, application code, and deployment risk.

But “give each area to an agent” is not yet an architecture.

The hard questions appear immediately:

Text
Who decides the decomposition?Which state can workers see?Can two workers change the same resource?What happens when one fails?How much budget does each worker get?How are contradictory results merged?Can a worker create another worker?When does the parent stop waiting?

I prefer an orchestrator-worker model where the parent owns decomposition and synthesis, while workers receive bounded, typed assignments. The worker is not a smaller copy of the whole system with the same credentials and unlimited context.

The example here is a code-analysis assistant reviewing a pull request across frontend, backend, database, and deployment concerns.

Use multiple agents only when the work has real independence

Good candidates look like this:

Text
frontend review       reads UI diff and component testsbackend review        reads API/service diff and testsdatabase review       reads migrations/query changesdeployment review     reads manifests/config/release changes

Each workstream can produce useful findings without waiting for the others.

Poor candidates look like this:

Text
agent 1 decides what to doagent 2 checks agent 1agent 3 checks agent 2agent 4 summarizes all opinions

That can be useful in specialized evaluation or adversarial-review designs, but as a default it often multiplies model calls without creating independent information.

Before adding a worker I ask: what unique evidence or computation can this worker obtain in parallel?

If the answer is only “another opinion,” I want evaluation data showing that the extra opinion improves the outcome enough to justify the complexity.

Give every assignment a contract

The orchestrator should not send “review the backend” as an unbounded natural-language mission.

I want a typed assignment:

type ReviewArea = "frontend" | "backend" | "database" | "deployment";​type WorkerAssignment = {  id: string;  area: ReviewArea;  repositoryId: string;  baseSha: string;  headSha: string;  filePaths: string[];  objectives: string[];  allowedTools: string[];  maxToolCalls: number;  maxCostMicros: bigint;  deadlineMs: number;};​type ReviewFinding = {  severity: "low" | "medium" | "high";  filePath: string;  line?: number;  summary: string;  evidence: string;};​type WorkerResult = {  assignmentId: string;  status: "completed" | "partial" | "failed";  findings: ReviewFinding[];  notes: string[];};

This does two useful things.

First, the worker knows what done means.

Second, the orchestrator can merge results without parsing four unrelated essays.

The orchestrator owns decomposition

The model can help decide which workstreams exist, but the host validates the plan before spawning anything.

type WorkerPlan = {  assignments: WorkerAssignment[];};​function validateWorkerPlan(  plan: WorkerPlan,  limits: {    maxWorkers: number;    maxTotalCostMicros: bigint;  },): void {  if (plan.assignments.length > limits.maxWorkers) {    throw new Error("Worker count exceeds run limit");  }​  const totalBudget = plan.assignments.reduce(    (sum, item) => sum + item.maxCostMicros,    0n,  );​  if (totalBudget > limits.maxTotalCostMicros) {    throw new Error("Worker plan exceeds parent budget");  }​  const ids = new Set(plan.assignments.map((item) => item.id));  if (ids.size !== plan.assignments.length) {    throw new Error("Worker assignment IDs must be unique");  }}

A prompt saying “use at most four agents” is useful guidance. The runtime limit is the guarantee.

Child budgets come from the parent

A worker should not look at the tenant's entire remaining monthly budget and decide how much it deserves.

The parent allocates envelopes.

If the run has 120,000 cost micros available, it might assign:

Text
frontend       25,000backend        35,000database       25,000deployment     20,000parent merge   15,000

The numbers depend on expected work. The important property is conservation: child reservations reduce what remains available to the parent and siblings.

This prevents a decomposition bug from turning four workers into four copies of the original budget.

The same principle applies to tool calls, wall-clock time, and output tokens.

Workers should have narrower capabilities

If the parent is reviewing a pull request, a frontend worker probably needs:

Text
read filessearch symbolsread diffrun frontend tests in sandbox

It probably does not need:

Text
merge pull requestdeploy productionchange database credentialssend customer email

I derive worker capabilities from the assignment, not from whatever tools the parent happens to have.

type WorkerGrant = {  assignmentId: string;  allowedTools: Set<string>;  repositoryId: string;  writablePaths: string[];};​function authorizeWorkerTool(  grant: WorkerGrant,  toolName: string,): void {  if (!grant.allowedTools.has(toolName)) {    throw new Error(`Tool ${toolName} is outside worker grant`);  }}

The worker may be influenced by hostile repository text. Least privilege still applies inside a multi-agent system.

Read-only workers are much easier to parallelize

Parallel analysis is usually safe because workers can inspect the same immutable snapshot.

Parallel editing is harder.

Two coding workers can both change package.json, one can refactor a function while another writes tests against the old signature, and both can produce individually reasonable patches that do not compose.

For write-capable workers I prefer one of three designs:

Text
1. disjoint ownership   each worker owns explicit files/resources​2. isolated branches/worktrees   workers produce patches, parent integrates​3. single-writer architecture   workers propose changes, one executor applies them

The third design is often underrated. Several agents can analyze independently without several agents mutating shared state independently.

Run workers concurrently, but bound the fan-out

A validated plan can be executed with ordinary structured concurrency.

import pLimit from "p-limit";​async function runWorkers(  assignments: WorkerAssignment[],  execute: (assignment: WorkerAssignment) => Promise<WorkerResult>,  concurrency = 3,): Promise<WorkerResult[]> {  const limit = pLimit(concurrency);​  return Promise.all(    assignments.map((assignment) =>      limit(() => execute(assignment)),    ),  );}

This protects the local worker pool. The system-wide backpressure rules from the earlier article still apply when many parent runs spawn workers at once.

four workers per run is not a global capacity policy.

Decide failure semantics before launching

If the database worker fails, should the whole review fail?

For code review, probably not. The parent can return a partial result and clearly say that database analysis did not complete.

For a compliance workflow where every required domain must be checked, one failed worker may make the final output incomplete enough to stop.

I put that on the assignment or plan:

TypeScript
type WorkerCriticality = "required" | "optional";

The orchestrator then has deterministic merge policy:

Text
required worker failed -> no final approvaloptional worker failed -> produce partial result with warning

Do not ask the synthesis model to decide after the fact whether a missing security review was probably important.

Cancellation should cascade down

If the user cancels the parent run, every child should stop receiving new work.

If a required worker fails and policy says the run cannot succeed, optional workers may no longer be worth paying for.

The parent cancellation signal should propagate into:

Text
model callstool callssandbox processesqueue jobschild waits

For distributed workers, cancellation becomes durable run state or a signal/event rather than only an in-process AbortSignal.

The worker checks before expensive steps and before side effects.

The parent should not report “cancelled” while child workers continue spending for another minute.

Keep each worker's context private unless sharing is necessary

A common multi-agent design copies every worker transcript into every other worker.

That destroys one of the main benefits of decomposition.

The frontend reviewer does not need the database reviewer's entire reasoning history. It may need one structured fact later:

Text
API response field `customerStatus` changes from nullable to required.

I prefer workers to communicate through typed artifacts or parent-mediated messages.

TypeScript
type SharedFinding = {  producerAssignmentId: string;  key: string;  value: string;  evidenceRef: string;};

The orchestrator decides which shared findings are relevant to another workstream.

This reduces context growth and limits the spread of malicious/untrusted content from one worker's source material.

Synthesis should preserve provenance

The parent receives four sets of findings.

It should not flatten them into a summary that loses where each claim came from.

I keep assignment and evidence references through the merge:

TypeScript
type MergedFinding = ReviewFinding & {  assignmentIds: string[];};

If frontend and backend workers independently report the same breaking API change, the parent can merge the duplicate while preserving both sources.

If they contradict each other, that is a conflict to resolve, not an invitation to average the prose.

For important conflicts, the orchestrator can request targeted re-checks or escalate to a human rather than hallucinate consensus.

Deterministic merge before model synthesis

A surprising amount of merging can happen without another LLM call.

I can:

Text
sort findings by severitymerge exact duplicate file/line findingsvalidate evidence referencesseparate failed workstreamscount findings by area

Then a synthesis model turns that structured set into readable review prose.

This keeps the final model focused on explanation rather than bookkeeping.

It also makes evaluation easier because I can score worker findings and final presentation separately.

Do not allow recursive spawning by default

A worker that can create three workers, each of which can create three more, has an exponential cost path.

If hierarchical decomposition is genuinely useful, I put hard depth and total-worker limits in runtime state:

TypeScript
type SpawnBudget = {  maxDepth: number;  maxWorkersTotal: number;  workersCreated: number;};

Many systems can simply disallow worker spawning entirely. The parent is the only orchestrator.

That makes run topology predictable and cost accounting much easier.

“Agent can delegate when useful” should never imply unbounded process creation.

Evaluate the system against a strong single-agent baseline

A multi-agent system should earn its complexity.

I compare:

Text
task success / finding recallfalse-positive ratewall-clock latencytotal model tokenstool callscostfailure ratereproducibility / replay complexity

Parallel workers may reduce wall-clock time while increasing total compute. That can be a good trade for interactive analysis.

They may find more issues because each worker has a narrower context. Also good.

But if four workers produce the same quality as one well-instructed model at four times the cost, the architecture has not become more senior because it contains more boxes.

Trace workers as a tree

The observability model maps naturally:

Text
agent.parent_run  worker.frontend  worker.backend  worker.database  worker.deployment  synthesis

Every worker span carries:

Text
assignment IDworker role/versionbudget allocated / consumedtool callsstatusfindings countcancellation reason

Large worker transcripts stay out of normal span attributes.

The trace should make it obvious whether a slow parent spent time executing, waiting for one straggler, or retrying a failed child.

Stragglers can dominate latency

Parallel work finishes when the required work finishes, not when the average worker finishes.

If three workers complete in two seconds and one takes twenty, the user waits twenty.

Possible responses include:

Text
smaller assignment for the slow domaintimeout and partial-result policyfaster model for low-risk workspeculative duplication only for very high-value casesbetter tool performance

Do not blindly increase worker count. More partitions can create more scheduling overhead and more opportunities for a slow tail.

Latency needs the same evaluation discipline as quality.

Human approval belongs above the workers

A worker can propose a consequential action. It should not independently acquire approval or execute it unless the product explicitly designed that authority.

I prefer the parent to collect proposed actions, deduplicate them, validate them, and create one clear approval surface.

That keeps the user from receiving four separate “Approve?” prompts from four workers operating on overlapping state.

The approval still binds to the exact action, as covered earlier in the series.

When one agent is better

Use one agent when:

Text
the task is inherently sequentialall steps need the same contextthere is one small tool surfaceparallel work would touch the same mutable statethe task normally completes in a few turnsmulti-agent evals show no meaningful quality/latency gain

A single explicit workflow is easier to trace, replay, secure, and budget.

Multi-agent architecture earns its place when independent workstreams can genuinely proceed with smaller context and later combine through a well-defined contract.

The useful mental model is not “a team of AI coworkers.”

It is distributed task execution.

Once you frame it that way, the familiar engineering concerns become obvious: partitioning, ownership, isolation, budgets, backpressure, failure semantics, cancellation, provenance, and deterministic aggregation.

Those boundaries are what make multiple agents useful. The number of agents is the least interesting part.

KEEP READING

Related engineering notes