Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Parallel LLM calls and merging

Runs one AI call per item in parallel within rate limits and merges the results, so big batches finish cleanly.

What we improved

Fixed a wrong claim: the original said `asyncio.gather` with `return_exceptions=False` cancels the other tasks on the first error. It does not; the other calls keep running and keep billing. Abort-all now uses `asyncio.TaskGroup`, which doe

Improved by YourAISkill from the original by agentsope, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.

Claude's review

8/10 Strong fan-out protocol with concurrency math from RPM and TPM, failure policies, correct asyncio, LangGraph Send and retry gotchas, and worked dilemma cases.

We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.

In detail

Decision protocol for the map-reduce / dynamic fan-out pattern in LM pipelines — "given list L, run f(item) for each item in parallel, then combine". Activates when the coder agent is about to process N items with N LM calls (per-doc summarize, per-query retrieve, per-candidate rank, parallel tool fan-out). Encodes the *when*, *how many at once*, *what to do when one fails*, and *how to reduce* — not the API of any single framework. Cross-framework: LangGraph `Send`, CrewAI parallel tasks / Flow, `asyncio.gather`, `ThreadPoolExecutor`, LlamaIndex batch retrieval.

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: agentsop-map-reduce-fanout
version: 0.1.0
description: "Decision protocol for map-reduce and dynamic fan-out in LLM pipelines: run f(item) over a list in parallel, then combine the results. Use when code is about to make one LLM, retrieval or tool call per item (summarise each document, score each candidate, multi-query retrieval, self-consistency voting, parallel agents), when an asyncio.gather or thread pool loop is hitting 429s, hangs or runaway cost, or when LangGraph Send workers raise InvalidUpdateError. Covers whether to fan out at all, sizing the concurrency cap from RPM, TPM and latency, choosing a failure policy (abort, best effort, retry then skip, quorum), timeouts, picking the reducer (concatenate, summarise, vote, rank, tree reduce) and sanity checks on the merged result, with working patterns for asyncio, ThreadPoolExecutor, LangGraph Send, CrewAI and LlamaIndex query fusion."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by agentsope. See CHANGES.md. -->

# Map-Reduce / Dynamic Fan-Out: SOP

> Pattern: `results = reduce(combine, parallel_map(f, L))` where `f` is one
> or more LM calls. The *only* reason to fan out is that latency or
> throughput matters more than the cost of doing it. The *only* reason to
> fan in is that the consumer wants one answer, not N.

## 1. When to activate

Activate when **any** of these is true:

- The task is "for each X, do Y" (or the code is about to be
  `for item in items: result = llm(item)`), the items are independent, and Y
  is an LM call, a retriever hit or another I/O step over about 100 ms.
- The code already uses `asyncio.gather`, `ThreadPoolExecutor`, `Send(...)`
  or `crew.kickoff_for_each(...)` and the question is how to use them safely.
- The user mentions: summarise N docs, rank top-K candidates, vote across M
  samples or models, ensemble, parallel agents, multi-query retrieval,
  scatter-gather, fan out.
- A LangGraph graph raises `InvalidUpdateError` on a key that parallel
  branches write to.
- A fan-out is causing 429 storms, or one stuck item holds up the batch.

Do **not** activate when:

- N is statically 1 or 2. Write the calls inline.
- Items depend on each other (reasoning that carries across docs). Fan-out
  silently drops the dependency.
- One batched request does the job (embedding 100 strings in one call, a
  reranker that takes a list). That is batching, not map-reduce, and cheaper.

## 2. Core mental model

...

From agentsope's repository, MIT licence.

Related skills

  • Checked

    Neuron AI RAG

    Adds RAG to PHP apps with Neuron AI vector stores, embeddings and loaders so AI answers from your documents.

    by neuron-core 2.2k
    7/101 credit
  • Checked

    LlamaIndex RAG tuning

    Builds and tunes LlamaIndex retrieval with working evals, so answers get better one measured step at a time.

    by agentsope 513
    8/101 credit
  • Checked

    Multi tenant RAG security

    Enforces filtering at the vector store query in shared RAG systems, with a gate test, so tenants stay apart.

    by agentsope 513
    7/101 credit
  • Checked

    pgvector semantic search

    Sets up pgvector in PostgreSQL with HNSW indexes and filters, so RAG and semantic search return fast.

    by timescale 1.9k
    8/101 credit
  • Checked

    RAG reindexing safety

    Makes RAG ingestion safe to rerun, so reindexing stops leaving duplicate or deleted documents in results.

    by agentsope 513
    7/101 credit
  • Checked

    LanceDB Vector Search

    Adds local vector and keyword search to your app with LanceDB, with no database server to run.

    by TerminalSkills 221
    8/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added