# Call Other Workflow

**Action ID:** `call_other_workflow`

## Description

Call another workflow.

## Input Parameters

| Name            | Type   | Required | Default | Description                                           |
| --------------- | ------ | :------: | ------- | ----------------------------------------------------- |
| workflow\_id    | string |     ✓    | -       | The unique identifier of the workflow to call         |
| workflow\_input | string |     ✓    | -       | The input data for the called workflow in JSON format |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Export Data to File node input.",
  "properties": {
    "workflow_id": {
      "description": "The ID of the workflow to call.",
      "title": "Workflow ID",
      "type": "string"
    },
    "workflow_input": {
      "description": "The input to the workflow in JSON format.",
      "title": "Workflow Input",
      "type": "string"
    }
  },
  "required": [
    "workflow_id",
    "workflow_input"
  ],
  "title": "CallOtherWorkflowNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name              | Type           | Description                                                  |
| ----------------- | -------------- | ------------------------------------------------------------ |
| workflow\_run\_id | string         | The unique identifier for the executed workflow run instance |
| workflow\_output  | object or null | The output data returned from the called workflow            |
| error             | object or null | Error information if the workflow execution failed           |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Call other workflow node output.",
  "properties": {
    "workflow_run_id": {
      "title": "Workflow Run ID",
      "type": "string"
    },
    "workflow_output": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Workflow Output"
    },
    "error": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error"
    }
  },
  "required": [
    "workflow_run_id"
  ],
  "title": "CallOtherWorkflowNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node enables workflow composition by allowing one workflow to invoke another workflow as a sub-process. You provide the target workflow's ID and the input data as JSON, and the node triggers the execution of that workflow, waits for it to complete, and returns both the workflow run ID for tracking and the output data produced by the called workflow, enabling modular and reusable workflow architectures.

## Usage Examples

### Example 1: Call Image Processing Workflow

**Input:**

```
workflow_id: "wf_image_processor_abc123"
workflow_input: {
  "image_url": "https://example.com/photo.jpg",
  "operations": ["resize", "watermark"],
  "target_width": 800
}
```

**Output:**

```
workflow_run_id: "run_xyz789def456"
workflow_output: {
  "processed_image_url": "https://storage.example.com/processed_photo.jpg",
  "dimensions": {
    "width": 800,
    "height": 600
  },
  "processing_time": 2.5
}
error: null
```

### Example 2: Call Data Validation Workflow

**Input:**

```
workflow_id: "wf_validator_def456"
workflow_input: {
  "data": {
    "email": "user@example.com",
    "phone": "+1-555-0123",
    "age": 25
  },
  "validation_rules": ["email_format", "phone_format", "age_range"]
}
```

**Output:**

```
workflow_run_id: "run_abc123xyz789"
workflow_output: {
  "is_valid": true,
  "validated_fields": ["email", "phone", "age"],
  "errors": []
}
error: null
```

### Example 3: Handle Workflow Error

**Input:**

```
workflow_id: "wf_payment_processor_ghi789"
workflow_input: {
  "amount": 99.99,
  "currency": "USD",
  "payment_method": "credit_card"
}
```

**Output:**

```
workflow_run_id: "run_error123"
workflow_output: null
error: {
  "code": "PAYMENT_FAILED",
  "message": "Payment gateway timeout",
  "details": {
    "gateway": "stripe",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}
```

## Common Use Cases

* **Modular Workflow Architecture**: Break complex workflows into smaller, reusable components that can be called independently
* **Shared Business Logic**: Centralize common processing logic (validation, formatting, enrichment) that multiple workflows need
* **Parallel Processing**: Call multiple child workflows in parallel to process different aspects of data simultaneously
* **Multi-Step Pipelines**: Chain workflows together where each workflow handles a specific stage of processing
* **Testing and Development**: Call test workflows from main workflows to validate functionality before production deployment
* **Dynamic Workflow Selection**: Choose which workflow to call based on runtime conditions or data characteristics
* **Microservices Pattern**: Treat workflows as services that can be invoked by other workflows as needed

## Error Handling

| Error Type                | Cause                                            | Solution                                                                                      |
| ------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| Workflow Not Found        | workflow\_id doesn't exist or is inaccessible    | Verify the workflow ID is correct and you have access permissions                             |
| Invalid Input Format      | workflow\_input is not valid JSON                | Ensure workflow\_input is properly formatted JSON matching the called workflow's input schema |
| Input Validation Failed   | Input doesn't match the called workflow's schema | Check the called workflow's required input parameters and provide all necessary fields        |
| Workflow Execution Failed | The called workflow encountered an error         | Check the error object for details; review the called workflow's logs                         |
| Permission Denied         | No permission to call the specified workflow     | Ensure you have execution permissions for the target workflow                                 |
| Timeout                   | Called workflow execution exceeded time limit    | Optimize the called workflow or increase timeout settings                                     |
| Circular Dependency       | Workflow calls itself directly or indirectly     | Avoid circular workflow calls; redesign workflow architecture                                 |

## Notes

* **Synchronous Execution**: This node waits for the called workflow to complete before continuing, which may affect overall workflow execution time.
* **Input Schema Matching**: Ensure the workflow\_input JSON structure matches the input schema expected by the called workflow.
* **Output Handling**: The workflow\_output structure depends on the called workflow's output schema; plan accordingly.
* **Error Propagation**: If the called workflow fails, the error object will contain details, but the calling workflow continues execution.
* **Workflow Run ID**: The workflow\_run\_id can be used to track and audit the execution of the called workflow.
* **Permissions**: You must have permission to execute the workflow you're calling; check access controls.
* **Version Considerations**: The node calls the current active version of the specified workflow; be aware of workflow updates.
* **Resource Usage**: Calling workflows consumes execution resources; consider performance and cost implications for deeply nested workflow calls.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agenticflow.ai/reference/nodes/call_other_workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
