All articles Fundamentals

Workflow Retries and Idempotency Explained

Developer working at night in a dark studio with a blue-lit monitor and abstract connected nodes reflected behind them

Every automated step eventually meets a dependency that is slow, flaky, or briefly down. Your webhook times out after ten seconds, the engine retries, and the same customer receives two Slack alerts, your CRM holds two copies of one lead, and a refund goes out twice. The retry behaved exactly as configured; the step was never safe to run more than once.

Workflow retries and idempotency answer two different questions, and a durable automation needs both. Retries decide what happens when a call fails. Idempotency decides what happens when a call succeeds twice. This guide covers both for workflows built in Prynt Automate, where every run already carries a request id, a visitor id, and a decision you can reuse as dedupe keys.

A timeout does not tell you the action failed

When a request times out you learn one thing: no response arrived. You do not learn whether the remote system performed the write. The response can be lost after the row landed, which is why most delivery guarantees are at-least-once: the sender keeps trying and the receiver recognises repeats. Exactly-once delivery across two systems is not something you configure; it is a behaviour you get from at-least-once delivery plus a handler that is safe to repeat.

Three failure shapes to plan for: a timeout after the write (action done, response lost), a 5xx or rate limit (action almost certainly not done), and a partial step (the webhook fired, the next step failed, the run resumes and fires the webhook again).

Classify every step before you enable retries

Before you touch retry settings, sort each step by what a second execution costs.

Engineer sorting translucent rounded blocks into three groups on a dark table under blue light

StepExampleSafe to repeat
Upsert by unique keyCRM lead matched on email plus external idYes
Set a fixed valueMark an account as restrictedYes
Send a messageSlack alert, email, Teams postNo
Grant valueRefund, credit, trial extensionNo
Increment a counterUsage meter, attempt countNo

Anything in the bottom three rows needs an idempotency key or a different position in the workflow. A refund placed before the audit note is a duplicate; the same refund placed behind a dedupe check is a non-event.

Pass one key through the whole run

Identify decisions, alerts, page views, custom events, inbound webhooks and schedules all start a run with identifiers attached: {{trigger.requestId}} for the event, {{trigger.visitorId}} for the device, and {{trigger.decision}} or {{trigger.riskScore}} for the outcome.

POST https://api.yourapp.com/v1/refunds
Idempotency-Key: {{trigger.requestId}}-{{trigger.visitorId}}-refund

Derive the key from the trigger

A key generated inside the step is useless: every attempt gets a fresh one and the receiver treats all of them as new. Send the same key on every retry, and a different key for a genuinely new event. A second refund request is new intent, not a duplicate.

Enforce the key at the receiver

Store the key with a unique constraint, return the stored response when it repeats, and expire the record after a window that matches your business. A day is a common starting point. If you cannot change the receiver, query before you write, and log the check so the next engineer sees it.

Retry only the errors that deserve it

  • Retry timeouts, 5xx and 429 responses, and respect Retry-After.
  • Do not retry 400, 401, 403 or 422: the request or the credentials are wrong and the next attempt fails identically.
  • Back off exponentially with jitter, cap attempts at three to five, and route exhausted runs somewhere a person actually looks.
  • Serialise steps that touch the same account, so two runs cannot hit the same wallet at once.

Two hands exchanging a small glowing blue token across a dark glass surface

Read the run log before you raise the retry count

The run log records each attempt, its status, and step outputs you can reference later, such as {{steps.s1.output.text}}. Read it before adding attempts. The same error code across many runs usually means an integration config change, not a network blip. Success only on the last attempt means the dependency is slow. Duplicated Slack messages mean there is no key at all. Automate is priced per execution at $39 per 1,000, so a workflow that retries blindly spends money and buries the real bug.

A ten-minute checklist

  1. Mark every step safe or unsafe to repeat.
  2. Agree an idempotency key with the receiver for each unsafe step.
  3. Set retry rules per step: status codes, attempts, backoff.
  4. Serialise the steps that share an account.
  5. Replay one run with the same {{trigger.requestId}} and confirm the second attempt changes nothing.

Engineer reviewing rows of glowing horizontal bars on a large display in a dark office

FAQ

Is a retry the same as a duplicate?

No. A retry is a second attempt at one intent; a duplicate is a second side effect from that one intent. Retries are normal and welcome. Duplicates are the cost of retrying a step that was never designed to be repeated.

Do I need exactly-once delivery to avoid duplicates?

You need the observable result of it. At-least-once delivery with an idempotent receiver produces the same outcome: the first attempt effects the change, and later attempts return the stored result instead of repeating the work.

Where does the idempotency key come from in Prynt Automate?

From the trigger, never from the step. {{trigger.requestId}} identifies the event, and combining it with {{trigger.visitorId}} or a fixed step label keeps keys unique per event and stable per retry. Variable syntax and payload shapes are documented in our docs.

If you are ready to put this into practice, build a workflow that turns a checkout risk decision from payment fraud detection into a refund review, a Slack alert or a CRM record at pryntid.com, then open the run log and confirm that a retry changes nothing.

Try it free

Prynt is device intelligence with a free plan: 5,000 identifications a month, visitor IDs with confidence and bot detection — no credit card. Upgrade to Pro for VPN, proxy, tampering and behavioral signals.

Keep reading