parallelization
Skill4 starsChanged 8 months agoMITView on GitHub
This skill should be used when the user wants to "run tasks in parallel", "concurrent LLM calls", "fan-out and fan-in", "parallel agents", "simultaneous execution", "reduce latency with concurrency", "parallel sub-tasks", "parallel processing", "concurrent agent execution", "run agents simultaneously", "speed up with parallelism", "async agent execution", "batch LLM calls", "parallel workflow", "parallelize agent tasks", or needs to execute multiple independent tasks simultaneously. Also responds to Korean: "병렬 작업 실행", "동시 LLM 호출", "팬아웃 팬인 패턴", "병렬 에이전트", "동시 실행", "동시성으로 지연 시간 감소", "병렬로 실행", "동시에 여러 작업", "병렬 처리", "동시에 돌려줘", "빠르게 병렬로", "여러 작업 동시 실행해줘". Also responds to Japanese: "並列処理", "同時実行", "並列エージェント", "並行LLM呼び出し", "ファンアウト・ファンイン", "複数タスクを同時に実行したい", "処理速度を上げたい", "非同期エージェント", "バッチ処理", "並列で動かしたい" Also responds to Chinese: "并行处理", "并发执行", "并行智能体", "同时调用多个LLM", "扇出扇入模式", "多任务并行运行", "加快处理速度", "异步智能体", "批量LLM调用", "同时运行多个任务".. Apply this skill to design or implement the Parallelization agentic design pattern.
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- flpbalada/fb-skillstheir own version, first seen Aug 3, 2026
- hajekim/agentic-design-patterns-extensionedited, first seen Apr 1, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- hajekim/agentic-design-patterns-extension★ 1100% same
Wrote their own version · 1
- flpbalada/fb-skills★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- a2aSkill
- appendix-agentic-frameworksSkill
- appendix-agentspaceSkill
- appendix-ai-cliSkill
- appendix-coding-agentsSkill
- appendix-gui-agentsSkill
- appendix-prompt-engineeringSkill
- appendix-reasoning-enginesSkill
- evaluationSkill
- exception-handlingSkill
- explorationSkill
- goal-settingSkill
- guardrailsSkill
- human-in-the-loopSkill
- learning-adaptationSkill
- mcp-setupSkill
- memory-managementSkill
- multi-agent-collaborationSkill
- planningSkill
- prioritizationSkill
- prompt-chainingSkill
- ragSkill
- reasoningSkill
- reflectionSkill
- resource-awareSkill
- routingSkill
- tool-useSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Rule of thumb: If Step B doesn't need Step A's output to begin, run them simultaneously.
- Distinctive: line 46
Use async/await, threading, or framework-native parallel execution primitives
- Distinctive: line 48
Use synchronization primitives (gather, join, await all) to collect results
- Distinctive: line 267
Independence is key: Only parallelize truly independent tasks — don't force concurrency on dependent steps
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parallelization Pattern
Overview
The Parallelization Pattern enables multiple components — LLM calls, tool invocations, or entire sub-agents — to execute simultaneously rather than sequentially. By identifying parts of a workflow that are independent of each other, this pattern dramatically reduces total execution time and increases system throughput.
Core Principle: Identify independence — run what doesn't depend on each other at the same time, then synchronize results.
When This Skill Applies
Activate this pattern when:
- Multiple sub-tasks can be performed independently (no data dependency between them)
- External services (APIs, databases) introduce latency that can be overlapped
- The same task must be performed on multiple data items independently
- Throughput and speed are critical system requirements
- A workflow has a natural fan-out (distribute) → fan-in (aggregate) structure
Rule of thumb: If Step B doesn't need Step A's output to begin, run them simultaneously.
DEFINE → PLAN → ACTION Workflow
DEFINE
Identify the parallelism opportunities:
- Which sub-tasks have no data dependency on each other?
- Which steps interact with external services (API calls, database queries, searches)?
- Where does the workflow have a natural fan-out structure?
- What synchronization point (fan-in) collects all parallel results?
PLAN
Design the parallel architecture:
- Map the dependency graph — which nodes can run concurrently?
- Define the fan-out: distribute tasks to parallel workers/agents
- Define the fan-in: collect and aggregate results from all parallel branches
- Identify which subsequent steps are sequential (depend on aggregated results)
- Plan error handling: what happens if one parallel branch fails?
ACTION
Implement parallel execution:
- Use async/await, threading, or framework-native parallel execution primitives
- Launch all independent tasks concurrently
- Use synchronization primitives (gather, join, await all) to collect results
- Pass aggregated results to the sequential continuation step
- Monitor and handle partial failures gracefully
Core Parallel Patterns
Fan-Out / Fan-In (Map-Reduce)
The fundamental parallelization structure:
┌─ Worker A ─┐
Input → Fan-Out ├─ Worker B ─┤ → Fan-In → Aggregate → Output
└─ Worker C ─┘Sequential (slow):
Search A → Summarize A → Search B → Summarize B → SynthesizeParallel (fast):
Search A + Search B (simultaneously)
→ Summarize A + Summarize B (simultaneously)
→ Synthesize (sequential — depends on both summaries)Parallel Sectioning
Different agents handle different sections of the same document or task simultaneously:
Document → [Section 1 Agent || Section 2 Agent || Section 3 Agent] → CombineParallel Voting / Consensus
Multiple agents independently solve the same problem; results are aggregated:
Query → [Agent 1 response || Agent 2 response || Agent 3 response]
→ Majority vote or best-of-N selectionParallel Tool Calls
Multiple external API/database calls issued simultaneously:
User request → [Weather API || Calendar API || News API] → SynthesizePractical Use Cases
Research & Synthesis
# Instead of sequential searches:
parallel_tasks = [
search_web("topic A"),
search_database("topic B"),
search_documents("topic C")
]
results = await asyncio.gather(*parallel_tasks)
final_report = synthesize(results)Multi-Source Document Analysis
Report → Chunk into sections →
[Section 1 Analyzer || Section 2 Analyzer || ... || Section N Analyzer]
→ Aggregate findings → Final analysisEvaluation Pipeline
Model response →
[Accuracy Evaluator || Relevance Evaluator || Safety Evaluator || Tone Evaluator]
→ Combined evaluation scoreMulti-Language Processing
Content →
[English Translator || Spanish Translator || French Translator || German Translator]
→ Multi-language outputImplementation with Google ADK
ADK Parallel Sub-Agents
from google.adk.agents import LlmAgent, ParallelAgent
from google.adk.tools import FunctionTool
def search_web(query: str) -> str:
"""Search the web for information."""
return f"Web results for: {query}"
def search_database(query: str) -> str:
"""Search internal database."""
return f"Database results for: {query}"
def search_documents(query: str) -> str:
"""Search document store."""
return f"Document results for: {query}"
# Parallel worker agents
web_agent = LlmAgent(
name="WebSearcher",
model="gemini-2.5-flash",
tools=[FunctionTool(search_web)]
)
db_agent = LlmAgent(
name="DatabaseSearcher",
model="gemini-2.5-flash",
tools=[FunctionTool(search_database)]
)
doc_agent = LlmAgent(
name="DocumentSearcher",
model="gemini-2.5-flash",
tools=[FunctionTool(search_documents)]
)
# ParallelAgent runs all sub-agents simultaneously
parallel_searcher = ParallelAgent(
name="ParallelResearcher",
sub_agents=[web_agent, db_agent, doc_agent]
)
# Synthesizer processes all parallel results
synthesizer = LlmAgent(
name="Synthesizer",
model="gemini-2.5-flash",
instruction="Synthesize the research findings from multiple sources into a coherent report."
)Python asyncio Implementation
import asyncio
from google import genai
client = genai.Client()
async def analyze_section(section: str, section_id: int) -> dict:
"""Analyze a document section asynchronously."""
prompt = f"Analyze the following section and extract key insights:\n\n{section}"
response = await asyncio.get_event_loop().run_in_executor(
None, lambda: client.models.generate_content(model='gemini-2.5-flash', contents=prompt)
)
return {"section_id": section_id, "analysis": response.text}
async def parallel_document_analysis(document: str) -> str:
"""Analyze document sections in parallel."""
# Split document into independent sections
sections = document.split("\n\n")
# Launch all section analyses simultaneously
tasks = [analyze_section(section, i) for i, section in enumerate(sections)]
results = await asyncio.gather(*tasks)
# Sequential synthesis step (depends on all parallel results)
all_analyses = "\n".join([r["analysis"] for r in results])
synthesis_prompt = f"Synthesize these section analyses:\n\n{all_analyses}"
final_response = client.models.generate_content(model='gemini-2.5-flash', contents=synthesis_prompt)
return final_response.text
# Run parallel analysis
result = asyncio.run(parallel_document_analysis(large_document))LangGraph Parallel Nodes
from langgraph.graph import StateGraph, START, END
from typing import TypedDict, List
import asyncio
class ResearchState(TypedDict):
query: str
web_results: str
db_results: str
final_report: str
# Define parallel worker functions
async def web_search_node(state: ResearchState) -> dict:
result = await search_web(state["query"])
return {"web_results": result}
async def db_search_node(state: ResearchState) -> dict:
result = await search_database(state["query"])
return {"db_results": result}
def synthesize_node(state: ResearchState) -> dict:
# This runs AFTER both parallel nodes complete
report = synthesize(state["web_results"], state["db_results"])
return {"final_report": report}
# Build graph with parallel branches
graph = StateGraph(ResearchState)
graph.add_node("web_search", web_search_node)
graph.add_node("db_search", db_search_node)
graph.add_node("synthesize", synthesize_node)
# Fan-out: both nodes start simultaneously from START
graph.add_edge(START, "web_search")
graph.add_edge(START, "db_search")
# Fan-in: synthesize waits for both
graph.add_edge("web_search", "synthesize")
graph.add_edge("db_search", "synthesize")
graph.add_edge("synthesize", END)Performance Considerations
| Scenario | Sequential Time | Parallel Time | Speedup |
| 3 API calls (1s each) | 3s | ~1s | 3x |
| 5 document sections | 5s | ~1s | 5x |
| 4 translation tasks | 4s | ~1s | 4x |
| N independent tasks | N * t | ~t | Nx |
Key Takeaways
- Independence is key: Only parallelize truly independent tasks — don't force concurrency on dependent steps
- Fan-out + Fan-in: The fundamental structure is distribute → execute concurrently → aggregate
- Latency reduction: Particularly effective for I/O-bound tasks (API calls, DB queries, web searches)
- Framework support: Google ADK's
ParallelAgent, Python'sasyncio.gather(), and LangGraph's parallel nodes - Sequential finalization: The synthesis/aggregation step after parallel work is typically sequential
- Error resilience: Plan for partial failure — use
asyncio.gather(return_exceptions=True)or similar
Anti-Patterns to Avoid
- False parallelism: Parallelizing steps that have hidden dependencies causes race conditions
- Ignoring rate limits: Concurrent API calls may hit rate limits — implement throttling
- No error handling: A single failing parallel branch shouldn't crash the entire workflow
- Over-parallelizing: Very short tasks may not benefit from parallelization overhead
Related Skills
Combine this skill with others for common scenarios:
| Scenario | Skills to Combine |
| High-throughput multi-agent research | Parallelization + Multi-Agent Collaboration |
| Cost-optimized parallel execution | Parallelization + Resource-Aware + Prioritization |
| Parallel tool calls with error handling | Parallelization + Exception Handling + Tool Use |
| Fan-out planning with synthesis | Parallelization + Planning + Reflection |
References
- Google ADK ParallelAgent: https://google.github.io/adk-docs/agents/workflow-agents/
- Python asyncio Documentation: https://docs.python.org/3/library/asyncio.html
- LangGraph Parallel Execution: https://langchain-ai.github.io/langgraph/
- Crew AI Parallel Tasks: https://docs.crewai.com/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

