AgentDyneAgentDyne
MarketplaceIntegrationsBuildDocsBlogPricing
Back to Blog
Engineering 10 min read May 7, 2026

Parallel Agent Swarms: Why Promise.allSettled Is the New Async/Await for AI

Sequential pipelines waste wall-clock time. We explain the DAG-based parallelism engine behind AgentDyne Pipelines, how we detect branch nodes, and why continue_on_failure changes the error calculus entirely.

PS

Priya Sharma

Head of Engineering, AgentDyne

The Sequentiality Problem

Most pipeline systems run agents sequentially: Step 1 completes, then Step 2 begins. This is fine for pipelines where each step depends on the previous step's output.

It is catastrophic for pipelines with independent branches.

Consider a due diligence pipeline:

Input: Company name + filing documents

Step 1: Document Parser            (30s) — must run first
Step 2: Financial Analyser         (45s) — needs parsed docs
Step 3: Legal Risk Scanner         (40s) — needs parsed docs (independent of Step 2)
Step 4: Market Research Agent      (35s) — needs only company name (independent of Steps 2+3)
Step 5: Summary Generator          (20s) — needs Steps 2, 3, 4

Sequential total:  30 + 45 + 40 + 35 + 20 = 170 seconds
Parallel total:    30 + max(45, 40, 35) + 20 = 95 seconds  (44% faster)

The DAG Engine

AgentDyne Pipelines are modelled as a Directed Acyclic Graph (DAG). Each node is an agent execution. Each edge is a data dependency.

The parallel execution algorithm:

1. Topological sort — determine valid execution order
2. Compute in-degree for every node
3. Find all nodes with in-degree = 0 after previous wave completes
   → these are the ready-to-run parallel candidates
4. Launch all candidates simultaneously with Promise.allSettled()
5. When wave completes, decrement in-degree for downstream nodes
6. Repeat from step 3
// Simplified parallel wave executor
async function executeDAG(nodes: PipelineNode[], edges: Edge[]) {
  const inDegree = computeInDegree(nodes, edges)
  const results  = new Map<string, NodeResult>()

  while (results.size < nodes.length) {
    // Find all nodes whose dependencies are satisfied
    const ready = nodes.filter(n =>
      !results.has(n.id) &&
      inDegree.get(n.id) === 0
    )

    if (ready.length === 0) throw new Error('DAG cycle detected')

    // Execute this wave in parallel
    const wave = await Promise.allSettled(
      ready.map(node => executeNode(node, results))
    )

    // Record results and decrement downstream in-degrees
    wave.forEach((outcome, i) => {
      const node = ready[i]
      results.set(node.id, outcome.status === 'fulfilled'
        ? { status: 'success', output: outcome.value }
        : { status: 'failed', error: outcome.reason, node }
      )
      getDownstream(node.id, edges).forEach(d =>
        inDegree.set(d, (inDegree.get(d) ?? 1) - 1)
      )
    })
  }
  return results
}

Why Promise.allSettled, Not Promise.all

This distinction is critical.

Promise.all rejects immediately if any promise fails. In an agent pipeline, this means a single flaky node cancels the entire wave — including nodes that completed successfully and whose work is lost.

Promise.allSettled waits for all promises to settle (fulfilled or rejected). This enables:

•continue_on_failure — nodes marked optional do not block downstream nodes that don't depend on them
•Partial results — a Summary Generator can work with the outputs of Steps 2 and 4 even if Step 3 failed, if Step 3 is optional in the schema
•Accurate error reporting — every node's outcome is recorded, not just the first failure

Real Performance Data

Across the first 30 days after enabling parallel execution on AgentDyne Pipelines:

Pipeline typeBefore (sequential)After (parallel)Improvement
Due diligence (5 nodes)174s P5097s P5044% faster
Content pipeline (4 nodes)112s P5068s P5039% faster
Data enrichment (6 nodes)231s P50118s P5049% faster
Linear pipeline (3 nodes)89s P5091s P50~flat (expected)

Linear pipelines (where every node depends on the previous) show no improvement — as expected. The gains are entirely from parallelising independent branches.

Designing for Parallelism

To get the most from parallel execution, structure your pipeline to minimise artificial dependencies:

1.Fan out early — put the document parser or input preprocessor as Step 1, then branch immediately
2.Minimise shared mutable state — each node should only depend on explicit input edges, not side effects
3.Mark optional nodes — use continue_on_failure: true on research/enrichment nodes that would block otherwise
4.Fan in late — the aggregator or summary node should be the last step, collecting all branches

The parallel agent swarm is not a futuristic concept. It is a DAG with a good scheduler. Build pipelines that way from the start.

More in Engineering

Engineering9 min

RAG Without the Hallucinations: Building Grounded Agents

April 7, 2026

Engineering11 min

Multi-Agent Pipelines in Production: Lessons from 10,000 Runs

March 31, 2026

All articles
AgentDyne

Build once. Sell everywhere. The execution-grade marketplace where AI microagents go to production.

Product

  • Marketplace
  • Integrations
  • Builder Studio
  • Pricing
  • Changelog

Developers

  • Documentation
  • API Reference
  • SDKs
  • MCP Servers
  • Status

Company

  • About
  • Blog
  • Careers
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Security

© 2026 AgentDyne, Inc. All rights reserved.

All systems operational
v2.0.0Changelog