🔄output-workflow-reset
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
特定の完了済みステップの直後から Output SDK ワークフローを再実行し、そのステップまでの処理を再現した上で、以降のステップを新たに実行する新しいランを作成します。 次のような場合に使用: - ワークフロー全体を再実行せずに、後続ステップのプロンプトやロジックを繰り返し改善したい場合 - 正常に完了したことが確認済みのステップより後にのみ影響する障害から復旧したい場合
原文を表示
Re-run an Output SDK workflow from after a specific completed step, creating a new run that replays up to that point and re-executes subsequent steps. Use when iterating on a later step's prompt or logic without re-running the entire workflow, or when recovering from a failure that only affects steps after a known-good point.
ユースケース
- ✓後続ステップのプロンプトやロジックを改善したい
- ✓完了済みステップ後の障害から復旧したい
- ✓ワークフロー全体の再実行を避けたい
本文(日本語訳)
特定のステップからワークフローを再実行する
概要
このスキルは、ワークフローを特定の完了済みステップの直後から再実行できるようリセットします。 現在の実行は終了され、指定したステップまでのワークフローを再生(記録済みの出力を再利用)したうえで、それ以降のすべてのステップを再実行する新しい実行が作成されます。
次のような場合に使用: 後のステップのみを繰り返し改善したい場合に、LLM 呼び出しや低速な HTTP リクエストなど、コストのかかる初期ステップを再実行しなくて済みます。
このスキルをいつ使うか
- ワークフローが終盤で失敗したが、失敗前のすべてのステップは成功していた — 最初からやり直す代わりに、最後に正常完了したステップの直後から再実行する
- ステップ N 以降にしか影響しないプロンプトやステップ関数を編集した場合に、同じ上流の入力に対して変更を検証したい
- 既存の実行から分岐してデバッグしたいが、初期の LLM / API 呼び出しのコストを再度支払いたくない
- 後のステップで発生する非決定的な動作を調査しており、初期ステップの出力を固定したい
このスキルをいつ使わないか
- ワークフローがまだ実行中の場合 — 先に
npx output workflow stop <id>またはterminate <id>で停止する - 対象のステップが一度も完了していない場合 — リセットには再生の終点となる完了済みステップが必要(
409が返される) - 完全にゼロからクリーンに実行したい場合 —
npx output workflow run <name>またはworkflow start <name>を使用する - 初期ステップに再実行が必要な副作用がある場合(例: 外部システムへの書き込み)— 再生中はそれらがスキップされる
使い方
基本構文
npx output workflow reset <workflowId> --step <stepName>
npx output workflow reset <workflowId> --step <stepName> --reason "<理由>"
| フラグ | 省略形 | 必須 | 説明 |
|---|---|---|---|
--step |
-s |
はい | リセット後に再開する、完了済みステップの名前 |
--reason |
-r |
いいえ | 自由記述の理由。監査のために Temporal の履歴に記録される |
workflowId 引数は必須です。ステップ名は、トレースに表示されるステップ関数名を使用します(例: fetchArticle、consolidateCompetitors)。
ステップ名の確認方法
ステップ名はワークフローの実行トレースから取得します:
npx output workflow debug <workflowId> --json
status: "completed" のステップエントリを探し、その名前を --step に渡します。
コマンドの返り値
成功すると、CLI は元の workflowId と、リセットによって作成された新しい runId を出力します。リセット前の実行は終了されます。
Workflow reset successfully
Workflow ID: lead_enrichment-a1b2c3d4
New Run ID: 8f3e2a91-...
Reset after step: consolidateCompetitors
Reason: retrying with updated prompt
新しい実行の内容を確認するには、新しい runId をピン留めされた workflow runs list で使用してください。
workflowId は変わらないため、workflow status / workflow result はデフォルトで最新の実行を参照します。
使用例
シナリオ: 下流のプロンプト修正後に再実行する
# ワークフローが `generateBlogPost` で失敗したが、
# 直前のステップ `consolidateCompetitors` は正常完了していた。
npx output workflow debug lead_enrichment-a1b2c3d4 --json
# ... consolidateCompetitors が完了していることを確認
# src/workflows/lead_enrichment/prompts/generate_blog_post@v1.prompt を編集
# コストのかかる competitor consolidation の LLM 呼び出しをスキップして、
# 最後に正常完了したステップの直後から再実行する。
npx output workflow reset lead_enrichment-a1b2c3d4 \
--step consolidateCompetitors \
--reason "Retry with updated blog-post prompt"
シナリオ: 上流のコストを再負担せず後のステップを繰り返し改善する
# ワークフローは完了したが、ステップの出力が期待通りでない場合。最後のステップのみ再実行する。
npx output workflow reset blog_evaluator-xyz789 --step analyze_claims
# 新しい実行の結果を確認する
npx output workflow result blog_evaluator-xyz789
シナリオ: 監査用の理由を記録する
npx output workflow reset wf-12345 \
--step fetchCompanyData \
--reason "Source API returned stale data; rerunning after cache invalidation"
シナリオ: 後続処理のために新しい実行 ID を取得する
# リセット出力から新しい runId を取得し、実行を監視する
npx output workflow reset lead_enrichment-a1b2c3d4 --step lookupCompany
npx output workflow status lead_enrichment-a1b2c3d4
npx output workflow result lead_enrichment-a1b2c3d4
エラー処理
| エラー | 原因 | 対処法 |
|---|---|---|
404 ワークフローまたはステップが見つからない |
workflowId または --step 名が誤っている |
npx output workflow runs list および workflow debug <id> で確認する |
409 ステップが完了していない |
対象のステップがまだ実行中か、一度も実行されていない | ステップの完了を待つか、より前の完了済みステップを選択する |
| API が無効なレスポンスを返した | 通信障害 | docker ps | grep output および curl http://localhost:3001/health でサービスを確認する |
ベストプラクティス
- まず
workflow debugで確認する — リセット地点を選ぶ前に、どのステップが完了しているかを確認する - 出力を保持したいステップにリセットする — リセットは
<stepName>の後からすべてを再実行し、そのステップ自体は再実行されない --reasonを記録する — Temporal の履歴に表示され、チームメンバーや将来の自分が実行が分岐した理由を把握しやすくなる- コストの高いワークフローには全再実行よりリセットを優先する — 初期ステップで数ドル規模の LLM 呼び出しがある場合、リセットにより実際のコスト削減になる
- 副作用を事前に確認する — 初期ステップが外部システムに書き込む場合、再生中は再書き込みが行われない。これは通常望ましい動作だが、そうでない場合もある
関連コマンド
npx output workflow debug <id>—--stepに渡す完了済みステップ名を確認するnpx output workflow runs list— リセットによって作成された新しい実行と、終了した元の実行を一覧表示するnpx output workflow status <id>— 新しい実行のステータスを確認するnpx output workflow result <id>— 新しい実行の最終出力を取得するnpx output workflow stop <id>/workflow terminate <id>— リセット前に実行中のワークフローを停止するnpx output workflow run <name>/workflow start <name>— 再生なしでゼロからクリーンに実行する
原文(English)を表示
Rerun Workflow From a Step
Overview
This skill resets a workflow to re-run from after a specific completed step. The current run is terminated and a new run is created that replays the workflow up to the given step (reusing its recorded output), then re-executes every step after it.
Use this to avoid re-running expensive early steps (like LLM calls or slow HTTP requests) when you only need to iterate on a later step.
When to Use This Skill
- A workflow failed late, but every step before the failure succeeded — rerun from after the last known-good step instead of starting over
- You edited a prompt or step function that only affects steps after step N, and want to validate the change against the same upstream inputs
- You want to branch off an existing run for debugging without re-paying the cost of its earlier LLM/API calls
- Investigating non-determinism in a later step and want to hold earlier outputs constant
When NOT to Use This Skill
- The workflow is still running — stop it first with
npx output workflow stop <id>orterminate <id> - The target step never completed — reset requires a completed step to replay up to (returns a
409) - You actually want a clean run from scratch — use
npx output workflow run <name>orworkflow start <name> - Earlier steps had side effects you need to re-execute (e.g. writes to an external system) — the replay skips them
Instructions
Basic Syntax
npx output workflow reset <workflowId> --step <stepName>
npx output workflow reset <workflowId> --step <stepName> --reason "<why>"
| Flag | Short | Required | Description |
|---|---|---|---|
--step |
-s |
yes | Name of the completed step to reset after |
--reason |
-r |
no | Free-text reason, recorded in Temporal history for auditability |
The workflowId argument is required. The step name is the step function name as it appears in the trace (e.g. fetchArticle, consolidateCompetitors).
Finding the Step Name
Step names come from the workflow's execution trace:
npx output workflow debug <workflowId> --json
Look for step entries with status: "completed". The step name is the one you pass to --step.
What the Command Returns
On success the CLI prints the original workflowId and a new runId — the new run created by the reset. The pre-reset run is terminated.
Workflow reset successfully
Workflow ID: lead_enrichment-a1b2c3d4
New Run ID: 8f3e2a91-...
Reset after step: consolidateCompetitors
Reason: retrying with updated prompt
Use the new runId (via the pinned workflow runs list) to inspect the new execution. The workflowId is unchanged, so workflow status / workflow result will target the latest run by default.
Examples
Scenario: Rerun after fixing a downstream prompt
# The workflow failed at `generateBlogPost`, but `consolidateCompetitors`
# (the step before it) completed successfully.
npx output workflow debug lead_enrichment-a1b2c3d4 --json
# ... confirms consolidateCompetitors completed
# Edit src/workflows/lead_enrichment/prompts/generate_blog_post@v1.prompt
# Then rerun from after the last good step — skipping the expensive
# competitor consolidation LLM call.
npx output workflow reset lead_enrichment-a1b2c3d4 \
--step consolidateCompetitors \
--reason "Retry with updated blog-post prompt"
Scenario: Iterate on a late step without re-paying upstream costs
# Workflow completed, but step output is wrong. Rerun just the last step.
npx output workflow reset blog_evaluator-xyz789 --step analyze_claims
# Check the new run's result
npx output workflow result blog_evaluator-xyz789
Scenario: Record an audit reason
npx output workflow reset wf-12345 \
--step fetchCompanyData \
--reason "Source API returned stale data; rerunning after cache invalidation"
Scenario: Capture the new run ID for follow-up
# Grab the new runId from the reset output, then watch it
npx output workflow reset lead_enrichment-a1b2c3d4 --step lookupCompany
npx output workflow status lead_enrichment-a1b2c3d4
npx output workflow result lead_enrichment-a1b2c3d4
Error Handling
| Error | Cause | Solution |
|---|---|---|
404 Workflow or step not found |
Wrong workflowId or --step name |
Check with npx output workflow runs list and workflow debug <id> |
409 Step has not completed |
Target step is still running or never ran | Wait for the step to complete, or pick an earlier completed step |
| API returned invalid response | Transport failure | Check services with `docker ps |
Best Practices
- Start from
workflow debug— confirm which steps completed before picking a reset point - Reset to the step whose output you want to keep — reset runs everything after
<stepName>; the step itself is not re-executed - Record a
--reason— it shows up in Temporal history and helps teammates (and future you) understand why the run forked - Prefer reset over full rerun for expensive workflows — if early steps make multi-dollar LLM calls, reset saves real money
- Verify side effects first — if an early step writes to an external system, the replay won't re-write, which is usually what you want but occasionally isn't
Related Commands
npx output workflow debug <id>— find completed step names to pass to--stepnpx output workflow runs list— see the new run created by reset alongside the terminated originalnpx output workflow status <id>— check the new run's statusnpx output workflow result <id>— get the new run's final outputnpx output workflow stop <id>/workflow terminate <id>— stop a running workflow before resettingnpx output workflow run <name>/workflow start <name>— fresh run from scratch (no replay)
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。