Part 6 · Inside a Production Coding Agent

Multi-Agent Organization Patterns

Comparing Agents, Personas, coordinators, and parallel tasks based on public evidence

THE QUESTION THIS PAGE ANSWERS

ANSWER FIRST

What is the key idea behind “Multi-Agent Organization Patterns”?

Comparing Agents, Personas, coordinators, and parallel tasks based on public evidence

DECISION RULE

Make the claim earn its place. Use this page as a decision aid, not a definition to memorize. Connect the idea to one real task, one observable result, and one failure that would change your mind.

TRY NEXT

Write one question you could answer with evidence after trying this idea.

WATCH FOR

A conclusion that sounds complete but leaves the key assumption untested.

Learning Objective

Read Grok Build's actual organization pattern from subagent_coordinator, and use task dependencies, context requirements, file conflicts, and aggregation cost to select an organization strategy.

TEACHING DIAGRAM

The parent session manages a set of identified sub-Agents through an event channel

Coordinator here is the real component name from the Grok Build source code. The layout is for teaching purposes.

Relationships between the parent session, subagent coordinator, and three sub-Agents parent sessiontask / query / cancel SubagentCoordinatorpending · active · completedwait slots · completions exploreAgentDefinition + Persona general-purposeAgentDefinition + Persona planAgentDefinition + Persona
Grok Build Source Code: Definition and Coordination

Definition Layer: AgentDefinition + Persona

AgentDefinition provides the contract: prompt, tools, permissions, model, MCP inheritance, and spawnable types. Persona appends behavioral instructions, I/O contracts, and some runtime defaults. Together they give each sub-Agent an observable identity and capability boundary.

resolvetype → definition → role/persona runtime config

Coordination Layer: SubagentEvent

start_subagent_coordinator starts a single drain task. Each Spawn event then starts a local async task that calls handle_subagent_request.

eventsSpawn · Query · Cancel · ListActive · Completions · Outstanding

Parallel Execution

Spawn events enter spawn_local independently; the coordinator tracks pending, active, and completed states. Parallel capability comes from async tasks and is not limited by the number of Personas.

Results and Waiting

Query can immediately return a snapshot or register a block wait slot and poll for status. Completions drains pending notifications and filters by suppress_ids.

Cancellation and Cleanup

Cancel supports targeting by subagent ID or parent prompt ID. The coordinator also evicts expired completed records and logs explicit kills.

crates/codegen/xai-grok-shell/src/agent/mvp_agent/subagent_coordinator.rs crates/codegen/xai-grok-agent/src/config.rs start_subagent_coordinator handle_subagent_request
Claude Comparison: Public Behavior Only

What Can Be Compared Is Product Surface Behavior

Claude Code publicly supports custom subagents: each subagent can have its own context, system prompt, tool permissions, and model; the main session can auto-delegate or the user can invoke them explicitly. The public Agent Teams feature description includes shared tasks, inter-member messaging, and independent contexts. This lesson does not treat "Coordinator" or "Swarm" as internal Claude Code source types, nor infer their scheduler implementation.

Single Main Session Delegation

Suitable when one owner decomposes tasks, chains dependencies, and aggregates results. Grok's task + coordinator events and Claude's public subagent delegation both support this workflow.

Multi-Member Collaboration

Suitable when members need to communicate with each other and claim shared tasks. Evaluate based on the public Agent Teams behavior and current version limitations.

Role Reuse

Suitable for long-running recurring roles like reviewer, explorer, or planner. Grok uses AgentDefinition and Persona; Claude's public configuration uses subagent definition files.

Real Source Code Snapshot
crates/codegen/xai-grok-shell/src/agent/mvp_agent/subagent_coordinator.rsREAL SOURCE · abridged
while let Some(event) = rx.recv().await {
    match event {
        SubagentEvent::Spawn(boxed) => { /* handle request */ }
        SubagentEvent::Query(query) => { /* snapshot or block */ }
        SubagentEvent::Cancel(request) => { /* cancel target */ }
        SubagentEvent::ListActive(request) => { /* summaries */ }
        SubagentEvent::Completions(request) => { /* drain */ }
        ...
    }
}

Note: Event variants and control structures are from real source code; branch bodies are condensed for the classroom. There is no source snapshot for the Claude side — all descriptions are limited to publicly documented behavior.

Classroom Exercise: Scenario Decision

For each of the three scenarios below, choose "Single Agent", "Main session + subagents", or "Multi-member shared tasks", and explain the parallelism benefit, dependencies, context copy cost, file conflicts, and aggregation responsibility.

Search 8 independent modules and compile a final risk inventory.
Sequential changes to schema, service, and tests within the same payment module — steps are tightly dependent.
Parallel migration of three independent services, where members need to synchronize interface changes with each other.
Takeaway: Multi-Agent organization starts with the task graph, then selects a product mechanism. Grok source code demonstrates an event coordinator and configurable Agent identities; cross-product comparisons should stay at the public behavior layer — avoid turning marketing terminology into internal architecture facts.

Why “The parent session manages a set of identified sub-Agents through an event channel” depends on the operation

“Read Grok Build's actual organization pattern from subagent_coordinator , and use task dependencies, context requirements, file conflicts, and aggregation cost to select an organiz…” makes the structure concrete. The useful comparison is not which name sounds more advanced, but how the data is arranged and how far the most common operation has to travel.

Read a structure through access and change

“Coordinator here is the real component name from the Grok Build source code.” exposes a trade-off that is easy to miss: reading by position, looking up by key, adding at either end, inserting in the middle, and traversing relationships do not favor the same organization. A structure that is fast for one operation is not automatically fast for all of them.

Count scale and update frequency together

Use “For each of the three scenarios below, choose "Single Agent", "Main session + subagents", or "Multi-member shared tasks", and explain the parallelism benefit, dependencies, context…” as a boundary check. Write down the data size, the dominant operation, and the latency you can accept before deciding whether an AI-generated structure actually fits.

From “The parent session manages a set of identified sub-Agents through an event channel” to “Definition Layer: AgentDefinition + Persona”

“The parent session manages a set of identified sub-Agents through an event channel” grounds the problem in “Coordinator here is the real component name from the Grok Build source code. The layout is for teaching purposes”. “Definition Layer: AgentDefinition + Persona” then moves it toward “AgentDefinition provides the contract: prompt, tools, permissions, model, MCP inheritance, and spawnable types. Persona appends behavioral instructions, I/O contracts, and some runtime defaults. Together they g…”. Together, they show that the lesson is not just a conclusion to remember, but a claim with conditions.

Carry the judgment into the next situation

When you meet a new data structure, do not begin by memorizing its definition. Write down the most frequent operation, estimate scale and update behavior, and check whether the structure satisfies all three conditions.

  • “The parent session manages a set of identified sub-Agents through an event channel”: Coordinator here is the real component name from the Grok Build source code. The layout is for teaching purposes
  • “Definition Layer: AgentDefinition + Persona”: AgentDefinition provides the contract: prompt, tools, permissions, model, MCP inheritance, and spawnable types. Persona appends behavioral instructions, I/O contracts, and some runtime defaults. Together they g…
  • “The closing point”: Claude Code publicly supports custom subagents: each subagent can have its own context, system prompt, tool permissions, and model; the main session can auto-delegate or the user can invoke them explicitly. The…

The final “The closing point” brings the discussion to “Claude Code publicly supports custom subagents: each subagent can have its own context, system prompt, tool permissions, and model; the main session can auto-delegate or the user can invoke them explicitly. The…”. The useful thing to carry forward is knowing which judgments must be revisited when input, scale, or risk changes.

Mark as learned Your reading progress updates automatically
← PreviousNext →

Keep reading

The next useful article in the thread.

ARTICLE DISCUSSION

Leave one useful thought here.

Keep the idea that clicked, the question that stayed open, or a small note for the next learner.

Discussing Multi-Agent Organization Patterns Inside a Production Coding Agent
3discussionsArticle discussion · synced with the Circle
View in the learning circle
AM
Asha MorganContent editor
INSIGHTField note

I turned one judgment from this article into a small experiment I could run today. Knowing what to observe next is more useful than simply remembering the conclusion.

ARTICLE DISCUSSION7 helpful
LH
Lin HarperIndie developer
INSIGHTInsight

After reading this, I first looked for the conditions behind the idea instead of copying the method into a project. That order made the later trade-offs much clearer.

ARTICLE DISCUSSION5 helpful
KM
Kiki MooreProduct operations
QUESTIONQuestion

When this judgment reaches real work, which constraint should be added first? I am curious which step matters most between reading and the first practical attempt.

ARTICLE DISCUSSION4 helpful