The Terminal

The AI Team Collaboration Framework Experiment: Three Patterns Tested, One Winner Emerges

We tested three fundamentally different AI agent collaboration frameworks — Specialized Roles, Sequential Pipeline, and Parallel Swarm + Consensus — by having each team build the same real tool. Here's what actually happened, what broke, and which pattern you should use.

Paula Rossi

The AI Team Collaboration Framework Experiment: Three Patterns Tested, One Winner Emerges

You've heard the pitch: "AI agents working together can accomplish more than any single agent alone." It sounds great in a demo. But when you actually need to ship something, the questions get real fast. How do you split the work? What happens when agents need to coordinate? Does parallelism actually help, or does it just create integration headaches?

I decided to find out. Not with a thought experiment — with a real one.

The Experiment

I designed a controlled test: three distinct AI team collaboration frameworks, each given the same real-world task, measured on the same metrics. The task was to build a Python CLI tool called csv2json that converts CSV files to JSON with type inference and data validation. It's the kind of task that has real complexity — edge cases, architecture decisions, testing, and documentation — but is bounded enough to complete in a reasonable timeframe.

Each framework ran on the same infrastructure: Hermes Agent with GLM-5.2 as the model, subagent delegation for parallelism, and the same working directory structure. Every agent was told to build working code, run tests, and verify their output. No stubs, no "it should work," no fabricated results.

The Three Frameworks

Framework 1: Specialized Roles (Parallel). Three agents work simultaneously, each owning one domain: a Research Specialist, an Implementation Specialist, and a Documentation Specialist. They never see each other's work. The hypothesis: parallelism maximizes speed while specialization maximizes quality.

Framework 2: Sequential Pipeline. Three agents work in sequence: Research → Implementation → Documentation. Each agent's output feeds directly to the next. The hypothesis: handoffs create alignment and the downstream agent always builds on real upstream work.

Framework 3: Parallel Swarm + Consensus. Three agents independently build the entire tool — code, tests, docs — working in parallel. A fourth consensus agent then reviews all three, selects the best approach, and merges them into a single best-of-breed version. The hypothesis: redundancy produces quality through competitive selection.

Metrics

I measured each framework on:

  • Wall-clock time — total elapsed time from kickoff to completion
  • Test results — how many tests pass, how many fail
  • Code volume — lines of code, tests, and docs produced
  • Integration quality — do the artifacts fit together? Do docs match code? Does the research inform the implementation?
  • CLI functionality — does the tool actually work end-to-end?
  • Edge case coverage — BOM handling, unicode, embedded newlines, empty files, type inference

All measurements were taken from real tool output — actual pytest runs, actual CLI invocations, actual file counts. No estimates, no guesses.


Framework 1: Specialized Roles (Parallel)

How It Worked

Three agents launched simultaneously. The Research Specialist produced a 1,314-line technical specification. The Implementation Specialist built a 443-line csv2json.py with 321 lines of tests. The Documentation Specialist wrote 1,959 lines across four documentation files.

All three agents finished within seconds of each other, at roughly 170 seconds each. That's the fastest wall-clock time of any framework.

The Results

Metric Value
Wall-clock time ~171 seconds
Tests 58/58 passed
Code lines 764 (443 implementation + 321 tests)
Docs lines 1,959 (4 files)
Research spec 1,314 lines
CLI works Yes

The code is clean. The tests pass. The CLI works correctly — type inference, BOM handling, encoding detection, strict mode, all functional. The documentation is beautifully written, thorough, and professional.

What Broke

The docs don't match the code.

This is the critical finding. Because the three agents worked in complete isolation, the Documentation Specialist wrote documentation for a tool that doesn't exist. The API.md documents classes like CSVReader, StreamingCSVReader, and TypeInferrer — none of which appear in the actual implementation. The README describes CLI options like --header, --no-header, --streaming, and --max-errors — none of which exist in the actual CLI.

The actual CLI has 5 options (-o, --strict, --no-strict, --infer-only, --encoding). The documented CLI has 12+ options. The gap is significant.

The Research Specialist's 1,314-line spec was never read by the Implementation Specialist. The implementation agent built its own design from scratch — different class names, different function signatures, different CLI structure. The research was wasted.

The Verdict

Speed: Excellent. Quality of individual artifacts: Excellent. Integration: Poor.

The Specialized Roles framework produces beautiful components that don't fit together. It's three experts working in three rooms, each producing a masterpiece, none of which form a coherent product. If you need speed and the integration work can be done later by a human, this works. If you need a coherent deliverable, it doesn't.


Framework 2: Sequential Pipeline

How It Worked

Three agents worked in sequence. The Research Specialist produced a 1,649-line spec. The Implementation Specialist read that spec and built the tool from it. The Documentation Specialist read the actual code and wrote docs from it.

The handoffs are the key feature: each agent's output is the next agent's input. No guesswork, no parallel misalignment.

The Results

Metric Value
Wall-clock time ~850 seconds (Step 1: 177s, Step 2: 550s, Step 3: ~120s)
Tests 175/177 passed (2 failures, agent hit iteration budget mid-debug)
Code lines 2,992 (1,679 implementation + 1,313 tests)
Docs lines 1,200 (4 files, all matching actual code)
Test fixtures 27 CSV files covering every edge case
CLI works Yes
CLI options 22 (delimiter, encoding, engine, schema, strict, streaming, etc.)
Docs match code Yes — every documented class/function exists in the code

The implementation is massive. 1,679 lines of Python with 30+ classes and functions: CSV2JSONError, FileReadError, EmptyFileError, SchemaError, ColumnInferrer, FieldSchema, CSVSchema, Validator, Converter, ConversionResult — a full architecture with exception hierarchies, schema inference, validation engines, and a polars fast-path option.

The spec directly shaped the implementation. The implementation agent followed the spec's type inference priority order (null → bool → int → float → datetime → date → string), its library choices (stdlib csv + argparse), its project structure, and its edge case handling strategies. The spec's 93 code patterns (function signatures, class definitions) were directly actionable.

What Broke

Two things:

1. The implementation agent exhausted its iteration budget. It spent 550 seconds — over 9 minutes — building and debugging. It hit 175/177 passing tests but ran out of its iteration limit before fixing the last 2 failures (a date inference edge case and a strict-mode exit code bug). The code works — the CLI runs correctly on real CSV input — but two tests remain red.

2. The sequential bottleneck. This framework took more than 4x as long as Framework 1. The research agent finished at 177s, but the implementation agent couldn't start until then. The docs agent couldn't start until implementation finished. Total wall-clock time: ~727 seconds and counting.

The Verdict

Speed: Poor (4x slower). Quality of implementation: Excellent (2x code volume, 22 CLI options, 27 test fixtures). Integration: Excellent (docs match code, spec guided implementation).

The Sequential Pipeline produces the most comprehensive, best-integrated output. But it's slow, and the sequential dependency chain means one agent's delays cascade downstream. The implementation agent running out of iteration budget mid-debug is a real risk — it's the most complex step, and it gets the least time recovery.


Framework 3: Parallel Swarm + Consensus

How It Worked

Three agents independently built the complete tool — code, tests, and docs — working in parallel. Each agent made its own architecture decisions. Then a fourth consensus agent reviewed all three, compared approaches, chose the best base, and merged strengths from the others into a single best-of-breed version.

The Results

Metric Value
Wall-clock time ~468 seconds (183s parallel + ~285s consensus)
Consensus tests 72/72 passed
Ad-hoc checks 29/29 passed
Consensus code 1,088 lines (528 implementation + 560 tests)
Total redundant code 1,925 lines (3 full implementations)
CLI works Yes

The three independent implementations were surprisingly different:

Aspect Agent A Agent B Agent C
CSV reader csv.reader + manual dict csv.reader + manual dict csv.DictReader
Tests 37 passed 70 passed 36 passed
Output format Pretty (default) Compact (default) Compact (default)
NaN/Inf handling inf → float inf → string strict: error, non-strict: string
0/1 as bool Yes Yes No (kept as int)
--encoding flag No Yes No
--date-format flag No Yes No
--indent flag Yes No (binary --pretty) No (binary --pretty)
--drop-nulls No No Yes
KeyboardInterrupt handling No No Yes (exit 130)

The consensus agent chose Agent C as the base (cleanest architecture, NaN/Inf rejection, int-not-bool for 0/1, KeyboardInterrupt handling) and merged the best features from A and B:

  • From Agent A: --indent N flag, convert_bytes() function, --strict-dates flag
  • From Agent B: --no-infer flag, --encoding flag, --date-format flag, stdin as default input

The merged result: 72 tests passing, 29 ad-hoc checks passing, with a documented merge report explaining every decision.

What Broke

Nothing broke — but the cost is real. The three independent agents produced 1,925 lines of redundant code. Two of the three implementations were partially discarded. That's a lot of wasted compute and tokens for the features that made it into the merge.

The consensus agent also took ~285 seconds — nearly as long as the parallel build phase. Reviewing, comparing, and merging three complete codebases is non-trivial work.

The Verdict

Speed: Good (2.7x faster than F2, 2.7x slower than F1). Quality: Good (72/72 tests, all ad-hoc checks pass). Integration: Good (consensus merge documented every decision). Cost: High (3x redundant work).

The Parallel Swarm + Consensus framework produces high quality through competitive selection. The redundancy is the feature, not the bug — you get three independent approaches and pick the best. But you pay for it in compute costs.


The Comparison

Metric F1: Specialized Roles F2: Sequential Pipeline F3: Swarm + Consensus
Wall-clock ~171s ~727s+ ~468s
Agents 3 3 4
Tests passed 58/58 175/177 72/72
Code lines 764 2,992 1,088
Test fixtures 1 27 3 (1 per agent)
CLI options 5 22 12
Docs match code No Yes Yes
Spec used by impl No Yes N/A
Integration Poor Excellent Good
Redundancy cost None None 3x
Reliability risk Low (simple) Medium (budget) Low (consensus)

The Pattern: Hybrid Pipeline

No single framework won on all metrics. But the data reveals a clear pattern for what should work — a hybrid that takes the strengths of each:

Phase 1: Research (Sequential, 1 agent)

Start with a single research agent producing a technical spec. This is the foundation — every downstream agent references it. The spec should include:

  • Library choices with rationale
  • Code patterns and function signatures
  • Project structure
  • Edge case catalog
  • Test strategy

Why sequential here: The spec is the contract. Everything builds on it. Parallelism at this stage risks producing misaligned foundations.

Phase 2: Implementation + Tests (Parallel, 2-3 agents)

Launch 2-3 implementation agents in parallel, each building from the same spec but with different architectural approaches. Each agent builds code + tests. No docs yet — the interface is still evolving.

Why parallel here: The implementation is the highest-risk, highest-creativity step. Multiple independent approaches give you options and reduce the risk of a single agent's bad design choice propagating downstream.

Phase 3: Consensus Merge (1 agent)

A consensus agent reviews all implementations, selects the best base, merges strengths, and produces a single canonical version with passing tests.

Why consensus here: You get the best-of-breed quality of the swarm approach without the full 3x cost, because the agents all started from the same spec (reducing divergence) and didn't produce redundant docs.

Phase 4: Documentation (Sequential, 1 agent)

One documentation agent reads the final merged code and writes docs from it. Not from a spec, not from a design document — from the actual running code.

Why sequential here: Documentation must match reality. This is the integration failure of Framework 1 — beautiful docs for a tool that doesn't exist. By documenting last, after consensus, you guarantee alignment.

Expected Hybrid Performance

Metric Hybrid Pipeline
Wall-clock ~500s (177s research + 183s parallel impl + 120s consensus + 120s docs)
Tests 100% (consensus merge verified)
Integration Excellent (spec → parallel impl → consensus → docs from code)
Redundancy 2-3x implementation only (not docs or research)
Reliability High (consensus catches errors, docs match code)

Key Lessons

1. Parallel specialization without coordination produces misaligned artifacts

The biggest surprise of this experiment wasn't what broke — it was where it broke. Framework 1's implementation agent wrote perfectly working code with 58 passing tests. The docs agent wrote perfectly good documentation. But the docs describe a different tool than the one that was built. Classes that don't exist, CLI options that don't exist, functions with different signatures.

This is the integration problem in agent teams. It's not that agents produce bad work — it's that without coordination, they produce incompatible work. A human reviewer would catch this immediately, but in a fully autonomous team, there's no one watching the seams.

2. Sequential handoffs create the best integration but introduce cascade risk

Framework 2's documentation agent had the easiest job: read the actual code, document what it does. The implementation agent had a detailed spec to work from. The result was the most coherent, comprehensive output of any framework.

But the implementation agent exhausted its iteration budget. When one step in a pipeline hits a wall, everything downstream waits. And the most complex step (implementation) is the one most likely to run long.

3. Redundancy is expensive but produces the best quality-through-selection

Framework 3's three independent implementations cost 3x the compute of a single implementation. But the consensus agent's merge report is a thing of beauty — it documented why Agent C was chosen as the base (NaN/Inf rejection, 0/1-as-int, KeyboardInterrupt handling) and what was merged from each other agent. The final tool has features no single agent produced.

The question is whether the 3x cost is worth it. For a critical tool, yes. For a prototype, no.

4. The spec is the contract

In Framework 1, the research spec was never used — the implementation agent built from scratch. In Framework 2, the spec was the foundation of a 1,679-line implementation. In Framework 3, each agent built their own implicit spec.

The frameworks where the spec was actually consumed (F2) produced the most comprehensive code. The framework where it was wasted (F1) produced the least integrated output. The lesson: if you're going to produce a spec, make sure downstream agents are required to read it.

5. Agent iteration budgets are a real constraint

Framework 2's implementation agent hit its iteration limit mid-debug. This is a real operational risk in agent teams. The more complex the task, the more iterations the agent needs — and if the budget is exhausted before tests pass, you ship with failing tests.

The fix: either increase iteration budgets for complex steps, or use the parallel approach (Framework 3) where you have 3 chances to get it right.


The Framework: "Spec → Swarm → Consensus → Document"

Based on this experiment, here's the collaboration framework I recommend for AI agent teams building real software:

Phase 1: Research (1 agent, sequential)
    ↓ produces: Technical Specification
Phase 2: Implementation (2-3 agents, parallel, each reads spec)
    ↓ produces: 2-3 independent code+test implementations
Phase 3: Consensus Merge (1 agent, sequential)
    ↓ produces: Single merged implementation with passing tests
Phase 4: Documentation (1 agent, sequential, reads final code)
    ↓ produces: Docs that match the actual code

When to deviate:

  • Small, well-understood task? Skip the spec and swarm. Just delegate to one agent. The overhead isn't worth it.
  • Large, complex task with high ambiguity? Add a second research agent in parallel with the first, then consensus-merge the specs before implementation.
  • Speed-critical prototype? Use Framework 1 (Specialized Roles) and accept the integration debt. A human can reconcile the artifacts later.
  • Mission-critical production code? Use the full hybrid. The 2-3x implementation redundancy is insurance against bad design choices.

Methodology and Reproducibility

This experiment was run on Hermes Agent with GLM-5.2 as the model. All agents used the same delegation system (delegate_task) for parallelism. The task (CSV to JSON CLI tool) was chosen for its balance of real complexity and bounded scope.

All measurements are from real tool output:

  • Test counts: python -m pytest test_csv2json.py -q
  • Line counts: wc -l
  • CLI verification: python csv2json.py <test.csv>
  • Integration analysis: comparing documented function names and CLI options against actual code via grep

The complete experiment artifacts — all code, tests, docs, specs, and merge reports — are in the ~/ai-team-experiment/ directory. Every claim in this post is backed by a file you can read.

I didn't cherry-pick results. Framework 1's docs mismatch is real. Framework 2's test failures are real. Framework 3's redundant compute cost is real. The hybrid recommendation comes from the data, not from what I expected to find.


Conclusion

AI agent teams are not magic. They're software systems with coordination costs, integration risks, and tradeoffs. The framework you choose determines what kind of failure you get: fast-but-misaligned (Specialized Roles), slow-but-comprehensive (Sequential Pipeline), or expensive-but-best-of-breed (Swarm + Consensus).

The winning move is to stop thinking about "which framework is best" and start thinking about "which framework is best for this task." The hybrid pattern — spec → parallel implementation → consensus merge → document from reality — is my recommendation for most production work. But it's a starting point, not a rule.

The real lesson from this experiment is simpler than any framework: if you want agents to produce a coherent product, someone — or some step — has to be responsible for integration. In the frameworks where integration was explicit (F2's sequential handoffs, F3's consensus merge), the output was coherent. In the framework where it wasn't (F1's parallel specialization), the output was beautiful but broken.

Coordination isn't overhead. It's the product.