Skip to Content

Workflow.execute()

指定されたトリガーデータでワークフローを実行し、結果を返します。ワークフローは実行前にコミットされている必要があります。

使用例

const workflow = new Workflow({ name: "my-workflow", triggerSchema: z.object({ inputValue: z.number(), }), }); workflow.step(stepOne).then(stepTwo).commit(); const result = await workflow.execute({ triggerData: { inputValue: 42 }, });

パラメーター

options?:

ExecuteOptions
ワークフロー実行のためのオプション
TriggerSchema
string

戻り値

WorkflowResult:

object
ワークフロー実行からの結果
string
Record<string, StepResult>
WorkflowStatus

追加の例

run ID を指定して実行:

const result = await workflow.execute({ runId: "custom-run-id", triggerData: { inputValue: 42 }, });

実行結果を処理する:

const { runId, results, status } = await workflow.execute({ triggerData: { inputValue: 42 }, }); if (status === "COMPLETED") { console.log("Step results:", results); }

関連