• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

output-workflow-start

プラグイン
outputai
ソース
GitHub で見る ↗
説明

Output SDK のワークフロー(処理の手順)を非同期(完了を待たずに)で開始します。 次のような場合に使用: - 実行時間の長いワークフローを開始する - 後で監視するためにワークフローIDを取得する - バックグラウンドでワークフローを実行する - 複数のワークフローを並行して実行する

原文を表示

Start an Output SDK workflow asynchronously without waiting for completion. Use when starting long-running workflows, getting a workflow ID for later monitoring, running workflows in the background, or executing multiple workflows in parallel.

ユースケース
  • 実行時間の長いワークフローを開始するとき
  • ワークフローIDを取得して後で監視するとき
  • バックグラウンドでワークフローを実行するとき
  • 複数のワークフローを並行実行するとき
本文(日本語訳)

ワークフローを非同期で開始する

概要

このスキルは、ワークフローを非同期(バックグラウンドで実行する方式)で開始します。コマンドはワークフローIDをすぐに返し、ワークフロー自体はバックグラウンドで実行されます。長時間かかるワークフローや、複数のワークフローを同時に実行する必要がある場合に使用します。

このスキルを使う場合

  • 実行に数分~数時間かかるワークフローを開始する
  • 複数のワークフローを同時に実行する
  • 実行を開始してから後で結果を確認する場合
  • ワークフロー実行の進捗を別途監視する
  • ワークフローIDをすぐに取得して追跡管理したい

同期実行を使う場合

npx output workflow run コマンド(同期実行)の使用を検討する場合:

  • ワークフローが数秒で完了する
  • 結果をすぐにターミナルに表示する必要がある
  • 開発中の簡単なテスト
  • 1つのコマンドで結果まで得たい

使い方

基本的な構文

npx output workflow start <workflowName> --input '<json-input>'
npx output workflow start <workflowName> --input <path-to-json-file>

ワークフローが入力データを必要とする場合、--input フラグは必須です。

入力方法

1. インラインJSON

コマンドラインにJSONを直接渡す方法:

npx output workflow start data-migration --input '{"batchSize": 1000}'

2. ファイルパス(推奨)

入力を含むJSONファイルを参照する方法:

npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json

この方法が推奨される理由:

  • 入力がバージョン管理され、再現性がある
  • 複雑な入力でも読み書きが簡単
  • シナリオを共有・再利用できる

ワークフローIDの取得

コマンド実行後に表示されるワークフローIDは、以下の用途に必要です:

  • 状態確認: npx output workflow status <id>
  • 結果取得: npx output workflow result <id>
  • デバッグ: npx output workflow debug <id>

開始と同時に進捗監視する

--monitor(-m)フラグを追加すると、開始直後に接続して、ワークフロー完了まで各ステップの更新がリアルタイムで流れます(状態をポーリングする必要がありません):

npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json --monitor

このコマンドは、開始したばかりの実行に接続します。Ctrl+Cでワークフローを止めずに監視を終了(終了コード130)でき、ワークフロー失敗時はコマンドが終了コード1で終了します。監視接続が途中で切れた場合(APIの再起動や接続リセット)、ワークフロー自体は動き続けており、コマンドは終了コード3で終了します。これにより、失敗したワークフローに基づく再実行は、すでに実行中のワークフローを二重実行しません。

監視では進捗が報告され、戻り値は報告されません。コマンド終了時に、次に実行する方法が表示されます。実行完了時は npx output workflow result <id>、失敗時は npx output workflow debug <id> を実行します。

以下のフラグはストリーム設定を調整し、--monitor が必須です:

フラグ デフォルト 説明
--interval 2500 ポーリング間隔(ミリ秒)
--include-payloads false ステップの入出力ペイロード(実データ)を含める
--color true 状態表示をカラー表示(--no-color で無効化)

--monitor は --json と組み合わせられません。--json では進捗出力を抑制して最後にJSON1個を出力するため、ストリームが静かに無視されてワークフロー終了までコマンドが応答しないように見えてしまいます。JSON形式で取得するには、npx output workflow run --json(結果待機)を使うか、--monitor なしで開始して npx output workflow monitor <id> --format json(NDJSON形式ストリーム)で接続してください。

単一ワークフローを完了まで監視する場合は、workflow status でポーリングするループより --monitor を推奨します。複数ワークフローを同時開始する場合は、--monitor はワークフロー完了まで待機するので、非同期形式のままにしてください。

例

例1: シナリオファイルで長時間実行ワークフローを開始する

npx output workflow start data-migration --input src/data_migration/scenarios/full_migration.json

# 出力:
# Started workflow: data-migration
# Workflow ID: abc123xyz
# Use 'npx output workflow status abc123xyz' to check progress

例2: 複数ワークフローを並行実行する(シナリオファイル利用)

# 異なるシナリオファイルで複数ワークフローを開始
npx output workflow start process-batch --input src/process_batch/scenarios/batch_1.json
npx output workflow start process-batch --input src/process_batch/scenarios/batch_2.json
npx output workflow start process-batch --input src/process_batch/scenarios/batch_3.json

# 注: ワークフローIDを保存して後から確認します

例3: シナリオを作成してからワークフローを開始

# シナリオファイルを作成
mkdir -p src/generate_report/scenarios
cat > src/generate_report/scenarios/annual_2024.json << 'EOF'
{
  "year": 2024,
  "includeCharts": true,
  "format": "pdf"
}
EOF

# ワークフローを開始
npx output workflow start generate-report --input src/generate_report/scenarios/annual_2024.json
# 出力: Workflow ID: report-2024-abc

# 状態を確認
npx output workflow status report-2024-abc
# 出力: Status: RUNNING

# 後でもう一度確認
npx output workflow status report-2024-abc
# 出力: Status: COMPLETED

# 結果を取得
npx output workflow result report-2024-abc

例4: 開発時の簡単なインラインテスト

npx output workflow start quick-job --input '{"test": true}'

例5: 並行実行用スクリプト

# ワークフローを開始してIDを取得
ID1=$(npx output workflow start job --input src/job/scenarios/type_a.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
ID2=$(npx output workflow start job --input src/job/scenarios/type_b.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')

# 待機して結果を確認
npx output workflow result $ID1
npx output workflow result $ID2

開始後のフォローアップ

状態確認

npx output workflow status <workflowId>

ステータス値:

  • RUNNING: 実行中
  • COMPLETED: 正常に完了
  • FAILED: エラーが発生
  • TERMINATED: 手動で停止

結果取得

npx output workflow result <workflowId>

完了したワークフローのみ使用可能です。失敗したワークフローはデバッグコマンドを使用してください。

失敗時のデバッグ

npx output workflow debug <workflowId> --json

必要に応じて停止

npx output workflow stop <workflowId>

ワークフローID管理

複数ワークフローを開始する場合、IDを追跡管理します:

# IDをファイルに記録
npx output workflow start batch-job --input src/batch_job/scenarios/id_1.json >> workflow-ids.txt
npx output workflow start batch-job --input src/batch_job/scenarios/id_2.json >> workflow-ids.txt

# または、ワークフロー内で命名規則を使用してIDを予測可能にする

ベストプラクティス

  1. シナリオファイルを使う: src/<workflow>/scenarios/ に入力を保存して再現性を確保する
  2. ワークフローIDを保存: 後で参照するため、IDを必ずメモする
  3. 長時間ワークフローを監視: npx output workflow status で進捗確認する
  4. 失敗に対応: 結果取得前に状態を確認する
  5. クリーンアップ: npx output workflow stop で止まったワークフローを停止する

関連コマンド

  • npx output workflow run <name> --input - 同期実行する
  • npx output workflow monitor <id> - 実行中のワークフローに接続する
  • npx output workflow status <id> - 実行状態を確認する
  • npx output workflow result <id> - 実行結果を取得する
  • npx output workflow stop <id> - ワークフローを停止する
  • npx output workflow debug <id> - ワークフローをデバッグする
原文(English)を表示

Start Workflow Asynchronously

Overview

This skill starts a workflow asynchronously, meaning the command returns immediately with a workflow ID while the workflow executes in the background. Use this for long-running workflows or when you need to run multiple workflows in parallel.

When to Use This Skill

  • Starting workflows that take minutes or hours
  • Running multiple workflows in parallel
  • When you need to disconnect and check results later
  • Monitoring workflow progress separately
  • When you need the workflow ID immediately for tracking

When to Use Sync Instead

Consider using npx output workflow run (sync) when:

  • Workflow completes quickly (seconds)
  • You need the result immediately in your terminal
  • Simple testing during development
  • You want a single command with the result

Instructions

Basic Syntax

npx output workflow start <workflowName> --input '<json-input>'
npx output workflow start <workflowName> --input <path-to-json-file>

The --input flag is required when the workflow expects input data.

Input Methods

1. Inline JSON

Pass JSON directly on the command line:

npx output workflow start data-migration --input '{"batchSize": 1000}'

2. File Path (Recommended)

Reference a JSON file containing the input:

npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json

This is the recommended approach because:

  • Input is version controlled and reproducible
  • Complex inputs are easier to read and edit
  • Scenarios can be shared and reused

Getting the Workflow ID

The command outputs the workflow ID which you'll need for:

  • Checking status: npx output workflow status <id>
  • Getting results: npx output workflow result <id>
  • Debugging: npx output workflow debug <id>

Start and Watch in One Command

Add --monitor (-m) to attach immediately after starting and stream step updates until the workflow ends, instead of polling workflow status:

npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json --monitor

This attaches to the exact run that was just started. Ctrl+C detaches without stopping the workflow (exit 130), and the command exits 1 if the workflow fails. If monitoring itself drops (an API restart, a reset connection), the workflow keeps running and the command exits 3 instead — so a retry keyed on a failed workflow can't re-submit one that is already in flight.

Monitoring reports progress, not the return value; the command closes by naming the follow-up — npx output workflow result <id> after a run that completed, npx output workflow debug <id> after one that failed.

These flags tune the stream and require --monitor:

Flag Default Description
--interval 2500 Poll interval in milliseconds
--include-payloads false Include decoded step input/output payloads
--color true Colorize status output (--no-color to disable)

--monitor cannot be combined with --json. Under --json the CLI suppresses progress output and prints one JSON object at the end, so the stream would be silently swallowed and the command would look hung until the workflow finished. To get JSON, either use npx output workflow run --json (wait for the result), or start without --monitor and attach with npx output workflow monitor <id> --format json (streaming NDJSON).

Prefer --monitor over a workflow status polling loop when you're watching a single workflow through to completion. Keep the plain async form when starting several workflows in parallel, since --monitor blocks until the run ends.

Examples

Scenario: Start a long-running workflow with scenario file

npx output workflow start data-migration --input src/data_migration/scenarios/full_migration.json

# Output:
# Started workflow: data-migration
# Workflow ID: abc123xyz
# Use 'npx output workflow status abc123xyz' to check progress

Scenario: Start multiple workflows in parallel using scenario files

# Start several workflows with different scenario files
npx output workflow start process-batch --input src/process_batch/scenarios/batch_1.json
npx output workflow start process-batch --input src/process_batch/scenarios/batch_2.json
npx output workflow start process-batch --input src/process_batch/scenarios/batch_3.json

# Note: Save the workflow IDs to check them later

Scenario: Create scenario then start workflow

# Create a scenario file
mkdir -p src/generate_report/scenarios
cat > src/generate_report/scenarios/annual_2024.json << 'EOF'
{
  "year": 2024,
  "includeCharts": true,
  "format": "pdf"
}
EOF

# Start the workflow
npx output workflow start generate-report --input src/generate_report/scenarios/annual_2024.json
# Output: Workflow ID: report-2024-abc

# Check status periodically
npx output workflow status report-2024-abc
# Output: Status: RUNNING

# Later, check again
npx output workflow status report-2024-abc
# Output: Status: COMPLETED

# Get the result
npx output workflow result report-2024-abc

Scenario: Quick inline test for development

npx output workflow start quick-job --input '{"test": true}'

Scenario: Script for parallel execution

# Start workflows and capture IDs
ID1=$(npx output workflow start job --input src/job/scenarios/type_a.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
ID2=$(npx output workflow start job --input src/job/scenarios/type_b.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')

# Wait and check results
npx output workflow result $ID1
npx output workflow result $ID2

Following Up After Starting

Check Status

npx output workflow status <workflowId>

Status values:

  • RUNNING: Still executing
  • COMPLETED: Finished successfully
  • FAILED: Encountered an error
  • TERMINATED: Was manually stopped

Get Result

npx output workflow result <workflowId>

Only works for COMPLETED workflows. For FAILED workflows, use debug.

Debug If Failed

npx output workflow debug <workflowId> --json

Stop If Needed

npx output workflow stop <workflowId>

Workflow ID Management

When starting multiple workflows, keep track of IDs:

# Log IDs to a file
npx output workflow start batch-job --input src/batch_job/scenarios/id_1.json >> workflow-ids.txt
npx output workflow start batch-job --input src/batch_job/scenarios/id_2.json >> workflow-ids.txt

# Or use a naming convention in your workflow that makes IDs predictable

Best Practices

  1. Use scenario files: Store inputs in src/<workflow>/scenarios/ for reproducibility
  2. Save the workflow ID: Always note the ID for later reference
  3. Monitor long workflows: Use npx output workflow status to check progress
  4. Handle failures: Check status before getting results
  5. Clean up: Stop any stuck workflows with npx output workflow stop

Related Commands

  • npx output workflow run <name> --input - Execute synchronously
  • npx output workflow monitor <id> - Attach to a run already in progress
  • npx output workflow status <id> - Check execution status
  • npx output workflow result <id> - Get execution result
  • npx output workflow stop <id> - Stop a running workflow
  • npx output workflow debug <id> - Debug a workflow execution

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