Install any skill in seconds. Free to start, no credit card required.
Get Started Free →LangGraph parallel execution patterns. Use when implementing fan-out/fan-in workflows, map-reduce over tasks, or running independent agents concurrently.
.claude/skills/majiayu000-langgraph-parallel/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -22% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 71% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 0% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 5% | 0% |
Run independent nodes concurrently for performance.
pythonfrom langgraph.graph import StateGraph def fan_out(state): """Split work into parallel tasks.""" state["tasks"] = [{"id": 1}, {"id": 2}, {"id": 3}] return state def worker(state): """Process one task.""" task = state["current_task"] result = process(task) return {"results": [result]} def fan_in(state): """Combine parallel results.""" combined = aggregate(state["results"]) return {"final": combined} workflow = StateGraph(State) workflow.add_node("fan_out", fan_out) workflow.add_node("worker", worker) workflow.add_node("fan_in", fan_in) workflow.add_edge("fan_out", "worker") workflow.add_edge("worker", "fan_in") # Waits for all workers
pythonfrom langgraph.constants import Send def router(state): """Route to multiple workers in parallel.""" return [ Send("worker", {"task": task}) for task in state["tasks"] ] workflow.add_conditional_edges("router", router)
pythonfrom typing import Annotated from operator import add class AnalysisState(TypedDict): content: str findings: Annotated[list[dict], add] # Accumulates async def run_parallel_agents(state: AnalysisState): """Run multiple agents in parallel.""" agents = [security_agent, tech_agent, quality_agent] # Run all concurrently tasks = [agent.analyze(state["content"]) for agent in agents] results = await asyncio.gather(*tasks, return_exceptions=True) # Filter successful results findings = [r for r in results if not isinstance(r, Exception)] return {"findings": findings}
pythondef map_node(state): """Map: Process each item independently.""" items = state["items"] results = [] for item in items: result = process_item(item) results.append(result) return {"mapped_results": results} def reduce_node(state): """Reduce: Combine all results.""" results = state["mapped_results"] summary = { "total": len(results), "passed": sum(1 for r in results if r["passed"]), "failed": sum(1 for r in results if not r["passed"]) } return {"summary": summary}
pythonasync def parallel_with_isolation(tasks: list): """Run parallel tasks, isolate failures.""" results = await asyncio.gather(*tasks, return_exceptions=True) successes = [] failures = [] for task, result in zip(tasks, results): if isinstance(result, Exception): failures.append({"task": task, "error": str(result)}) else: successes.append(result) return {"successes": successes, "failures": failures}
pythonimport asyncio async def parallel_with_timeout(agents: list, content: str, timeout: int = 30): """Run agents with per-agent timeout.""" async def run_with_timeout(agent): try: return await asyncio.wait_for( agent.analyze(content), timeout=timeout ) except asyncio.TimeoutError: return {"agent": agent.name, "error": "timeout"} tasks = [run_with_timeout(a) for a in agents] return await asyncio.gather(*tasks)
| Decision | Recommendation | |----------|----------------| | Max parallel | 5-10 concurrent (avoid overwhelming APIs) | | Error handling | return_exceptions=True (don't fail all) | | Timeout | 30-60s per branch | | Accumulator | Use Annotated[list, add] for results |
langgraph-state - Accumulating statemulti-agent-orchestration - Coordination patternslanggraph-supervisor - Supervised parallel executionKeywords: fanout, parallel, concurrent, scatter Solves:
Keywords: fanin, gather, aggregate, collect Solves:
Keywords: template, implementation, parallel, agent Solves:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | 13,522 | 12,566 | -7% | 1 | 1 | 0% | 2,133 | 2,730 | +28% | 0 | 0 | — |
case-01 | pass→pass | 11,866 | 10,692 | -10% | 1 | 1 | 0% | 1,346 | 2,362 | +75% | 0 | 0 | — |
case-03 | pass→pass | 6,000 | 10,154 | +69% | 1 | 1 | 0% | 1,157 | 2,249 | +94% | 0 | 0 | — |
case-04 | pass→pass | 14,735 | 7,981 | -46% | 1 | 1 | 0% | 1,971 | 2,930 | +49% | 0 | 0 | — |
case-05 | fail→pass | 11,147 | 2,424 | -78% | 1 | 1 | 0% | 1,937 | 1,650 | -15% | 0 | 0 | — |
case-06 | fail→pass | 18,871 | 3,298 | -83% | 1 | 1 | 0% | 2,329 | 1,826 | -22% | 0 | 0 | — |
case-07 | pass→pass | 18,566 | 20,355 | +10% | 1 | 1 | 0% | 2,387 | 3,561 | +49% | 0 | 0 | — |
case-08 | fail→pass | 27,136 | 7,726 | -72% | 1 | 1 | 0% | 1,607 | 2,740 | +71% | 0 | 0 | — |
case-09 | fail→pass | 18,381 | 11,562 | -37% | 1 | 1 | 0% | 2,560 | 2,548 | -0% | 0 | 0 | — |
case-10 | pass→pass | 18,980 | 19,027 | +0% | 1 | 1 | 0% | 3,194 | 3,727 | +17% | 0 | 0 | — |
case-11 | fail→pass | 15,449 | 5,456 | -65% | 1 | 1 | 0% | 2,153 | 2,257 | +5% | 0 | 0 | — |
case-22 | pass→pass | 20,691 | 12,448 | -40% | 1 | 1 | 0% | 3,019 | 3,568 | +18% | 0 | 0 | — |
case-12 | pass→pass | 12,327 | 5,747 | -53% | 1 | 1 | 0% | 1,564 | 2,458 | +57% | 0 | 0 | — |
case-13 | fail→pass | 9,472 | 9,534 | +1% | 1 | 1 | 0% | 1,837 | 2,051 | +12% | 0 | 0 | — |
case-14 | pass→pass | 15,063 | 6,461 | -57% | 1 | 1 | 0% | 1,988 | 2,368 | +19% | 0 | 0 | — |
case-15 | pass→pass | 14,977 | 13,003 | -13% | 1 | 1 | 0% | 1,941 | 2,687 | +38% | 0 | 0 | — |
case-16 | pass→pass | 10,488 | 9,578 | -9% | 1 | 1 | 0% | 2,111 | 2,162 | +2% | 0 | 0 | — |
case-17 | pass→pass | 13,706 | 9,576 | -30% | 1 | 1 | 0% | 1,578 | 2,052 | +30% | 0 | 0 | — |
case-18 | pass→pass | 24,989 | 21,325 | -15% | 1 | 1 | 0% | 3,438 | 4,040 | +18% | 0 | 0 | — |
case-19 | pass→pass | 12,694 | 7,928 | -38% | 1 | 1 | 0% | 2,254 | 2,584 | +15% | 0 | 0 | — |
case-20 | pass→pass | 11,738 | 4,807 | -59% | 1 | 1 | 0% | 1,387 | 2,188 | +58% | 0 | 0 | — |
case-21 | pass→pass | 19,886 | 12,977 | -35% | 1 | 1 | 0% | 2,787 | 3,879 | +39% | 0 | 0 | — |
case-23 | pass→pass | 13,476 | 12,018 | -11% | 1 | 1 | 0% | 2,785 | 3,468 | +25% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 22 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +26 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.