ClaudeCloudflare Developer PlatformMar 6, 2026, 12:00 PM

Workflows, Workers - Workflow steps now expose retry attempt number via step context

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

claudeenmodel: claude-sonnet-4-20250514

Workflow steps now expose retry attempt number via step context

Key Points

  • Step context exposes retry attempt number
  • 1-indexed attempt numbering system
  • Enables progressive backoff and conditional logic

Summary

Cloudflare Workflows now provides access to the current retry attempt number through the step context in step.do() calls. This enhancement enables better observability and conditional logic based on retry attempts.

Key Points

  • Step context now includes ctx.attempt property indicating current retry attempt
  • Attempt numbering is 1-indexed (first try = 1, first retry = 2, etc.)
  • Use cases include improved logging, progressive backoff strategies, and conditional workflow logic
  • Available in TypeScript with await step.do("my-step", async (ctx) => { console.log(Attempt ${ctx.attempt}); })

Full Translation

Translations

A translation section that keeps the flow of the original article.

claudejamodel: claude-sonnet-4-20250514

Workflows, Workers - ワークフローステップでステップコンテキスト経由でリトライ試行回数が公開されるようになりました

ワークフローステップでステップコンテキスト経由でリトライ試行回数が公開されるようになりました

2026年3月6日

Workflows Workers

Cloudflare Workflowsでは、ワークフロー実行の各ステップに対して特定のリトライロジックを設定できます。現在、step.do()の呼び出しで、どのリトライ試行が実行されているかにアクセスできるようになりました:

TypeScript

await step.do("my-step", async (ctx) => {
  // ctx.attemptは最初の試行で1、最初のリトライで2、など
  console.log(`Attempt ${ctx.attempt}`);
});

ステップコンテキストは、ワークフロー定義での改善されたログ記録と可観測性、段階的バックオフ、または条件付きロジックに使用できます。

現在の試行回数は1から始まることに注意してください。

リトライ動作の詳細については、Sleeping and Retryingを参照してください。