> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # Workflow\.createRun() `.createRun()` メソッドは新しい Workflow Run インスタンスを作成し、特定の入力データを使用して Workflow を実行できるようにします。これは `Run` インスタンスを返す現在の API です。 ## 使用例 ```typescript await workflow.createRun() ``` ## パラメーター **runId** (`string`): Workflow Run の任意のカスタム識別子 **resourceId** (`string`): Workflow Run を特定のリソース(ユーザー ID、テナント ID など)に関連付けるための任意の識別子。この値は Workflow Run とともに永続化され、Run のフィルタリングやクエリに使用できます。 **disableScorers** (`boolean`): この Workflow Run の Scorer を無効にする任意のフラグ ## 戻り値 **run** (`Run`): Workflow の実行に使用できる新しい Workflow Run インスタンス ## その他の使用例 ```typescript const workflow = mastra.getWorkflow('workflow') const run = await workflow.createRun() const result = await run.start({ inputData: { value: 10, }, }) ``` ## `resourceId` を使用する `resourceId` パラメーターは、Workflow Run をユーザーやテナントなどの特定のリソースに関連付けます。マルチテナントアプリケーションや、どのユーザーが Workflow を開始したかを追跡する必要がある場合に役立ちます。 ```typescript const workflow = mastra.getWorkflow('workflow') // Create a run associated with a specific user const run = await workflow.createRun({ resourceId: 'user-123', }) const result = await run.start({ inputData: { value: 10, }, }) // Later, retrieve the run and access the resourceId const storedRun = await workflow.getWorkflowRunById(run.runId) console.log(storedRun.resourceId) // "user-123" ``` ## 関連項目 - [Run クラス](https://mastra.zisheng.pro/ja/reference/workflows/run) - [Workflow の概要](https://mastra.zisheng.pro/ja/docs/workflows/overview)