Modern applications integrate with numerous external APIs (SendGrid, Stripe, OpenAI, Twilio) that enforce rate limits to protect their infrastructure. These limits vary by provider service and plan. Without proactive rate limiting when calling downstream services, users may experience “too many request” errors, failed workflows, wasted execution, cascading failures, and even account suspension.
The Temporal Validated Pattern “Rate-limit downstream APIs with separate Task Queues” shows you how to use separate Task Queues with rate limiting configuration to protect downstream APIs. Create one Task Queue per rate-limited API and configure:
max_task_queue_activities_per_second: Global rate limit across all Workers on the queuemax_activities_per_second: Per-Worker rate limit (optional, for additional control)max_concurrent_activities: Limit concurrent executions when API has concurrency limits
This ensures Activities calling external APIs never exceed their rate limits, preventing 429 errors and account issues.