> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/workflow-execution/external-side-effects-and-safe-retries.md).

# External Side Effects and Safe Retries

A retry can repeat an external change. A timeout may occur after the provider creates a record or sends a message. Reconcile the result before resubmitting a write.

![Check the destination after an uncertain write](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FytEqwhaFVZNLFDq1fWPz%2Fexternal-side-effects-and-safe-retries.png?alt=media)

Illustrative recovery logic, not an automatic StackAI retry setting. Only use an idempotency key when the specific provider operation supports it. Cancellation does not undo a record or message already created.

<details>

<summary>Copy the example</summary>

```python
result = inspect_destination(business_reference)

if result.is_confirmed:
    retain_external_record_id(result.record_id)
elif result.is_uncertain:
    request_reconciliation()  # Do not blindly repeat a write.
else:
    retry_with_provider_supported_idempotency()
```

</details>

## Before you begin

The provider action details and any returned external record or request ID.

## Key concepts

| Term           | Definition                                                                                                                                                                    |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Side effect    | A change outside the returned answer, such as creating a record or sending email. Cancellation or release rollback does not undo a completed side effect.                     |
| Idempotency    | A contract under which repeating the same intended operation does not create an additional change. Use it only where the provider or public operation explicitly supports it. |
| Reconciliation | Checking the run or destination to determine whether an uncertain operation completed. Do this before retrying a write after a timeout.                                       |
| Retry          | A repeated attempt after a failed or uncertain operation. It can repeat external changes; use it only when the result is understood.                                          |

## Retry an action safely

1. Save the operation’s business identifier and returned provider ID.
2. If the outcome is uncertain, look for the result in the destination system.
3. Use a provider-supported idempotency key when the action exposes one. Retry only after determining whether work remains.

Recovery avoids creating duplicate records or sending duplicate messages.

## Behavior and limitations

A general idempotency-key contract is not promised for all StackAI operations. Cancellation and rollback of a workflow release do not undo external writes. Treat a successful transport response and a confirmed business result as separate checks.

## Related resources

[Execution Order and Node Dependencies](https://docs.stackai.com/technical-reference/workflow-execution/execution-order-and-node-dependencies.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/workflow-execution/external-side-effects-and-safe-retries.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
