Skip to content
AI Agents3 min read

By · Editorial policy

Retry AI Generation Without Duplicate Drafts

Use a stable request ID for the draft and a different ID for each generation attempt. Record attempts separately and publish or supersede draft revisions through an explicit state change. A retry can produce new content without creating a second draft record.

What is the practical answer?

Use a stable request ID for the draft and a different ID for each generation attempt. Record attempts separately and publish or supersede draft revisions through an explicit state change. A retry can produce new content without creating a second draft record. For report request R-51, reserve draft D-51 before calling the model. An attempt represents one provider call with its own timing, model, and error. A draft represents the work the user intends to review. If a 503 or timeout creates another attempt, both still belong to D-51 unless a user expressly requested a different draft. Decide whether the first successful or latest authorized attempt wins. Two workers racing on one request can generate valid responses in different orders. Use a claim or conditional state change to prevent a late result from replacing an approved version.

Evidence: AWS Builders’ Library on making retries safe · Reddit retry and editorial review workflow discussion

  1. Reserve draft by request IDInput
  2. Log generation attemptsProcess
  3. Accept one authorized revisionDecision
  4. Send accepted draft to reviewExternal action
Generation attempts can repeat while a stable draft and accepted revision remain under explicit control.

Give drafts and attempts different lifetimes#

Decide whether the first successful or latest authorized attempt wins. Two workers racing on one request can generate valid responses in different orders. Use a claim or conditional state change to prevent a late result from replacing an approved version. Keep a record of candidate outputs only as long as privacy and review requirements warrant.

What you findWhat to do
Provider returns a transient errorcreate another attempt under the existing draft.
Late result appears after a revision was acceptedretain it only if policy permits and leave the accepted revision unchanged.
User explicitly requests another draftreserve a different request identity.

Keep the review and publication boundaries separate#

Mark which revision is ready for review, then route approval to that revision. A later attempt can produce a candidate without reopening an already approved draft. Keep publishing outside the generation retry loop so a retry of text generation never independently repeats a CMS action. Use receipts to verify the latest accepted write.

Separate retry policy from revision policy#

Use an attempt log for provider timeouts, rate limits, and retry schedules. Keep draft state in a different record so operations can see whether the request is unstarted, generating, ready for review, or already accepted. A manual rerun may intentionally create another candidate, but only a version transition should make it the review subject.

If attempts run concurrently, bind each attempt to an expected draft version and accept a result under a conditional update. Keep a decision about which candidate wins, such as the first valid response for an open request. A publishing step should only read the approved version and can carry a separate receipt, keeping model retries out of the publication logic.

Verify it with a failure drill#

Make a model stub return 503 on attempt one and valid content on attempt two. Deliver the same request again after the draft has been accepted.

  • Verify one draft record, multiple attempts, and one accepted revision. Return a late successful result from the first path and confirm it cannot overwrite the accepted version.

Sources and further reading

Official references support technical claims; community discussions are used only as problem signals.