Rate Limiter¶
Class: RateLimiterBlockV1
Source: inference.core.workflows.core_steps.flow_control.rate_limiter.v1.RateLimiterBlockV1
Enforce a minimum time interval between executions of downstream workflow steps, throttling execution frequency and preventing over-execution by ensuring connected steps run no more frequently than a specified cooldown period.
How This Block Works¶
This block limits the execution rate of workflow branches by enforcing a cooldown period between consecutive executions. The block:
- Takes a cooldown period (in seconds), a
depends_onreference, andnext_stepsas input - Tracks the timestamp of the last execution using an internal state variable
- Calculates the current time:
- For video processing: Uses video metadata (frame number and FPS) to compute a video-time-based timestamp when
video_reference_imageis provided - For other contexts: Uses system clock time (datetime.now())
- Compares the time elapsed since the last execution against the
cooldown_secondsthreshold - If sufficient time has passed (elapsed time >= cooldown_seconds):
- Updates the last execution timestamp
- Continues execution to the specified
next_stepsblocks, allowing downstream processing - If insufficient time has passed (elapsed time < cooldown_seconds):
- Terminates the current workflow branch, preventing downstream execution until the cooldown period expires
- Returns flow control directives that either continue to next steps or terminate the branch
The block maintains execution state across workflow runs, tracking when downstream steps were last executed. The depends_on parameter establishes a dependency relationship, and the rate limiter monitors when the dependent step completes to determine if the cooldown period has elapsed. For video workflows, the block can use video-time-based timestamps (calculated from frame number and FPS) rather than wall-clock time, which is useful when processing video faster than real-time, ensuring throttling works correctly relative to video time rather than processing speed.
Requirements¶
Important Limitation: The rate limiter currently only works in video processing contexts. When used in workflows running behind HTTP services (Roboflow Hosted API, Dedicated Deployment, or self-hosted inference server), the rate limiting will have no effect for processing HTTP requests, as each request is independent and execution state is not maintained between requests.
Common Use Cases¶
- Throttling Expensive Operations: Limit the frequency of resource-intensive downstream operations (e.g., execute data uploads every 5 seconds maximum, skip if attempted more frequently), preventing system overload and reducing costs for operations with usage-based pricing
- Preventing Notification Spam: Throttle notification blocks to avoid overwhelming recipients (e.g., send email alerts at most once per minute when detections occur, skip redundant notifications), ensuring alerts remain meaningful and actionable
- API Rate Limit Compliance: Enforce rate limits for external API calls or service integrations (e.g., limit webhook calls to external systems to once per second, prevent exceeding API quotas), ensuring compliance with external service rate limits
- Database Write Optimization: Reduce write frequency to databases or data storage systems (e.g., log detection results every 10 seconds maximum, batch updates efficiently), minimizing database load and improving overall system performance
- Video Processing Efficiency: Control processing rate in video workflows where fast-forward processing may generate many frames quickly (e.g., throttle analysis steps to process every 2 seconds of video time, maintain proper timing when processing faster than real-time), using video-time-based throttling for accurate rate limiting
- Resource Management: Manage computational resources by limiting how frequently expensive model inference or processing steps execute (e.g., run expensive analysis at most once per 3 seconds, skip redundant processing), balancing processing speed with resource constraints
Connecting to Other Blocks¶
This block controls workflow execution flow and can be connected:
- Between workflow steps where you want to throttle execution rate, placing the rate limiter between a source step (referenced in
depends_on) and target steps (specified innext_steps) to enforce a minimum time interval between executions - Before notification blocks (e.g., Email Notification, Slack Notification, Twilio SMS Notification) to prevent notification spam by ensuring alerts are sent no more frequently than the cooldown period, maintaining alert effectiveness and avoiding overwhelming recipients
- Before data storage blocks (e.g., Local File Sink, CSV Formatter, Roboflow Dataset Upload, Webhook Sink) to throttle write operations and reduce storage or network overhead, batching updates efficiently and preventing excessive write operations
- Before external API integrations (e.g., Webhook Sink) to comply with external service rate limits, ensuring API calls don't exceed allowed frequencies and preventing rate limit errors
- In video processing workflows where fast-forward processing generates frames rapidly, using
video_reference_imageto enable video-time-based throttling that works correctly even when processing video faster than real-time, maintaining proper execution timing relative to video playback time - After detection or analysis blocks (e.g., Object Detection, Classification, Line Counter) to throttle downstream processing triggered by frequent detections or events, ensuring expensive operations don't execute too frequently even when detections occur on every frame
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/rate_limiter@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | โ |
cooldown_seconds |
float |
Minimum number of seconds that must elapse between consecutive executions of the next_steps blocks. The rate limiter tracks the last execution timestamp and only allows execution to continue if at least this many seconds have passed since the previous execution. Must be greater than or equal to 0.0. For video workflows, this cooldown period is enforced based on video time (calculated from frame number and FPS) when video_reference_image is provided, rather than wall-clock time.. | โ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Runtime compatibility¶
-
softโ runtimehosted_serverless,dedicated_deployment; executionremote - Cooldown / rate-limit timer is stored in process memory. With remote step execution on stateless or multi-replica HTTP runtimes each request gets a fresh worker, so cooldown does not throttle. Cooldown only behaves as documented with local step execution inside an InferencePipeline.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to Rate Limiter in version v1.
- inputs:
PLC Writer,Image Blur,Track Class Lock,Byte Tracker,Mask Edge Snap,Path Deviation,Crop Visualization,VLM As Detector,Polygon Visualization,Object Detection Model,Roboflow Visual Search Classifier,Detections Stabilizer,Image Slicer,Qwen3.5-VL,Image Convert Grayscale,CLIP Embedding Model,Webhook Sink,Semantic Segmentation Model,VLM As Classifier,Motion Detection,SAM 3 Interactive,Keypoint Detection Model,Clip Comparison,YOLO-World Model,Buffer,SIFT,OC-SORT Tracker,Slack Notification,Label Visualization,MoonshotAI Kimi,PLC Reader,Stitch OCR Detections,Label Visualization,Instance Segmentation Model,S3 Sink,Perception Encoder Embedding Model,Email Notification,Keypoint Detection Model,Velocity,BoT-SORT Tracker,Detection Event Log,Overlap Analysis,Pixel Color Count,Single-Label Classification Model,Background Subtraction,Ellipse Visualization,Path Deviation,Stitch Images,CSV Formatter,Corner Visualization,OPC UA Writer Sink,Triangle Visualization,Detection Offset,Qwen-VL,JSON Parser,Distance Measurement,Bounding Rectangle,Property Definition,Camera Calibration,Google Gemini,Seg Preview,Polygon Zone Visualization,Roboflow Custom Metadata,LMM For Classification,Delta Filter,Camera Focus,PP-OCR,SIFT Comparison,Trace Visualization,Color Visualization,Inner Workflow,Object Detection Model,Local File Sink,Llama 3.2 Vision,SAM3 Video Tracker,Llama 3.2 Vision,Dynamic Zone,Dominant Color,Morphological Transformation,Continue If,SAM2 Video Tracker,Google Vision OCR,Google Gemma API,Detections Filter,Google Gemma,First Non Empty Or Default,Microsoft SQL Server Sink,Polygon Visualization,Environment Secrets Store,Icon Visualization,PLC ModbusTCP,Detections Transformation,Rich Label Visualization,Identify Changes,Twilio SMS/MMS Notification,Keypoint Visualization,Qwen2.5-VL,Image Slicer,OpenAI,Clip Comparison,OpenAI,Keypoint Detection Model,Object Detection Model,Qwen 3.6 API,Instance Segmentation Model,Single-Label Classification Model,Mask Visualization,Moondream2,Nearest Neighbor Detection Match,OpenAI,Byte Tracker,Instance Segmentation Model,OpenAI-Compatible LLM,Roboflow Visual Search,Expression,VLM As Detector,Stability AI Outpainting,Blur Visualization,Multi-Label Classification Model,Frame Delay,Bounding Box Visualization,Absolute Static Crop,Roboflow Dataset Upload,OpenAI,Anthropic Claude,Reference Path Visualization,Google Gemini,Switch Case,Detections Stitch,Event Writer,Cache Set,Stitch OCR Detections,CogVLM,Time in Zone,VLM As Classifier,Email Notification,Barcode Detection,Contrast Enhancement,Current Time,Template Matching,QR Code Detection,Mask Area Measurement,Perspective Correction,Cosine Similarity,Detections List Roll-Up,Halo Visualization,Semantic Segmentation Model,Dimension Collapse,Overlap Filter,Cache Get,Multi-Label Classification Model,Dynamic Crop,OpenRouter,Detections Consensus,PLC EthernetIP,OCR Model,GeoTag Detection,Per-Class Confidence Filter,Halo Visualization,Line Counter Visualization,Time in Zone,Time in Zone,Roboflow Asset Library Attributes,Multi-Label Classification Model,Size Measurement,LMM,Relative Static Crop,Depth Estimation,SIFT Comparison,SAM 3,ByteTrack Tracker,Dot Visualization,Detections Combine,GLM-OCR,Florence-2 Model,EasyOCR,Rate Limiter,Background Color Visualization,Google Gemini,Data Aggregator,Image Contours,Roboflow Dataset Upload,Qwen3.5,Segment Anything 2 Model,Qwen 3.5 API,MoonshotAI Kimi,Stability AI Inpainting,Contrast Equalization,Morphological Transformation,Image Threshold,Camera Focus,SAM 3,Line Counter,Stability AI Image Generation,Instance Segmentation Model,Circle Visualization,QR Code Generator,Detections Merge,Google Gemini,Detections Classes Replacement,Model Monitoring Inference Aggregator,Single-Label Classification Model,Roboflow Vision Events,Heatmap Visualization,Twilio SMS Notification,Auto Rotate on Edges,Cosmos 3,MQTT Writer,SAM 3,Anthropic Claude,SORT Tracker,Image Preprocessing,Qwen3-VL,Gaze Detection,Line Counter,Anthropic Claude,Image Stack,Text Display,Grid Visualization,Florence-2 Model,Model Comparison Visualization,Identify Outliers,PTZ Tracking (ONVIF),Classification Label Visualization,Byte Tracker,SmolVLM2,Pixelate Visualization - outputs: None
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Rate Limiter in version v1 has.
Bindings
-
input
depends_on(*): Reference to the workflow step that immediately precedes this rate limiter block. This establishes the dependency relationship - the rate limiter monitors when this step completes to determine if the cooldown period has elapsed since the last execution. The depends_on step can be any workflow block whose output triggers the rate-limited downstream processing..next_steps(step): List of workflow steps to execute if the rate limit allows (i.e., sufficient time has passed since the last execution). These steps receive control flow only when the cooldown period has elapsed, enabling throttled downstream processing. If the cooldown period hasn't elapsed, these steps will not execute as the branch terminates. Each step selector references a block in the workflow that should execute when rate limiting permits..video_reference_image(image): Optional reference to a video frame image to use for video-time-based timestamp generation. When provided, the rate limiter calculates timestamps based on video metadata (frame number and FPS) rather than system clock time. This is useful when processing video faster than real-time, ensuring rate limiting works correctly relative to video playback time rather than processing speed. If not provided (None), the block uses system clock time (datetime.now()). Only applicable for video processing workflows..
-
output
Example JSON definition of step Rate Limiter in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/rate_limiter@v1",
"cooldown_seconds": 1.0,
"depends_on": "$steps.model",
"next_steps": [
"$steps.upload"
],
"video_reference_image": "$inputs.image"
}