Architecture
11 min readUpdated: October 2026

Multi-Agent Orchestration in TypeScript: Parallel & Sequential Subagent Patterns

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Multi-Agent Orchestration in TypeScript: Parallel & Sequential Subagent Patterns: Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways

Running Agents in Parallel

Use Promise.all to run multiple agent instances concurrently. Each instance maintains its own session, tool execution log, and context window:

parallel-agents.tstypescript
import { createAgent } from 'smoke-monkey-harness';
const modules = ['auth', 'payments', 'notifications', 'analytics'];
// Spawn one agent per module — all run concurrently
const results = await Promise.all(
modules.map((module) =>
createAgent({
provider: 'anthropic',
model: 'claude-3-7-sonnet',
workspacePath: `./src/${module}`,
autoApprove: true,
}).run(`Audit ${module} module for security vulnerabilities. Output JSON.`)
)
);
// Aggregate findings
const allFindings = results.flatMap((r) => JSON.parse(r.output));
console.log(`Found ${allFindings.length} total findings across ${modules.length} modules`);

The Supervisor-Worker Pattern

In this pattern, a supervisor agent analyzes the codebase and decomposes the task into subtasks. Worker agents then execute each subtask independently:

  1. Supervisor reads the repository structure and generates a task plan as JSON.
  2. Orchestrator parses the plan and spawns one worker agent per task.
  3. Workers execute their task autonomously in isolated workspace sub-paths.
  4. Supervisor is called again with all worker outputs to synthesize the final result.

This pattern scales to large codebases because no single context window needs to hold the entire codebase.

Use isolated workspace paths for workers

Give each worker agent a workspacePath scoped to its assigned module to prevent concurrent file write conflicts.

Google Search Questions & Answers

Frequently Asked Questions

Q:How many parallel agents can I run without hitting rate limits?

This depends on your LLM provider tier. For Anthropic Claude, the Tier 4 plan supports up to 4,000 requests per minute. Use Promise.allSettled with concurrency limiting (e.g., p-limit) for large-scale orchestration.

Q:Can agents communicate with each other directly?

Currently agents communicate via structured output files in the shared workspace. A supervisor agent can read the output files written by worker agents and use them as context for synthesis.

Related Alternatives & Comparisons

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness