# FlowDrop Workflow Executor

> Execute workflows from within other workflows, enabling composition and reuse of workflow definitions.

## Overview

The `flowdrop_workflow_executor` module enables workflow composition — a node in one workflow can execute an entirely separate workflow and use its results. This supports both synchronous execution (wait for the sub-workflow to complete) and asynchronous execution (fire and forget or poll for results later).

The module provides two node processors: `WorkflowExecutor` for triggering sub-workflow execution, and `WorkflowResultsRetriever` for fetching the results of previously executed sub-workflows.

## Dependencies

- [flowdrop](flowdrop.md)
- [flowdrop_workflow](flowdrop_workflow.md) (workflow definitions)
- [flowdrop_session](flowdrop_session.md) (session context for sub-workflows)

## Tips and Tricks

### Synchronous vs Asynchronous Sub-Workflows

- **Synchronous** — The parent workflow waits for the sub-workflow to complete before continuing. Use for short sub-workflows where you need the results immediately.
- **Asynchronous** — The parent workflow continues immediately. Use the `WorkflowResultsRetriever` node later to fetch results.

### Workflow Composition Patterns

- **Reusable building blocks** — Extract common logic (e.g., data enrichment, notification sending) into separate workflows and call them from multiple parent workflows.
- **Modular design** — Break complex workflows into smaller, testable sub-workflows that can be developed and tested independently in the [playground](flowdrop_playground.md).

## Developer API

### Services

| Service ID | Class | Description |
|-----------|-------|-------------|
| `flowdrop_workflow_executor.service` | `WorkflowExecutionService` | Programmatic interface for executing workflows as sub-workflows |

### Node Processors

| Plugin | Description |
|--------|-------------|
| `WorkflowExecutor` | Executes a referenced workflow with configurable execution mode (sync/async) |
| `WorkflowResultsRetriever` | Retrieves results from a previously executed sub-workflow |

## References

- [flowdrop_workflow](flowdrop_workflow.md) — workflow definitions
- [flowdrop_session](flowdrop_session.md) — session context
- [flowdrop_runtime](flowdrop_runtime.md) — execution engine
