🔍output-workflow-trace
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
Output SDK のワークフロー実行トレースを分析します。 次のような場合に使用: - 特定のワークフローをデバッグするとき - ステップの失敗を調査するとき - 入出力データを分析するとき - 実行フローを把握したいとき - 調査対象のワークフロー ID がある場合
原文を表示
Analyze Output SDK workflow execution traces. Use when debugging a specific workflow, examining step failures, analyzing input/output data, understanding execution flow, or when you have a workflow ID to investigate.
ユースケース
- ✓特定のワークフローをデバッグするとき
- ✓ステップの失敗を調査するとき
- ✓入出力データを分析するとき
- ✓実行フローを把握したいとき
本文(日本語訳)
ワークフロートレース分析
概要
このスキルは、Output CLI を使用してワークフローの実行トレースを取得・分析するためのガイダンスを提供します。
トレースには、各ステップの入力・出力・エラー・タイミング情報を含む完全な実行履歴が記録されています。
次のような場合に使用
- ワークフロー ID があり、実行内容を把握したい場合
- ワークフローが失敗し、どのステップで失敗したか特定したい場合
- 各ステップの入出力データを確認したい場合
- 実行フローとタイミングを把握したい場合
- エラーメッセージやスタックトレースを確認したい場合
- リトライ動作や予期しない結果をデバッグしたい場合
手順
ステップ 1: 実行トレースを取得する
基本トレース(テキスト形式・値が途中で切れる場合あり):
npx output workflow debug <workflowId>
完全なトレース(JSON 形式・詳細分析に推奨):
npx output workflow debug <workflowId> --json
ヒント: 完全なトレースデータが必要な場合は、常に --json を使用してください。
テキスト形式では長い値が切り捨てられるため、重要なデバッグ情報が隠れてしまう可能性があります。
ステップ 2: トレースを分析する
トレースを確認する際は、以下のチェックリストに従ってください:
- 失敗したステップを特定する: エラーステータスや失敗を示すステップを探す
- エラーメッセージを確認する: 正確なエラーメッセージとスタックトレースを見つける
- ステップの入力を確認する: 失敗したステップに渡されたデータが正しいか検証する
- ステップの出力を確認する: 直前のステップからの出力を確認する
- リトライの状況を確認する: リトライ回数とその結果に注目する
- タイミングを確認する: タイムアウトの可能性を示す異常な遅延がないか確認する
ステップ 3: Temporal UI でビジュアル分析を行う
ブラウザで http://localhost:8080 を開き、ワークフローを視覚的に確認します:
- ワークフロー ID で検索する
- イベント履歴のタイムラインを表示する
- 個々のイベントをクリックして詳細を確認する
- ステップの入出力を確認する
- リトライの状況とタイミング情報を確認する
- 必要に応じてトレースデータをエクスポートする
トレースで確認すべき項目
エラーパターン
| エラーメッセージ | 考えられる原因 |
|---|---|
"incompatible schema" |
Zod のインポート問題 — @outputai/core の代わりに zod を使用している |
"non-deterministic" |
ワークフローコード内で Math.random()・Date.now() 等を使用している |
"FatalError" + リトライのコンテキスト |
ステップ呼び出しを try-catch でラップしている |
"undefined is not a function" |
スキーマ定義が不足している |
"workflow must be deterministic" |
ワークフロー関数内で直接 I/O を実行している |
"ECONNREFUSED" またはタイムアウト |
サービスが起動していない、またはネットワーク障害 |
ステップのステータス値
- COMPLETED: ステップが正常に完了
- FAILED: ステップがエラーをスローした(リトライされる場合あり)
- RETRYING: 失敗後にステップがリトライ中
- TIMED_OUT: ステップがタイムアウト時間を超過
- CANCELLED: ステップ完了前にワークフローが停止された
トレースの主要フィールド
JSON トレースを確認する際は、以下のフィールドに注目してください:
steps[].name: ステップの識別子steps[].status: 実行結果steps[].input: ステップに渡されたデータsteps[].output: ステップから返されたデータsteps[].error: 失敗時のエラー詳細steps[].attempts: 実行試行回数steps[].duration: ステップの実行時間
使用例
シナリオ: 失敗したワークフローをデバッグする
# 実行一覧からワークフロー ID を取得する
npx output workflow runs list --limit 5 --json
# 詳細なトレースを取得する
npx output workflow debug abc123xyz --json
# 出力から失敗しているステップを探す
# 出力例:
# {
# "workflowId": "abc123xyz",
# "status": "FAILED",
# "steps": [
# { "name": "fetchData", "status": "COMPLETED", ... },
# { "name": "processData", "status": "FAILED", "error": "..." }
# ]
# }
シナリオ: リトライ動作を調査する
npx output workflow debug abc123xyz --json | jq '.steps[] | select(.attempts > 1)'
シナリオ: 特定のステップへの入力を確認する
npx output workflow debug abc123xyz --json | jq '.steps[] | select(.name == "processData") | .input'
分析後の次のステップ
- エラーを既知のパターンと照合する(エラー関連スキルを参照)
- ベストプラクティスについては
workflow-qualityサブエージェントに相談する - 特定された問題に基づいてコードを修正する
- ワークフローを再実行する:
npx output workflow run <workflowName> <input> - 新しいトレースで修正が正しく反映されているか確認する
原文(English)を表示
Workflow Trace Analysis
Overview
This skill provides guidance on retrieving and analyzing workflow execution traces using the Output CLI. Traces show the complete execution history including step inputs, outputs, errors, and timing information.
When to Use This Skill
- You have a workflow ID and need to understand what happened
- A workflow failed and you need to identify which step failed
- You need to examine the input/output data at each step
- You want to understand the execution flow and timing
- You need to find error messages and stack traces
- Debugging retry behavior or unexpected results
Instructions
Step 1: Retrieve the Execution Trace
Basic trace (text format, may be truncated):
npx output workflow debug <workflowId>
Full trace (JSON format, recommended for detailed analysis):
npx output workflow debug <workflowId> --json
Tip: Always use --json when you need complete trace data. The text format truncates long values which can hide important debugging information.
Step 2: Analyze the Trace
Follow this checklist when examining a trace:
- Identify the failed step: Look for steps with error status or failure indicators
- Examine error messages: Find the exact error message and stack trace
- Check step inputs: Verify the data passed to the failing step was correct
- Check step outputs: Look at outputs from preceding steps
- Review retry attempts: Note how many retries occurred and their outcomes
- Check timing: Look for unusual delays that might indicate timeouts
Step 3: Use the Temporal UI for Visual Analysis
Open http://localhost:8080 in your browser for a visual workflow inspection:
- Search for your workflow by ID
- View the event history timeline
- Click on individual events to see details
- Inspect step inputs and outputs
- See retry attempts and timing information
- Export trace data if needed
What to Look For in Traces
Error Patterns
| Error Message | Likely Cause |
|---|---|
| "incompatible schema" | Zod import issue - using zod instead of @outputai/core |
| "non-deterministic" | Using Math.random(), Date.now(), etc. in workflow code |
| "FatalError" with retry context | Try-catch wrapping step calls |
| "undefined is not a function" | Missing schema definitions |
| "workflow must be deterministic" | Direct I/O in workflow function |
| "ECONNREFUSED" or timeout | Services not running or network issues |
Step Status Values
- COMPLETED: Step finished successfully
- FAILED: Step threw an error (may retry)
- RETRYING: Step is being retried after a failure
- TIMED_OUT: Step exceeded its timeout
- CANCELLED: Workflow was stopped before step completed
Key Trace Fields
When examining JSON traces, focus on these fields:
steps[].name: Step identifiersteps[].status: Execution resultsteps[].input: Data passed to the stepsteps[].output: Data returned from the stepsteps[].error: Error details if failedsteps[].attempts: Number of execution attemptssteps[].duration: How long the step took
Examples
Scenario: Debug a failed workflow
# Get the workflow ID from runs list
npx output workflow runs list --limit 5 --json
# Get detailed trace
npx output workflow debug abc123xyz --json
# Look for the failing step in the output
# Example output structure:
# {
# "workflowId": "abc123xyz",
# "status": "FAILED",
# "steps": [
# { "name": "fetchData", "status": "COMPLETED", ... },
# { "name": "processData", "status": "FAILED", "error": "..." }
# ]
# }
Scenario: Investigate retry behavior
npx output workflow debug abc123xyz --json | jq '.steps[] | select(.attempts > 1)'
Scenario: Check inputs to a specific step
npx output workflow debug abc123xyz --json | jq '.steps[] | select(.name == "processData") | .input'
Next Steps After Analysis
- Match the error to common patterns (see error skills)
- Consult the
workflow-qualitysubagent for best practices - Make code fixes based on identified issues
- Re-run the workflow:
npx output workflow run <workflowName> <input> - Verify the fix with a new trace
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。