Skip to content

Description

While executing workspaces automations, Runtime enforces 4 distincts rate limits :

  • Automations execution
  • Event emits
  • HTTP fetchs
  • repeat loops

Each workspace has its own rate limits for each of these instructions.
Moreover, these rate limits are local to each runtime instance and not shared between multiple runtime instances : thus, global rate limits for a workspace will increase as new runtime instances are created.

For example, with 2 runtime instances and a workspace A that has a 100 automation executions / second rate limit, workspace A might reach 200 automations / s.
In order for this workspace to benefit from this maximum global limit of 200 automations / seconds, it must leverage events emits & triggers to evenly distribute automations executions accross the cluster.

On the contrary, a single automation calling 2000 other automations in a row will be entirely executed by the same and single instance which processed the initial trigger, and thus will be throttled & not exceed 100 automations / seconds :

slug: thisWillBeThrottled
do:
  - repeat:
      on: 2000
      do:
        - callSomeOtherAutomation: {}

Instead, it could be easily rewritten using emits to asynchronously distribute these 2000 calls accross the available instances :

do:
  - repeat:
      on: 2000
      do:
        - emit:
            event: triggerSomeOtherAutomation
            payload: {}

---
# The second automation:  

slug: callSomeOtherAutomation
when:
  events:
    - triggerSomeOtherAutomation
do: []
In this example, note that 2 other rate limits will apply : emits and repeats.

When an automation is throttled (regardless of the type of rate limit reached), a payload.throttled field indicates for how long inside its runtime.automations.executed event.
The same amount of time is also included in the corresponding payload.duration field.

Default limits

Burst rate : During a momentary peak usage, number of times that can be executed before being throttled to the normal rate.

Default rate limits can be configured for all workspaces with environment variables, or can be configured per workspace with prismeai_* workspace secrets (restricted to super admins).

Rate limits can also be disabled for a specific workspace with prismeai_ratelimit_disabled: true secret.

Type Rate/s Environment variable Workspace secret Burst rate Environment variable Workspace secret
Automations execution 100 RATE_LIMIT_AUTOMATIONS prismeai_ratelimit_automations 400 RATE_LIMIT_AUTOMATIONS_BURST prismeai_ratelimit_automations_burst
Emits 30 RATE_LIMIT_EMITS prismeai_ratelimit_emits 100 RATE_LIMIT_EMITS_BURST prismeai_ratelimit_emits_burst
HTTP fetchs 50 RATE_LIMIT_FETCHS prismeai_ratelimit_fetchs 200 RATE_LIMIT_FETCHS_BURST prismeai_ratelimit_fetchs_burst
Repeat iterations 1000 RATE_LIMIT_REPEATS prismeai_ratelimit_repeats 4000 RATE_LIMIT_REPEATS_BURST prismeai_ratelimit_repeats_burst
  • Setting one of the above environment variables to 0 disable the corresponding rate limit for all workspaces.
  • Rate limits can be disabled for all workspaces with RATE_LIMIT_DISABLED=true environment variable.