Operate workflows
Control execution with action policies
Target handlers and stages with retry, timeout, rate-limit, and circuit-breaker rules, and inspect effective behavior.
On this page
Choose the ruleCreate a narrowly targeted policyJSON shapeTargeting and precedenceRate limit scopeCircuit-breaker scopeInspect unexpected behaviorCurrent limitsUse an action policy when several workflows need the same retry, timeout or dispatch rule. For a single stage, start with its explicit retry/timeout options. This guide shows how to introduce one narrowly targeted policy and verify its effect; it is not a guarantee of strict external quotas or complete circuit-breaker isolation.
Policies are experimental. Some accepted fields are not enforced, and some counters span applications. Read the scope and limits below before activating a rule on a shared installation.
Administrators manage policies under Action Policies. Operators can inspect run behavior but do not manage this page. Policy administration is distinct from the overlap/catch-up settings on a schedule.
Choose the rule
| Type | Purpose | Runtime result |
|---|---|---|
retry | Retry selected reported failures. | Schedules a new attempt when the winning rule allows it. |
timeout | Limit stage execution time. | Uses the strictest applicable step timeout. |
rate_limit | Limit dispatch based on recent started stages. | Places a stage in Throttled until eligible again. |
circuit_breaker | Block dispatch after observed handler failures. | Can fail the stage and pipeline when the breaker is open. |
Circuit blocking is not simply a paused job that will automatically resume after a cooldown. Inspect the run and choose recovery deliberately.
Create a narrowly targeted policy
The following procedure introduces a retry policy. The other policy types have different checks: use execution duration for timeouts and dispatch behavior for rate limits and circuit breakers.
- Open Action Policies and create a policy.
- Give it a recognizable name and description explaining the protected dependency.
- Choose Retry and its environment, then configure the error-code allowlist and delay.
- Target a specific handler/stage or a small set of pipelines/labels.
- Preview the matched scope before activating it. Check actual pipeline IDs, handler names and labels; a preview is not an execution test.
- Activate it for a non-production run whose handler reports a known error code. Inspect the stage's effective-policy response, retry count and next retry time.
- Repeat with an error outside the allowlist. Confirm that it does not fall back to stage retries. Pause the policy if the observed behavior differs from the intended rule.
Do not begin with a global rule unless it is intended to affect all matching work. Status values are active, paused, and disabled; orphaned inline policies can also appear in lists.
JSON shape
Policy JSON uses singular rule, and target fields are pipelines, stages, handlers, tagsInclude, and tagsExclude. This is a retry policy body; SDKs can also include policy definitions in pipeline/stage creation:
{
"name": "retry-email-transport",
"description": "Retry transient email-provider failures.",
"type": "retry",
"status": "active",
"environment": "all",
"targeting": {
"pipelines": [],
"stages": [],
"handlers": ["EmailInvoiceHandler"],
"tagsInclude": [],
"tagsExclude": []
},
"rule": {
"maxAttempts": 3,
"backoff": "exponential",
"baseDelayMs": 1000,
"maxDelayMs": 30000,
"jitter": true,
"retryOn": { "errorCodes": ["UPSTREAM_ERROR", "TRANSPORT_UNAVAILABLE"] }
}
}Policy delays/timeouts use milliseconds where the field says Ms. Stage retry options use seconds.
maxAttempts is currently compared to the stored automatic retry count; do not interpret its label as a promise of exactly that many total handler executions. Delivery recovery and manual reruns are additional reasons an execution attempt can occur. Use business idempotency independently of retry limits.
Targeting and precedence
Pipeline targets are pipeline IDs represented as strings. Stage and handler targets match names case-insensitively; they are not glob patterns. Every included tag must match, and any excluded tag prevents a match.
Environment is one of all, prod, staging, or dev. Execution reads it from a pipeline context item named environment or env; the worker's bootstrap environment does not select policy scope. For example, set context environment to staging to match a staging policy. If neither context key is present, only policies with environment all match.
Tags match pipeline keyword values, case-insensitively, not keyword names or key:value pairs. A keyword with key service and value billing matches tagsInclude:["billing"]. Inspect the effective response to confirm these values before activation.
For matching rules:
- Timeout: the lowest applicable step timeout wins, including the stage's own timeout.
- Retry: the highest-precedence matching retry rule wins. The effective response explains selection and shadowing.
- Rate limits: matching rules remain active together; any exceeded rule can throttle.
- Circuit breakers: matching rules remain active together; any open breaker can block.
An effective retry policy takes precedence over stage retry settings. If its error filter does not match, the engine does not retry using the stage fallback. Terminal error classifications and retryable:false still prevent automatic retry.
Rate limit scope
The keyBy values are global, tenant, user, and custom. Current runtime meanings are:
| Key | Grouping |
|---|---|
global | Recent started stages across the store. |
tenant | Application scope. |
user | Pipeline scope; it is not a dashboard user's identity. |
custom | Handler name. |
limit, windowSeconds, and optional burst determine the dispatch threshold. These rules operate on workflow dispatch observations. They are not a replacement for a shared external API quota service or a strict distributed rate limiter under every concurrency pattern.
custom counts matching handler names across applications, not just the application of the stage being evaluated. Policy targeting selects where a rule applies; it does not automatically narrow the observations counted by the rule.
Circuit-breaker scope
The current evaluator counts stages whose current status is Failed and whose handler name matches case-insensitively within windowSeconds. Its query has no application filter. Two applications using the same handler name can therefore affect the same breaker evaluation. It counts failed stage rows, not every failed attempt in their history.
When the threshold is reached, the open interval is measured from the latest matching failure. An open breaker can fail the waiting stage rather than merely defer it. Do not use this mechanism as a tenant-isolated dependency-health service; enforce that boundary in your application if required.
These scope limits come from the rate-limit and circuit-breaker queries, not from the setting names.
Inspect unexpected behavior
For a throttled, timed-out, or unexpectedly terminal run, ask an administrator to inspect the effective policy resolution for the stage. The internal route is GET /api/policies/effective/stages/{stageId} through the dashboard proxy and requires an administrator session. It explains matched, selected, shadowed, and ignored rules.
Compare the handler name, environment, included/excluded tags, stage options, and the result's error code. Temporarily pausing a policy changes future evaluations; it does not automatically reconstruct work that already failed.
Current limits
Use retryOn.errorCodes; the schema's retryOn.httpStatus is not an enforced HTTP response filter in this runtime. Use timeout with appliesTo:"step"; broader timeout scopes are not implemented as pipeline deadlines. halfOpenMaxCalls is not a complete half-open circuit-breaker guarantee.
Policy data is persisted in PostgreSQL. API policy-management views maintain a local index loaded at startup, while execution reads database policy data. Do not assume instantaneous coherent policy-management views across several API replicas. Validate policy changes on the actual deployment before extending a single-instance operating model.