Prompt
How do I set up retries for a business process automation?
Latest observation
Retries in business process automation are usually set up around transient failures so the process can recover automatically without manual intervention.
1) Identify what should be retried
Only retry failures that are likely temporary, such as:
- Network timeouts
- API rate limits
- Deadlocks / lock timeouts
- Temporary service unavailability
- Queue or database connectivity issues
Avoid retrying:
- Validation errors
- Business rule failures
- Duplicate submissions
- Permission/authentication errors unless you expect token refresh to fix them
2) Define the retry policy
Typical retry settings:
- Max attempts: e.g. 3–5 tries
- Delay between attempts: e.g. 5s, 30s, 2m
- Backoff strategy: exponential backoff is common
- Jitter: add randomness to avoid retry storms
- Timeout per attempt: ensure each try doesn’t hang indefinitely
Example policy:
- Try immediately
- Retry after 5 seconds
- Retry after 30 seconds
- Retry after 2 minutes
- Then fail and escalate
3) Make the process idempotent
This is critical. If a step runs twice, it should not create duplicates or corrupt data.
Ways to do that:
- Use idempotency keys
- Check if the work already completed before re-running
- Write status markers in a database
- Design downstream actions to be safe on repeat execution
4) Separate retryable steps from non-retryable steps
Structure the workflow so each task has clear outcomes:
- Success
- Retryable failure
- Fatal failure
If you’re using a workflow engine, mark transient exceptions as retryable and route fatal ones to a failure path.
5) Add error handling and escalation
If retries still fail:
- Send an alert
- Create a ticket
- Route to a human approval/repair queue
- Record the error context for debugging
6) Persist state
Store process state externally so retries can resume correctly:
- Current step
- Retry count
- Last error
- Correlation/process ID
- Timestamps
This prevents losing progress if the automation server restarts.
7) Use dead-letter or quarantine handling
For messages/jobs that repeatedly fail:
- Move them to a dead-letter queue
- Mark them for manual review
- Preserve payload and error history
8) Test failure scenarios
Simulate:
- Timeouts
- Temporary API outages
- Duplicate delivery
- Partial completion
- Restart during execution
This helps verify that retries behave as intended.
Example pattern
A common retry flow looks like this:
- Execute task
- If successful, continue
- If transient error:
- wait
- retry up to N times
- If still failing:
- log details
- notify ops/business owner
- move to manual exception handling
If you’re using a specific tool
The exact setup depends on the platform, for example:
- Power Automate
- Camunda / Zeebe
- UiPath
- Nintex
- AWS Step Functions
- Temporal
- Apache Airflow
- Logic Apps
If you tell me which automation platform you’re using, I can give you the exact retry configuration and best practices for that tool.