Use when running parallel AI workers for any long-running or multi-turn batch API task. Auto-calculates optimal workers + stagger. Supports tiered delegation (V4 Pro orchestrator → V4 Flash workers). 99.95% API success rate at scale.
Spawn N parallel API workers for any long-running or multi-turn batch task. Auto-calculates optimal worker count and stagger delay. Supports tiered model delegation: orchestrator plans with a frontier model (V4 Pro), workers execute with a cheaper model (V4 Flash).
DeepSwarm 2.0 generalizes the proven orchestration pattern from the 19,331-trace generation project to any batch API task. You define a task — translations, reasoning traces, code reviews, summarization — and DeepSwarm parallelizes it across optimal workers with the right stagger for your API.
The core insight: API rate limits are a function of simultaneous connections, not total volume. Auto-calculated stagger + worker count = 99.95% success.
Don't use for:
delegate_task)# Install
hermes skills tap add amanning3390/deepswarm
# Define your task (task.yaml)
# Generate seeds
python3 scripts/seed.py --task task.yaml
# Launch — auto-optimizes workers, stagger, model routing
python3 scripts/swarm.py --task task.yaml --total 1000
# Filter — repair JSON, validate structure, apply length thresholds
python3 scripts/filter.py --input-dir output/ --output clean.jsonl --errors errors.jsonl
# What to do
task_type: generation # generation | translation | summarization | custom
prompt_template: |
You are an AI assistant. {{seed}}
# Model routing (tiered delegation)
orchestrator_model: deepseek-v4-pro # Plans, monitors, handles errors
worker_model: deepseek-v4-flash # Executes batches (cheaper!)
worker_api_base: https://api.deepseek.com/v1/chat/completions
worker_max_tokens: 4096
# Execution control
multi_turn: true # Workers loop through conversation turns
max_turns: 20 # Max turns per worker conversation
seeds_file: seeds.jsonl # Pre-generated task seeds
# Worker optimization (auto-calculated if omitted)
workers: auto # auto | N
stagger: auto # auto | seconds
batch_size: auto # auto | tasks per worker
# Output
output_dir: output/
output_format: jsonl # jsonl | json | parquet
checkpoint_every: 10 # Save progress every N tasks
# Optional: custom worker logic
worker_script: custom_worker.py # Override default worker behavior
Orchestrator (V4 Pro) and workers (V4 Flash) can use different models:
User Task → V4 Pro (plans, monitors)
├─ V4 Flash Worker 0 → API → output/
├─ V4 Flash Worker 1 → API → output/
├─ V4 Flash Worker 2 → API → output/
└─ ...
Why tiered delegation matters:
When to use same model for both:
When workers: auto and stagger: auto:
min(8, floor(rate_limit / call_duration))call_duration / workers × 2total / workersCalibration table (pre-computed):
| Call Duration | Workers | Stagger | Success | Throughput | |--------------|---------|---------|---------|------------| | <10s | 16 | 1s | 99.9% | ~5,760/hr | | 10-30s | 12 | 2s | 99.9% | ~1,440/hr | | 30-60s | 8 | 5s | 99.95% | ~440/hr | | 60-90s | 6 | 10s | 99.9% | ~240/hr | | >90s | 4 | 15s | 99.9% | ~96/hr |
For tasks requiring conversation loops (generation, debugging, interactive work):
Worker loop:
for each seed:
messages = [system_prompt, user_task]
for turn in range(max_turns):
response = api_call(messages, model=worker_model)
messages.append({"role": "assistant", "content": response})
if task_complete(response):
break
if needs_tool_call(response):
messages.append(simulate_tool_response(response))
Each turn is an independent API call. Multi-turn tasks benefit most from parallelization because per-task latency is high.
The worker (worker.py) accepts a YAML task definition and executes any pipeline:
def run_task(seed, config):
messages = build_messages(seed, config)
for turn in range(config["max_turns"]):
response = call_api(messages, config)
if is_complete(response, config):
return finish(response, messages)
if needs_continuation(response, config):
messages = append_turn(messages, response, config)
return messages
Built-in task types:
generation — Generate content from seed (the trace generation pattern)translation — Translate each seed textsummarization — Summarize each seed documentclassification — Classify each seed inputcustom — Uses worker_script for completely custom logicworkers: auto choosing too many. If calibration call was fast but actual calls are slow, override manually.& without wait. Without wait, shell exits early and kills child workers.workers: auto or manual count ≤ 8 per batchstagger: auto or manual ≥ call_duration / workers × 2Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/deepswarm · pinned to the source commit
git clone https://github.com/amanning3390/deepswarm.git
cd deepswarm
git checkout 614d635bc06f643f150d58d07c1beb823a5f3dad
mkdir -p ".claude/skills/deepswarm"
cp -r . ".claude/skills/deepswarm"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 614d635bc06f. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
No static rules matched. This is not a safety guarantee.