/brightdata-pack:brightdata-rate-limitsfrom brightdata-pack
Implements Bright Data rate limiting, exponential backoff, and idempotency patterns. Handles per-zone concurrent limits and retry logic for proxy, SERP, and Web Scraper APIs.
Ships in brightdata-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Handle Bright Data rate limits and concurrent request limits. Unlike traditional API rate limits, Bright Data limits are per-zone and based on concurrent connections and requests per second. The Web Scraper API trigger endpoint is limited to 20 requests/min and 60 requests/hour.
| Product | Concurrent Limit | Per-Minute | Notes |
|---|---|---|---|
| Residential Proxy | Based on plan | No hard cap | Charged per GB |
| Web Unlocker | Based on plan | No hard cap | Charged per request |
| Scraping Browser | Based on plan sessions | No hard cap | Charged per session |
| SERP API | Based on plan | No hard cap | Charged per search |
| Web Scraper API (trigger) | N/A | 20/min, 60/hr | Async collections |
| Datasets API | N/A | 20/min | Snapshot requests |
// src/brightdata/limiter.ts
import PQueue from 'p-queue';
// Match concurrency to your Bright Data plan limits
const scrapeQueue = new PQueue({
concurrency: 10, // Max concurrent proxy requests
interval: 1000, // Per second
intervalCap: 20, // Max 20 requests per second
timeout: 120000, // Kill after 2 min
throwOnTimeout: true,
});
export async function queuedScrape(url: string): Promise<string> {
return scrapeQueue.add(async () => {
const client = getBrightDataClient();
const response = await client.get(url);
return response.data;
});
}
// Monitor queue health
scrapeQueue.on('active', () => {
console.log(`Queue: ${scrapeQueue.size} waiting, ${scrapeQueue.pending} active`);
});
// src/brightdata/backoff.ts
export async function scrapeWithBackoff(
url: string,
config = { maxRetries: 5, baseDelay: 2000, maxDelay: 60000 }
): Promise<string> {
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
try {
const client = getBrightDataClient();
const response = await client.get(url);
return response.data;
} catch (error: any) {
const status = error.response?.status;
const luminatiError = error.response?.headers?.['x-luminati-error'];
// Only retry on transient errors
const retryable = [502, 503, 429].includes(status)
|| error.code === 'ETIMEDOUT'
|| luminatiError === 'ip_banned';
if (attempt === config.maxRetries || !retryable) throw error;
const delay = Math.min(
config.baseDelay * Math.pow(2, attempt) + Math.random() * 1000,
config.maxDelay
);
console.log(`[${luminatiError || status}] Retry ${attempt + 1} in ${delay.toFixed(0)}ms`);
await new Promise(r => setTimeout(r, delay));
}
}
throw new Error('Unreachable');
}
// src/brightdata/trigger-limiter.ts — 20/min, 60/hr for trigger endpoint
const triggerQueue = new PQueue({
concurrency: 1,
interval: 60000, // Per minute
intervalCap: 20, // 20 triggers per minute
});
let hourlyCount = 0;
setInterval(() => { hourlyCount = 0; }, 3600000); // Reset hourly
export async function rateLimitedTrigger(
datasetId: string,
urls: string[]
): Promise<any> {
if (hourlyCount >= 55) { // Leave buffer
throw new Error('Approaching hourly trigger limit (60/hr). Wait before triggering.');
}
return triggerQueue.add(async () => {
hourlyCount++;
const response = await fetch(
`https://api.brightdata.com/datasets/v3/trigger?dataset_id=${datasetId}&format=json`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BRIGHTDATA_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(urls.map(url => ({ url }))),
}
);
return response.json();
});
}
// Instead of triggering per-URL, batch into single triggers
async function batchTrigger(urls: string[], batchSize = 100) {
const batches = [];
for (let i = 0; i < urls.length; i += batchSize) {
batches.push(urls.slice(i, i + batchSize));
}
console.log(`Triggering ${urls.length} URLs in ${batches.length} batches`);
for (const batch of batches) {
await rateLimitedTrigger('gd_dataset_id', batch);
}
}
| Signal | Meaning | Action |
|---|---|---|
| HTTP 429 | Concurrent limit exceeded | Queue requests with p-queue |
HTTP 502 + ip_banned | IP blocked by target | Retry (auto-rotates IP) |
HTTP 502 + target_site_blocked | Anti-bot blocked | Switch to Scraping Browser |
ETIMEDOUT | Connection timeout | Retry with longer timeout |
| Hourly trigger limit | 60 triggers/hr exceeded | Batch URLs into fewer triggers |
For security configuration, see brightdata-security-basics.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
brightdata, rate-limiting, retry-logic, backoff, concurrency
18 skills in this plugin
/brightdata-ci-integrationConfigure Bright Data CI/CD integration with GitHub Actions and testing.
Use when setting up automated testing, configuring CI pipelines,
or integrating Bright Data tests into your build process.
Trigger with phrases like "brightdata CI", "brightdata GitHub Actions",
"brightdata automated tests", "CI brightdata".
/brightdata-common-errorsDiagnose and fix Bright Data common errors and exceptions.
Use when encountering Bright Data errors, debugging failed requests,
or troubleshooting integration issues.
Trigger with phrases like "brightdata error", "fix brightdata",
"brightdata not working", "debug brightdata".
/brightdata-core-workflow-aScrape structured data with Bright Data Scraping Browser using Playwright/Puppeteer.
Use when scraping JavaScript-rendered pages, SPAs, or sites requiring browser interaction.
Trigger with phrases like "brightdata scraping browser", "brightdata playwright",
"brightdata puppeteer", "scrape SPA with brightdata", "browser scraping".
/brightdata-core-workflow-bExecute Bright Data secondary workflow: Core Workflow B.
Use when implementing secondary use case,
or complementing primary workflow.
Trigger with phrases like "brightdata secondary workflow",
"secondary task with brightdata".
/brightdata-cost-tuningOptimize Bright Data costs through tier selection, sampling, and usage monitoring.
Use when analyzing Bright Data billing, reducing API costs,
or implementing usage monitoring and budget alerts.
Trigger with phrases like "brightdata cost", "brightdata billing",
"reduce brightdata costs", "brightdata pricing", "brightdata expensive", "brightdata budget".
/brightdata-debug-bundleCollect Bright Data debug evidence for support tickets and troubleshooting.
Use when encountering persistent issues, preparing support tickets,
or collecting diagnostic information for Bright Data problems.
Trigger with phrases like "brightdata debug", "brightdata support bundle",
"collect brightdata logs", "brightdata diagnostic".
npx claudepluginhub flight505/skill-forge --plugin brightdata-packOther plugins' skills for the same job