# Execute Workflow Tool

Executes a workflow run by workflow ID.

Target workflows intended for agent/tool/MCP use should set their caller-visible result with `set_workflow_output`. That value is returned as `output` when the run completes successfully. `set_workflow_output` is not a terminator or success marker; later or parallel failures still fail the workflow. Leave `base_config.failure_mode` at the default `"stop"` for required goal/effect nodes, including AI calls and uploads: the failed node's dependent branch does not run, independent branches continue, the failure appears in the results, and the workflow is marked failed. Reserve `"stop_workflow"` for rare emergencies where a failure must immediately terminate the entire workflow, including independent branches. Use `"route_to_error"` when the graph handles the failure itself: the node's other outputs carry a skip, its trailing `error` output carries `{ node_id, node_type, message, causes }`, and the run reports `completed_with_warnings`.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `workflow_id` | string | Yes | Workflow slug or ULID |
| `start_node` | string | Yes | Graph-local node ID to start execution from |
| `node_ids` | array[string] | Yes | Graph-local node IDs whose outputs and results should be returned (must contain at least 1 node ID) |
| `input` | object | No | Input payload passed to the start node |

## Returns

### Completed

```json
{
  "success": true,
  "status": "completed",
  "job_id": "01...",
  "workflow_id": "01...",
  "workflow_name": "Workflow Name",
  "workflow_slug": "workflow-slug",
  "output": { "...": "..." },
  "nodes": [
    {
      "node_id": "node-a",
      "results": [
        {
          "success": true,
          "final_status": "completed",
          "input": { "input": { "x": 1 } },
          "output": { "value": "A1" }
        }
      ]
    }
  ],
  "executed": [
    { "node_id": "node-a", "success": true }
  ]
}
```

### Failed or timed out

```json
{
  "success": false,
  "status": "failed | timeout",
  "job_id": "01...",
  "workflow_id": "workflow-slug",
  "workflow_name": "Workflow Name",
  "workflow_output": null,
  "error": "..."
}
```

## Notes

- `node_ids` must be present and non-empty.
- The workflow's persisted timeout controls both execution and this tool's wait. It must be between 1 second and 24 hours.
- `workflow_id` accepts a workflow slug or ULID.
- `job_id` is a ULID and is the run's id: a run has no id of its own. Use it when fetching persisted results.
- Workflow graph node IDs are local strings, not persisted entity IDs.
- Response includes only requested node results, not full `node_results`.
- Each result's `final_status` says how that node visit ended: `completed`, `failed`, `failed_stop_workflow`, `failed_routed`, `skipped`, `timed_out` or `cancelled`. `failed_routed` is a node in `route_to_error` that failed and sent its error to its `error` output: it has `success: true`, its `error` holds the failure, and its `output` holds the skips on its other outputs and the error value on `error`. Older runs can also show `failed_ignore`: the node failed and passed a default value on.
- For callable workflows, request the `set_workflow_output` node and treat `output` as the caller-visible result.
- Use `get_workflow_execution_results` with that `job_id` as its `execution_id` and explicit `node_ids` to inspect older runs or additional nodes.
