Workflow guides
Idempotency after a provider timeout
Recover timed-out requests without creating duplicate outreach. Check the key, caller scope, workflow version, and provider evidence before retrying.

A customer’s phone can start ringing even when the application that requested the call receives a timeout. The provider may have accepted the request before its response was lost. Sending the request again could create a second call.
Idempotency makes a repeated request represent the same intended operation. Its protection has boundaries: which service recognizes the key, which caller is using it, what request it identifies, and how long that service retains it. Safe recovery starts by establishing which of those boundaries the timeout crossed.
Identify which request timed out
A follow-up workflow usually involves several separate exchanges:
- Your application creates a Tremi run. A lost response leaves your application unsure whether that run exists.
- An outreach step submits work to a provider. A lost response leaves the sender unsure whether a call, text, or email was accepted.
- A provider sends a callback. A delayed or repeated callback changes when your system learns what happened.
Each needs its own recovery behavior. A key that prevents duplicate run creation does not, by itself, deduplicate every provider request or callback. Before retrying, identify the operation that might already have succeeded.
Assign one key to one intended event
Generate a key when you persist the business event, then retain it with the original request. A random identifier works well when it is generated once and reused. Generating another after a timeout describes a new request.
For example, a quote-follow-up event might have this application-side record. These are illustrative identifiers, not Tremi API fields:
business_event: quote_demo_104_followup_1
idempotency_key: 75da0c3f-7e37-48b2-9e69-4979b07e0194
request_body: saved before the first submission
run_id: saved when a response is received
Two worker deliveries of that event should reuse the same key. A separately approved follow-up on a later quote revision is a new event and needs its own key. A phone number alone cannot distinguish those intentions, and customer details do not belong inside keys that may appear in logs.
AWS’s guidance on idempotent APIs explains why a caller-provided request identifier expresses intent more reliably than assuming two matching payloads are accidental duplicates.
Recover a Tremi request within its original scope
Tremi’s run-creation API requires Idempotency-Key. A newly created run returns HTTP 201. An accepted replay returns HTTP 200 with Idempotent-Replay: true and the existing run’s ID. Save that ID against the originating event.
Keep these parts of a recovery request stable:
- The workflow and caller scope. Execution-key requests and requests from an authenticated user have different scopes; another user is also a different scope.
- The declared inputs and any explicit schedule. Rebuilding the request from a customer record that has since changed can change its meaning.
- The workflow version against which the request is evaluated. Publishing a new version between attempts can make an otherwise identical request conflict.
Tremi compares a normalized request, including the workflow version. Reusing a key for a different request in the same scope returns HTTP 409; switching scope can instead create another run. Keeping the original request body is a useful discipline, but it is not a promise that recovery will succeed after configuration or access changes. The workflow must also remain executable.
Treat a conflict as a reason to investigate. Do not generate a fresh key just to make the error disappear. Read the response detail: a 409 can also indicate that the workflow cannot currently execute.
If you have the run ID, inspect that run before creating anything else. Run lookups require authorized user authentication; an execution key is not a general-purpose read credential. If the ID was lost too, retain the key and request context for reconciliation. The API integration guide shows the creation and authentication pattern.
Resolve provider acceptance separately
A successful replay recovers the Tremi run. It does not prove that the provider rejected, accepted, delivered, or completed its work. Review the individual attempt and its evidence:
- Acceptance is confirmed: continue tracking that provider operation. A missing final outcome is not a reason to submit another one.
- Rejection is confirmed: follow the provider’s documented error handling. A corrected request still needs current stop, permission, and timing checks.
- Acceptance is unknown: reconcile the original attempt before repeating an action that could contact the recipient twice.
Provider idempotency can help when the integration actually uses it. For example, Retell’s create-call reference documents a separate idempotency_key with a retry window of up to one hour. That provider contract does not establish that a Tremi run key is automatically forwarded, or that the same window applies to another channel.
Check the exact endpoint, key mapping, request-matching rules, and retention period. Backoff can reduce load; waiting longer does not establish whether the first call happened. Repeatedly sending an uncertain operation after its deduplication window expires can create a duplicate.
Work through a lost-response incident
Consider this fictional incident. Both responses are lost: the response to your run-creation request and the response to the provider submission.
- Your application submits the saved event and key. Tremi creates a run, but the application times out before receiving its ID.
- The provider accepts an outreach attempt. Its response is lost, so acceptance is initially uncertain from the sender’s perspective.
- Your application repeats the original creation request while the caller scope, workflow version, and inputs remain unchanged. The replay returns the existing run.
- A callback arrives. If it is authenticated and can be matched to the original attempt, it contributes evidence about that operation. It should not initiate a new run or erase the original timeout from the investigation.
If the callback cannot be matched confidently, keep the uncertainty visible and assign an owner to resolve it. Neither an empty callback queue nor a local failure label proves that no contact occurred. Provider-specific reconciliation needs to be verified for the integration in use.
Test recovery before enabling automatic retries
Use a fake provider or fault injection to test the boundaries without contacting customers. Check both the returned run and the number of attempted side effects:
- Lost creation response: repeat the same request and recover one run ID.
- Concurrent duplicate submissions: two workers process one event without creating two runs in the same scope.
- Changed inputs or workflow version: the conflict is surfaced without an automatic fallback to a fresh key.
- Changed caller scope: the client does not silently switch authentication to recover an uncertain request.
- Accepted provider request with a lost response: the recovery path does not blindly issue another call or message.
- Late or duplicate callback: the event is associated with the original attempt without repeating a downstream action.
Also define what happens when uncertainty outlasts the provider’s retry window. A bounded retry policy needs a stopping condition and an escalation path, not just a maximum attempt count.
Give unresolved attempts a clear owner
A useful handoff includes the business event, run and attempt IDs, timestamps, provider identifiers when available, the original error, and the last verified outcome. Keep credentials and unnecessary customer details out of diagnostic logs.
Record the reason for any intentional repeat and check whether the customer has already replied, booked, or opted out. Reconciliation should preserve the connection between the first attempt and the later decision.
Pair this recovery process with the workflow-version guide. It explains why a release can change request recovery even when your application sends the same inputs. For acceptance, delivery, and business outcomes, use the separate definitions in the measurement guide.