p-limit
Run multiple promise-returning functions with limited concurrency. p-limit creates a concurrency limiter that ensures only a specified number of async operations run simultaneously. Essential for agent systems that make many parallel API calls but need to respect rate limits — process 1000 items with max 10 concurrent requests.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local utility library — no network access or credentials. Zero security concerns.
⚡ Reliability
Best When
You need to process many promises with a concurrency limit — the simplest solution for 'max N parallel requests' in JavaScript.
Avoid When
You need RPS rate limiting, priority ordering, or persistent job queuing — use p-queue or bottleneck respectively.
Use Cases
- • Limit concurrent LLM API calls in agent batch processing pipelines to avoid rate limit errors
- • Process large datasets in agent workflows with controlled parallelism to prevent memory exhaustion
- • Batch embed documents in agent knowledge base builders with concurrency limits matching API rate limits
- • Scrape multiple URLs in agent data pipelines with controlled parallelism to respect robots.txt limits
- • Make N concurrent API requests in agent orchestrators that need results from many external services
Not For
- • Priority queuing — p-limit is FIFO; use p-queue for priority-based queuing
- • Rate limiting per second (RPS) — p-limit controls concurrency, not request rate; use bottleneck for RPS control
- • Work queues that survive process restarts — p-limit is in-memory only
Interface
Authentication
Local utility library — no authentication.
Pricing
Completely free and open source.
Agent Metadata
Known Gotchas
- ⚠ p-limit v6+ is ESM-only — requires import syntax; CJS require() is not supported without dynamic import()
- ⚠ The limit function wraps a function, not a promise — wrap the function that returns a promise, not the promise itself
- ⚠ Failed promises count as completed slots — a rejected promise frees a concurrency slot; no special handling needed for errors
- ⚠ p-limit doesn't retry failed requests — combine with p-retry if you need automatic retry with concurrency control
- ⚠ All queued items accumulate in memory — queuing millions of items creates memory pressure; batch your input instead of queuing everything at once
- ⚠ Concurrency limit is per-limiter-instance — create separate limiters for different rate-limit groups (e.g., one per API endpoint with different limits)
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for p-limit.
Scores are editorial opinions as of 2026-03-06.