CLI ToolsApr 8, 2026·2 min read

Claude Swarm — Multi-Agent Orchestration with SDK

Python-based multi-agent orchestration built on Claude Agent SDK. Opus decomposes tasks, Haiku workers execute in parallel waves with real-time TUI dashboard and budget control.

TL;DR
Claude Swarm decomposes tasks with Opus and executes them in parallel Haiku workers.
§01

What it is

Claude Swarm is a Python-based multi-agent orchestration system built on the Claude Agent SDK. It uses a hierarchical architecture where Claude Opus decomposes complex tasks into subtasks, and Claude Haiku workers execute them in parallel waves. It includes a real-time TUI dashboard for monitoring agent progress and budget control to cap API spending.

Claude Swarm targets developers building AI-powered automation that requires decomposing large problems into parallelizable units of work. Instead of one long-running agent, you get a coordinated team with visibility into cost and progress.

§02

Why it saves time or tokens

A single large-context agent call processes everything sequentially and burns tokens on the full context window. Claude Swarm splits work across smaller, focused agents that each handle a narrow subtask with minimal context. Parallel execution reduces wall-clock time. Budget control prevents runaway costs by capping total spending across all agents.

§03

How to use

  1. Install Claude Swarm from the repository
  2. Define your task decomposition strategy and worker roles
  3. Run the swarm with a task description and budget limit
§04

Example

from claude_swarm import Swarm, Task

swarm = Swarm(
    orchestrator_model='claude-opus-4-20250514',
    worker_model='claude-haiku-3',
    max_budget_usd=5.00,
    max_parallel_workers=4
)

result = swarm.run(
    task='Analyze the top 10 Python web frameworks. '
         'For each, summarize features, performance, '
         'and community size.',
    output_format='markdown_table'
)

print(result.output)
print(f'Total cost: ${result.total_cost:.2f}')
ComponentRole
Orchestrator (Opus)Decompose task into subtasks
Workers (Haiku)Execute subtasks in parallel
TUI DashboardReal-time progress monitoring
Budget ControllerCap spending across all agents
Result MergerCombine worker outputs
§05

Related on TokRepo

§06

Common pitfalls

  • Task decomposition quality depends on the orchestrator model; vague task descriptions produce poor subtask splits
  • Parallel workers sharing state requires careful coordination; design subtasks to be independent whenever possible
  • Budget limits that are too tight may terminate the swarm before completing all subtasks; estimate costs before setting limits

Frequently Asked Questions

What models does Claude Swarm use?+

Claude Swarm uses Claude Opus as the orchestrator for task decomposition (requires strong reasoning) and Claude Haiku as workers for parallel execution (fast and cheap). You can configure different model combinations based on your cost and quality requirements.

How does budget control work?+

Claude Swarm tracks token usage and estimated cost across all agent calls. You set a maximum budget in USD when creating the swarm. If the cumulative cost approaches the limit, the swarm stops spawning new workers and returns partial results with a budget warning.

Can Claude Swarm handle coding tasks?+

Yes. Claude Swarm can decompose coding tasks like 'review all files in this directory' into per-file worker tasks. Each worker reviews one file and returns findings. The orchestrator merges the results. This pattern works for code review, refactoring, documentation, and analysis tasks.

What is the TUI dashboard?+

The TUI (terminal user interface) dashboard shows real-time progress of all active workers, their status (pending, running, complete), token usage per worker, and cumulative cost. It provides visibility into the swarm without reading raw logs.

How does Claude Swarm differ from CrewAI?+

CrewAI defines agents with roles and tasks declaratively. Claude Swarm focuses on automated task decomposition and parallel execution with budget control. CrewAI is more flexible for custom agent interactions. Claude Swarm is more opinionated about the orchestrator-worker pattern and cost management.

Citations (3)
🙏

Source & Thanks

Created by affaan-m. Licensed under MIT.

affaan-m/claude-swarm

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets