DEV Community

Cover image for DeepSeek Super-agent Parallel Coding Architecture and Results from Testing It on 8 Real Bugs
boluo
boluo

Posted on

DeepSeek Super-agent Parallel Coding Architecture and Results from Testing It on 8 Real Bugs

DeepSeek dsh-superagent-prototype open-source repository on GitHub

When I only have one feature to ship, keeping a single Claude Code or Codex terminal open feels effortless. The trouble starts the moment I try to juggle four or five active sessions across different bugs and PR reviews: while terminal #1 is blocked running an integration suite, a teammate drops a schema change in our group chat that belongs to terminal #3, and terminal #2 is waiting on a bash prompt I forgot to approve ten minutes ago. Coding agents automated the typing, but left developers acting as the human context router.

On October 31, 2026, the DeepSeek Harness team published their systems design paper (Exploring Super-agent Design: Toward More Autonomous Agent Systems) and open-sourced the accompanying TypeScript reference implementation in the dsh-superagent-prototype repository. Their thesis is simple: single-task ceiling is decided by model intelligence, while multi-task ceiling is decided by human attention (which tops out around 3 to 5 concurrent sessions). To find out whether their dual-layer Router/Worker architecture actually saves time on real codebases—or just burns extra tokens—I audited the prototype source tree and ran a controlled 8-bug Python repair benchmark on November 30, 2026 (using identical Chinese task prompts across a single-session agent, a single-ticket Worker, and 1 Router + 8 parallel Workers).

Overall architecture of the DeepSeek Super-agent system

Architecture Decision Dimension Use Router/Worker Super-agent When... Stick to a Single-Session Agent When...
Incoming Event Stream Your repo receives continuous GitHub Issues, PR review comments, and IM messages all day You manually kick off coding scripts or debugging prompts a few times a day
File Coupling Across Tasks Tickets touch isolated packages, microservices, or separate Git branches Multiple bug fixes edit the exact same shared helper files (e.g., common.py)
Token Budget vs. Tail Latency You gladly trade a 3x–5x cached token multiplier to cut p95 wait time in half You want the lowest possible Prompt Token bill per resolved bug
Benchmark Reality Check DeepSeek's 300-message test cut p95 latency from 29.5 min to 15.7 min My 8-bug test showed single-session used 80% fewer prompt tokens with 0 merge drops

Giving a Single Agent a subagent Tool Still Fails Under Multi-Task Load

Before splitting an agent system into two layers, the most obvious question any developer asks is: Why not just give one main session a subagent tool and tell it in the system prompt to spawn subagents whenever multiple tasks arrive?

DeepSeek tested that exact setup (Single-session w/ subagent) against three other configurations in a 300-message stream containing ~20 work requests, repeated 5 times:

DeepSeek 5-run ablation benchmark comparing 4 agent architectures

Tested Architecture Median Time (p50) Tail Time (p95) Mean Cached Tokens Observed Behavior Across 5 Runs
Super-agent (Full) 12.4 min 15.7 min 23.23M Router dispatches immediately; Workers execute in parallel
Super-agent w/o direct 12.1 min 16.5 min 31.77M (+37%) Every follow-up comment routes back through Router (+30% Router turns)
Single-session 20.1 min 26.8 min 9.88M Synchronous tool calls block subsequent tasks in the queue
Single-session w/ subagent 19.8 min 29.5 min 10.42M Model invoked the Subagent tool 0 times across all 5 runs

That 0 times result in the bottom row is the single most important systems lesson in the paper. Post-trained coding models have a strong built-in bias to finish tasks inside their own loop rather than paying the tool-call overhead of delegating. Prompting a model to "delegate when appropriate" is a soft instruction that collapses under real workload.

Super-agent turns delegation into a hard architectural boundary by splitting the system into two distinct session types:

Router layer handles routing and outward replies while isolated Worker sessions run tasks concurrently

  • Router Session (src/core/router.ts): Holds global cross-channel memory, triages incoming triggers, creates or updates Tickets, and sends all user-facing messages. Crucially, the Router does not execute coding work—and does not even need a bash tool attached. Because it lacks execution tools, it must dispatch tasks to Workers.
  • Worker Sessions (src/executor/, named worker-<ticket id>): Each Ticket gets an isolated context window, its own working directory, and full bash + file read/write tools. Workers are forbidden from messaging users directly; they report status and Pull Request links back to the Router.

And because a Router turn consists almost entirely of reading incoming event batches and emitting a tiny routing tool call (heavy prefill, tiny decode), queuing multiple triggers during a traffic spike automatically batches them into a single inference pass:

Router prefill batching amortizes per-decision latency as trigger arrival rate increases

When trigger arrival jumps 10x from 6/min (10s interval) to 60/min (1s interval), average batch size grows from 1.1 to 9.8, and amortized inference time per routing decision drops by 75% (from 6.4s down to 1.6s).

Fixing 8 Python Bugs in Parallel Cost 5x More Tokens and Overwrote Half the Changes

In DeepSeek's 300-message ablation test, the coding step itself was mocked with a sleep timer. I wanted to measure what happens when parallel Workers edit real source files and run pytest on a shared repository.

On November 30, 2026, I created a 4-module Python log parser and aggregation repo (logkit) with 11 unit tests and seeded 8 realistic bugs (baseline pytest run: 6 failed, 5 passed). To reflect real maintenance backlogs where multiple issues hit core helpers, I placed 4 bugs in logkit/common.py, 2 in logkit/format.py, and 2 in standalone files (stats.py and parser.py).

I kept the original Chinese task prompts, tool schemas (read_file, write_file, run_tests), and model (deepseek-v4.1-flash) identical across all runs so that any difference came purely from orchestration structure. When running multi-agent scripts that mix DeepSeek, Claude, and Gemini models under one OpenAI-compatible client, I route requests through this base URL:

https://api.crazyrouter.com/v1
Enter fullscreen mode Exit fullscreen mode

Before firing off 8 concurrent Workers, make sure to double-check the exact model identifier string in the Crazyrouter model directory, as gateway model IDs can differ slightly from upstream provider docs.

Here is the head-to-head telemetry from all three orchestration runs:

Metric Mode 1: Single-Session Serial (All 8 Bugs in 1 Session) Mode 2: Single-Ticket Worker (Bug #8 Only) Mode 3: Router + 8 Parallel Workers (1 Router + 8 Workers)
Wall-Clock Duration 40.9 s 26.0 s 93.4 s
Total Prompt Tokens 19,432 9,592 98,616 (5.07x)
Cached Tokens (Prefix Read) 13,696 5,248 61,696 (4.50x)
Completion Tokens 2,798 1,061 15,949 (5.70x)
Total LLM API Calls 7 calls 5 calls 47 calls (1 Router + 46 Worker)
Post-Merge pytest Result 11 passed (100%) 5 failed, 6 passed 3 failed, 8 passed (4 fixes lost)

Two production lessons jump straight out of those numbers:

1. Eight Isolated Workers Used 5x More Prompt Tokens and Ran Slower

Why did 8 parallel Workers consume 98,616 prompt tokens compared to 19,432 in a single serial session? Look at Mode 2: spinning up a fresh Worker to fix just one bug took 9,592 prompt tokens, whereas fixing all 8 bugs in one continuous session averaged 2,429 prompt tokens per bug (a 3.95x cold-start tax). Every isolated Worker has to load the system prompt, tool definitions, and repository files from zero. I inspected the cache-hit breakdown on the real-time API pricing and billing page, and while prefix caching discounts repeated system prompts, firing 47 API turns across 8 workspaces still multiplies total token volume by 5x—and on small bugs that take seconds to patch, workspace cloning plus 47 API round-trips made the parallel run 2.28x slower (93.4s vs. 40.9s).

2. Four Out of Eight Bug Fixes Disappeared After Merging

Each of the 8 Workers passed its own unit test inside its isolated directory. However, when their modified files were merged back into the main workspace in completion order without a git worktree rebase gate, 4 out of 8 bug fixes were silently overwritten:

Worker Target Function Target File Merge Outcome (Completion Order) Post-Merge Unit Test Status
w0 parse_hour logkit/common.py Overwritten by w3 (Lost) PASSED (False Negative—test missed single-digit hour)
w1 pct logkit/common.py Overwritten by w3 (Lost) FAILED test_pct
w2 loose_eq logkit/common.py Overwritten by w3 (Lost) FAILED test_loose_eq
w3 percentile logkit/common.py Kept (Last writer won) PASSED
w4 fmt_duration logkit/format.py Overwritten by w5 (Lost) FAILED test_fmt_duration
w5 fmt_size logkit/format.py Kept (Last writer won) PASSED
w6 slowest logkit/stats.py Kept (Independent file) PASSED
w7 parse_line logkit/parser.py Kept (Independent file) PASSED

Look closely at w0 (parse_hour in logkit/common.py). Its fix was completely wiped out when w3 overwrote common.py a few seconds later—yet pytest only reported 3 failed instead of 4 failed. Why? Because the existing unit test only asserted two-digit hours (09:05:00) and didn't test single-digit hours (9:05:00). Relying on file-level copy-back without Git branch rebase and diff inspection lets overwritten regressions slip through under a green test suite.

Keeping the Agent in Group Chats All Day Without Blowing Up the Context Window

Where Super-agent genuinely shines is keeping a 24/7 background agent from drowning in group-chat noise or context bloat. Four mechanisms handle this in the event pipeline:

  1. Two-Stage Filtering (Fast Path + Slow Path): Programmatic code rules (Fast Path) filter out non-whitelisted senders (allowed), unmonitored repos, and ignored bots in milliseconds for 0 tokens. Only surviving events hit the LLM (Slow Path), which applies natural-language rules—such as rejecting any outbound IM message over 100 words, banning "Got it, checking" filler replies, and capping automated review-bot exchanges at 3 rounds per PR.
  2. Thread Subscription Direct Pass-Through: Once Worker A is assigned to a GitHub PR thread, it subscribes to that Thread ID. Follow-up comments route straight to Worker A without waking the Router—saving 30% of Router turns and 37% of cached tokens (23.23M vs. 31.77M).
  3. Inline vs. Spill Context + Chained Recall: Short summaries and object IDs load Inline, while multi-thousand-line CI logs Spill to disk behind a reference ID. Cross-linked IDs let the model traverse backward (Comment -> Thread -> Worker -> Earlier Thread) on demand.
  4. Speculative Execution + Async ReAct (start() / stop()): Under a "silent reproduction and fix" policy, the Router can quietly spawn a Worker on an unmentioned bug complaint in chat; if the fix is clean, it drops a ready-to-merge PR with screenshots into the chat before humans finish discussing the bug. Meanwhile, async start() / stop() tool interfaces prevent long builds from blocking foreground chat turns.

Two-stage filtering pipeline and Thread subscription direct pass-through

Four Things in the Open-Source Prototype You Should Patch Before Deploying

Walking through the dsh-superagent-prototype codebase and independent November 2026 deployment logs revealed four concrete engineering traps:

Source Module / Mechanism What the Prototype Actually Does Production Fix Required
Default Intake Mode (docs/000-philosophy.md) Defaults to observe mode: unmentioned triggers are evaluated in logs only, zero code edits Keep observe on for the first 72 hours to audit Slow Path false positives before enabling active PRs
GitHub 60s Poller (src/sources/github.ts) Compares Issue created_at against the readNotified cursor; GitHub @mention lag (~20s) causes ~1/3 of Issues to be silently skipped Rewind the readNotified query window by 5 minutes on every poll and deduplicate by Trigger ID
30k-Char Worker Prompt (prompts/worker/) Tells Worker to ask clarifying questions on subjective tasks, but explicitRouted tasks still hallucinate UI specs without asking Do not rely on prompt instructions alone for destructive actions; enforce human PR review gates
Host OS Execution (src/executor/) Runs Router and Workers directly under the current Linux/WSL user without container sandboxing (Windows requires WSL + dedicated GitHub bot account) Run inside an isolated low-privilege Linux user or container; wire up cloud compute decoupling and external Watchdog yourself

The First Two Modules Worth Adopting in Your Own Workflow

You don't need to deploy the entire Super-agent stack at once. If you are building your own internal coding agent workflow, implement these two patterns first:

  • Copy first: Programmatic Fast Path + Semantic Slow Path filtering (cuts ~80% of wasted webhook LLM calls) and Thread Subscription Direct Pass-Through (cuts 37% of routing cached tokens).
  • Hold off until scale demands it: Multi-Worker parallel execution on shared modules—unless your tickets take 10+ minutes each and you have strict git worktree rebase + regression gates wired into your merge pipeline.

Top comments (0)