> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/ops/solution-error/action-retry.md).

# アクションの自動リトライ

## アクションの再試行（リトライ）について

以下の場合に、アクションが再試行（リトライ）される可能性があります。

* SaaS側のシステム障害
* APIのリクエスト回数の制限
* SaaS側のメンテナンス発生時にソリューションが実行された場合

冪等性が担保される（何回実行しても同じ結果になる）リクエストに対して、再試行されます。

## 共通仕様

* 再試行はAPIリクエストレベルで実行されます。
  * 例：アクション内でAリクエスト、Bリクエスト、といった２回のAPIリクエストが行われる場合、Bリクエストでエラーになったからといって、アクション自体(Aリクエストまで)再試行されることはありません。
* 再試行の条件や試行回数はソリューションエディタ上から指定することはできず、コネクタのアクションごとに決まっています。
* 再試行遅延時間は、
  * [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) ヘッダーがあればその値に準拠します。（最小は 1 秒 、最大は 300 秒）
  * [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) ヘッダーがなければ60 秒です。

## デフォルトの挙動

コネクタのアクションについて特段調整をしていない場合、デフォルトでは以下の挙動で再試行を行います。

**デフォルトの挙動**

* 再試行条件：
  * ステータスコード：429, 500, 502, 503, 504, 507　のいずれかの場合\
    ※これ以外のステータスコードは即APIエラーとして記録されます
  * HTTPメソッド：GET, OPTIONS　のいずれかの場合\
    ※POST等はデータベースの二重書き込みを防ぐためにデフォルトの再試行には含めていません
* 再試行回数：2回

## 専用アクションによって変更可能な挙動

上記のデフォルト挙動に対し、連携コネクタの専用アクションは再試行の条件等を変更することが可能です。

自社サービスのコネクタをAnyflowに開発依頼する際に、ご希望があればデフォルトから変更いたします。

**変更可能な挙動**

* 再試行条件
  * 再試行対象のステータスコード／レスポンスボティを指定可能です。
  * 「ステータスコードが 404 だったら」「レスポンスボティに "limited" が含まれていたら」といった指定が可能です。
* 再試行対象のメソッド指定
  * 「PUTのみ」「DELEETとGETのみ」といった指定が可能です。
* 再試行回数：0\~5回

**カスタムアクションについて**

* カスタムアクションではデフォルトの挙動が適用されます。基本的にカスタマイズはできません。


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/ops/solution-error/action-retry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
