claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdevelopment

📤output-workflow-result

プラグイン
outputai

説明

ワークフロー実行のOutput SDK結果を取得します。 次のような場合に使用: - 完了したワークフローの出力を取得したいとき - 戻り値を確認したいとき - 非同期実行後にワークフローが生成した結果を確認したいとき

原文を表示

Get the result of an Output SDK workflow execution. Use when retrieving the output of a completed workflow, getting the return value, or checking what a workflow produced after async execution.

ユースケース

  • 完了したワークフローの出力を取得したいとき
  • 戻り値を確認したいとき
  • 非同期実行後にワークフローが生成した結果を確認したいとき

本文(日本語訳)

ワークフロー実行結果の取得

概要

このスキルは、完了したワークフロー実行の結果(戻り値)を取得します。

次のような場合に使用: npx output workflow start で開始したワークフローが完了した後、または過去の実行結果を取得したい場合。

使用するタイミング

  • 非同期で開始したワークフローの出力を取得したい場合
  • 完了済みワークフローの結果を取得したい場合
  • ワークフローが生成した内容を確認したい場合
  • スクリプト内でワークフローの出力を処理したい場合
  • 実行間で結果を比較したい場合

前提条件

  • ワークフローが完了している必要があります(ステータス: COMPLETED)
  • ワークフロー ID が必要です
  • FAILED 状態のワークフローには、代わりに npx output workflow debug を使用してください

手順

結果の取得

npx output workflow result <workflowId>

結果はワークフロー関数の戻り値で、通常は JSON 形式です。

事前のステータス確認

結果を取得する前に、ワークフローが完了していることを確認してください:

npx output workflow status <workflowId>
# Should show: COMPLETED

npx output workflow result <workflowId>

結果の見方

成功時の結果

正常に完了したワークフローは、fn 関数からの戻り値を返します:

// ワークフローのコード
export default workflow( {
  fn: async input => {
    return { processed: true, count: 42 };
  }
} );
# 結果の出力
npx output workflow result abc123
# { "processed": true, "count": 42 }

エラー時の結果

失敗したワークフローの結果を取得しようとした場合:

  • エラーメッセージが返されます
  • 何が問題だったかを確認するには、代わりに npx output workflow debug を使用してください

結果なし(void ワークフロー)

値を返さないワークフローも存在します:

npx output workflow result abc123
# null

使用例

シナリオ: 非同期スタート後に結果を取得する

# ワークフローを開始
npx output workflow start calculate '{"values": [1, 2, 3]}'
# Output: Workflow ID: calc-abc123

# 完了を待機
npx output workflow status calc-abc123
# Status: COMPLETED

# 結果を取得
npx output workflow result calc-abc123
# { "sum": 6, "average": 2 }

シナリオ: jq で結果を処理する

# 特定のフィールドを抽出
npx output workflow result abc123 | jq '.total'

# 見やすく整形して表示
npx output workflow result abc123 | jq '.'

# ファイルに保存
npx output workflow result abc123 > result.json

シナリオ: 実行間で結果を比較する

# 2 つの実行から結果を取得
npx output workflow result run-1-abc > result1.json
npx output workflow result run-2-xyz > result2.json

# 差分を確認
diff result1.json result2.json

シナリオ: スクリプト内で使用する

WORKFLOW_ID="abc123"

# 完了を待機
while [[ $(npx output workflow status $WORKFLOW_ID) == *"RUNNING"* ]]; do
  sleep 5
done

# 正常完了かどうかを確認
if [[ $(npx output workflow status $WORKFLOW_ID) == *"COMPLETED"* ]]; then
  RESULT=$(npx output workflow result $WORKFLOW_ID)
  echo "Workflow result: $RESULT"
else
  echo "Workflow did not complete successfully"
  npx output workflow debug $WORKFLOW_ID
fi

結果の型ごとの扱い方

JSON オブジェクト

npx output workflow result abc123
# { "key": "value", "nested": { "data": true } }

配列

npx output workflow result abc123
# [1, 2, 3, 4, 5]

プリミティブ値

npx output workflow result abc123
# 42

npx output workflow result abc123
# "success"

npx output workflow result abc123
# true

大きな結果

結果のサイズが大きい場合は、ファイルにリダイレクトしてください:

npx output workflow result abc123 > large-result.json

エラーへの対処

"Workflow not found"(ワークフローが見つかりません)

  • ワークフロー ID が正しいか確認してください
  • npx output workflow runs list を使用して有効な ID を確認してください

"Workflow not completed"(ワークフローが完了していません)

  • npx output workflow status <id> でステータスを確認してください
  • 結果を取得する前に COMPLETED ステータスになるまで待機してください
  • RUNNING 状態の場合は、しばらく待ってから再試行してください
  • FAILED 状態の場合は、npx output workflow debug を使用してください

"No result available"(利用可能な結果がありません)

  • ワークフローが void / undefined を返している可能性があります
  • ワークフローのコードを確認し、何を返しているか確認してください

関連コマンド

  • npx output workflow status <id> — ワークフローが完了しているか確認する
  • npx output workflow debug <id> — 失敗したワークフローをデバッグする
  • npx output workflow run <name> — ワークフローを実行し、1 ステップで結果を取得する
  • npx output workflow runs list — ワークフロー ID を検索する
原文(English)を表示

Get Workflow Execution Result

Overview

This skill retrieves the result (return value) of a completed workflow execution. Use it after a workflow started with npx output workflow start has completed, or to retrieve results from historical runs.

When to Use This Skill

  • Getting output from an asynchronously started workflow
  • Retrieving results from a completed workflow
  • Checking what a workflow produced
  • Processing workflow output in scripts
  • Comparing results between runs

Prerequisites

  • The workflow must have completed (status: COMPLETED)
  • You need the workflow ID
  • For FAILED workflows, use npx output workflow debug instead

Instructions

Get Result

npx output workflow result <workflowId>

The result is the return value of the workflow function, typically JSON.

Check Status First

Before getting results, verify the workflow completed:

npx output workflow status <workflowId>
# Should show: COMPLETED

npx output workflow result <workflowId>

Understanding Results

Success Results

A successful workflow returns the value from its fn function:

// Workflow code
export default workflow( {
  fn: async input => {
    return { processed: true, count: 42 };
  }
} );
# Result output
npx output workflow result abc123
# { "processed": true, "count": 42 }

Error Results

If you try to get the result of a failed workflow:

  • You'll get an error message
  • Use npx output workflow debug instead to see what went wrong

No Result (void workflows)

Some workflows don't return a value:

npx output workflow result abc123
# null

Examples

Scenario: Get result after async start

# Start workflow
npx output workflow start calculate '{"values": [1, 2, 3]}'
# Output: Workflow ID: calc-abc123

# Wait for completion
npx output workflow status calc-abc123
# Status: COMPLETED

# Get the result
npx output workflow result calc-abc123
# { "sum": 6, "average": 2 }

Scenario: Process result with jq

# Extract specific field
npx output workflow result abc123 | jq '.total'

# Format for display
npx output workflow result abc123 | jq '.'

# Save to file
npx output workflow result abc123 > result.json

Scenario: Compare results between runs

# Get results from two runs
npx output workflow result run-1-abc > result1.json
npx output workflow result run-2-xyz > result2.json

# Compare
diff result1.json result2.json

Scenario: Use in a script

WORKFLOW_ID="abc123"

# Wait for completion
while [[ $(npx output workflow status $WORKFLOW_ID) == *"RUNNING"* ]]; do
  sleep 5
done

# Check if completed successfully
if [[ $(npx output workflow status $WORKFLOW_ID) == *"COMPLETED"* ]]; then
  RESULT=$(npx output workflow result $WORKFLOW_ID)
  echo "Workflow result: $RESULT"
else
  echo "Workflow did not complete successfully"
  npx output workflow debug $WORKFLOW_ID
fi

Handling Different Result Types

JSON Objects

npx output workflow result abc123
# { "key": "value", "nested": { "data": true } }

Arrays

npx output workflow result abc123
# [1, 2, 3, 4, 5]

Primitive Values

npx output workflow result abc123
# 42

npx output workflow result abc123
# "success"

npx output workflow result abc123
# true

Large Results

For large results, redirect to a file:

npx output workflow result abc123 > large-result.json

Error Handling

"Workflow not found"

  • Check the workflow ID is correct
  • Use npx output workflow runs list to find valid IDs

"Workflow not completed"

  • Check status: npx output workflow status <id>
  • Wait for COMPLETED status before getting result
  • If RUNNING, wait and try again
  • If FAILED, use npx output workflow debug

"No result available"

  • The workflow may return void/undefined
  • Check the workflow code to see what it returns

Related Commands

  • npx output workflow status <id> - Check if workflow completed
  • npx output workflow debug <id> - Debug failed workflows
  • npx output workflow run <name> - Run and get result in one step
  • npx output workflow runs list - Find workflow IDs

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。