Heicode Docs

Agent Collaboration Modes: Swarm, Sub, and Chain as a Conceptual Reference

Agent Collaboration Modes: Swarm, Sub, and Chain as a Conceptual Reference

Heicode currently offers only two selectable Agent collaboration modes:

  • Swarm mode: on a tenant-level virtual machine, a lead Agent breaks down and dispatches tasks, and multiple worker Agents claim and execute them — up to 8 workers, 3 by default (adjustable by plan).
  • Sub mode: a main Agent splits the task, and multiple sub-agents execute it by division of labor.

This article also introduces the concept of "Chain mode," drawn from the article Analyzing the Agent Swarm Pattern, to help understand different forms of multi-Agent collaboration. To be clear: Chain mode is not currently a selectable mode in the Heicode product, and there's no corresponding implementation in the code — it's included here purely as a conceptual reference, and does not mean Heicode offers a third selectable collaboration mode.

These modes address the question of "how multiple Agents collaborate." They are not billing tiers, and not model tiers.

Understanding it in one line

ModeSelectableOne-liner
Swarm modeSelectableThe lead Agent breaks down and dispatches tasks, multiple worker Agents execute in parallel, and the lead aggregates results.
Sub modeSelectableA main Agent handles splitting, assignment, and aggregation; sub-agents complete local tasks by responsibility.
Chain modeNot selectable, conceptual reference onlyTasks pass from one Agent to the next in fixed steps, executing like a pipeline.

I. Swarm mode

The article's Swarm concept emphasizes "no strong central scheduling, self-organizing individuals," but the Swarm mode Heicode has actually implemented isn't like that. It's a lead-plus-worker architecture: on a tenant-level Azure virtual machine, an api container, a lead container, and several worker containers run via docker-compose — the lead is responsible for receiving the goal, breaking down the task, and dispatching it, while workers are responsible for claiming and executing it, up to 8 workers, 3 by default (adjustable by plan).

In Heicode, this can be understood as:

User goal
-> The lead Agent breaks down the task
-> The lead dispatches subtasks to workers
-> Workers claim, execute, and report heartbeat
-> High-risk operations go through approval
-> The lead aggregates worker results
-> Output the result

Key characteristics of Swarm mode

CharacteristicDescription
Lead-worker architectureThe lead handles decomposition and scheduling, workers handle claiming and execution — not centerless self-organization.
Explicit dispatchSubtasks are broken down by the lead and then dispatched to workers — workers don't compete for tasks on their own.
Heartbeat reportingWorkers continuously report a heartbeat after claiming a task, so the lead can judge progress and anomalies.
HandoffOne Agent can hand off a task, context, or control to another Agent.
Result aggregationThe lead aggregates results from multiple workers and judges whether acceptance criteria are met.
RobustnessIf a worker fails, the lead can redispatch the task to another worker.

What tasks Swarm mode is good for

Good fit:

  • Research across multiple sources.
  • Large-scale code review.
  • Complex troubleshooting.
  • Exploring multiple approaches.
  • Parallel checks across security, performance, and testing dimensions.
  • Complex tasks whose subtasks are generated dynamically and affect each other.

Not a good fit:

  • Very small, single-step tasks.
  • Tasks with a very tight budget.
  • Tasks that must execute strictly linearly.
  • Strongly consistent transactions.
  • Tasks with no clear stopping condition.
  • Tasks involving high-risk production operations without an approval boundary.

What Swarm mode in Heicode needs extra control over

Swarm mode is powerful, but also more prone to going out of control. That's why, in Heicode, Swarm mode must retain platform constraints:

  • A worker count cap (up to 8, 3 by default, adjustable by plan).
  • A maximum budget and maximum runtime.
  • Approval for high-risk operations.
  • Manual stop and takeover.
  • Audit records.

II. Sub mode

Sub mode is another, more controllable multi-Agent collaboration style in Heicode. It's a separate collaboration style from Swarm mode — not a base capability or subset of it.

The core of Sub mode is "controlled decomposition by a main Agent." The main Agent is responsible for understanding the goal, splitting it into tasks, assigning them to sub-agents, receiving results, and aggregating them.

User goal
-> The main Agent understands the goal
-> The main Agent splits it into subtasks
-> Sub-agents execute by division of labor
-> Sub-agents deliver results
-> The main Agent aggregates and verifies
-> Output the final result

The relationship between Sub mode and the article's Supervisor pattern

The article compares Swarm, Supervisor, and Chain. Heicode's Sub mode is closer to the "Supervisor + sub-agent division of labor" form:

  • There's a main Agent responsible for coordination.
  • Sub-agent responsibilities are explicitly assigned by the main Agent or the user.
  • Subtask boundaries are relatively clear.
  • Results are aggregated by the main Agent.
  • Risk, permissions, and budget are easier to control.

But Heicode's Sub mode is more than a simple Supervisor. It also combines the task view, permission boundaries, approval, usage, and audit, so that sub-agent collaboration can be used for real delivery.

What tasks Sub mode is good for

Good fit:

  • Multi-module development.
  • Complex bug fixes.
  • Tasks that need documentation, frontend, backend, and testing split up.
  • Tasks that need an independent Reviewer to review.
  • Scenarios where the task can be split into a few clear parts up front.

Not a good fit:

  • Tasks whose subtasks keep being generated dynamically.
  • Tasks that need a large number of Agents competing for or filling in for each other autonomously.
  • Open-ended exploration with no main-line goal.
  • Simple tasks better suited to a fixed pipeline.

The value of Sub mode

  • Handles complex tasks better than a single Agent.
  • Easier to control risk than Swarm mode.
  • Different sub-agents can be given different permissions.
  • Execution, review, and deployment can be kept separate.
  • Progress, failure reasons, and model usage can be viewed per subtask.

III. Chain mode (conceptual reference, not an existing Heicode mode)

The following content comes from the Chain concept in the reference article, used to help understand the other end of the collaboration spectrum. Heicode currently offers no selectable Chain mode, and there's no corresponding feature in the product.

Chain mode corresponds to the Chain concept in the article. Its core is a "fixed-sequence pipeline."

Tasks pass through preset steps in sequence:

Agent A
-> Agent B
-> Agent C
-> Agent D
-> Output the result

In Chain mode, each Agent only processes what's passed down from upstream, then hands the result off downstream.

What tasks Chain mode is good for

Good fit:

  • Tasks with a fixed process.
  • Data cleaning, analysis, report generation.
  • Document formatting.
  • Fixed release checks.
  • Fixed review processes.
  • Tasks that don't need the path adjusted dynamically.

Not a good fit:

  • Complex exploration.
  • Competing between multiple approaches.
  • Tasks whose path is uncertain.
  • Tasks needing multiple Agents to fill in for each other in parallel.
  • Tasks where upstream results are unstable and need repeated rollback.

The value of Chain mode

  • Easiest to understand.
  • Easiest to reproduce.
  • Easiest to audit.
  • Predictable cost.
  • Every step's output is clear.

The risk of Chain mode

  • Low flexibility.
  • An upstream failure affects everything downstream.
  • A design error at any single step throws off the whole flow.
  • Not suited to dynamic tasks.

Mode comparison (including the Chain conceptual reference)

DimensionSwarm mode (selectable)Sub mode (selectable)Chain mode (conceptual reference, not selectable)
CoordinationThe lead breaks down and dispatches, workers executeThe main Agent splits and coordinatesFixed-sequence handoff
Task structureThe lead dispatches to up to 8 workers (3 by default)Clearly defined subtasksFixed pipeline
FlexibilityMedium to highMediumLow
ControllabilityMedium, depends on budget and worker capHighHigh
Fault toleranceMedium to high, the lead can redispatchMediumLow
Cost predictabilityLow to mediumMedium to highHigh
Good fitExploratory tasks needing parallel processing across multiple workersMulti-role division of labor, controlled deliveryFixed processes, standardized handling (concept only)
Main riskRunaway worker count or costInaccurate splitting by the main Agent, duplicate subtasksBroken chain, rigid process (concept only)

How to choose

Heicode currently only lets you choose between Swarm mode and Sub mode:

Task characteristicsRecommended mode
Task needs multiple workers exploring in parallelSwarm mode
Subtask boundaries are clear, needs multiple sub-agents dividing the workSub mode
Large-scale code review, needs multiple workers checking separatelySwarm mode
Fixing a complex bug that splits into frontend, backend, and verificationSub mode
Documentation from collection, organization, through reviewSub mode
Product feature developmentSub mode

Chain mode, as a conceptual reference, is only meant to illustrate "if the process is completely fixed and doesn't need dynamic adjustment, you can think of it as a pipeline" — but this isn't an implementation Heicode currently offers.

Summary

  • Sub mode is a good fit for controlled division of labor with clear boundaries.
  • Swarm mode is a good fit for exploratory tasks that need multiple workers processing in parallel, using a lead-dispatches, worker-executes architecture.
  • Chain mode serves only as a conceptual reference for understanding the collaboration spectrum — Heicode currently has no corresponding selectable mode or implementation.

Reference

On this page