Heym runs nodes in parallel when they have no dependencies on each other, and allows multiple workflow runs to execute concurrently.
Within a Single Run
DAG-Based Scheduling
The executor groups nodes by execution level using a directed acyclic graph (DAG):
- Level 0 – Nodes with no incoming edges (start nodes)
- Level N – Nodes whose upstream dependencies are all in levels 0..N-1
Nodes in the same level have no dependencies on each other and run in parallel.
Thread Pool
- Shared pool:
ThreadPoolExecutor(max_workers=8)for node execution - Scheduling:
wait(..., return_when=FIRST_COMPLETED)– as soon as any node finishes, downstream nodes are scheduled - Thread-safe: Node outputs are stored with a lock (
store_node_output)
Orchestrator Sub-Agents
When an orchestrator agent returns multiple call_sub_agent tool calls in one turn, they run in parallel. See Agent Architecture.
Merge Node
The Merge node combines outputs from multiple parallel branches. Use it when you explicitly need to combine results; otherwise parallel branches can end in separate output nodes.
Loops
Loop iterations run sequentially. The loop body nodes are re-scheduled per iteration.
Early Return
Output nodes with allowDownstream can return early. Remaining downstream work runs in the background.
Concurrent Workflow Runs
- No per-workflow lock – Multiple requests can run the same workflow at the same time
- Async API – FastAPI endpoints use
asyncio.to_thread(execute_workflow)so the event loop stays responsive - Isolation – Each run gets its own
WorkflowExecutorinstance and state
Triggers that run workflows (Webhook, Portal, Cron, RabbitMQ, MCP, Editor) each call execute_workflow independently.
Streaming
Streaming uses the same parallel model but emits events as nodes complete. The editor and portal chat UI use streaming internally for real-time progress, and webhook users can now opt into the same event stream through the SSE Streaming execute endpoint.
Related
- Why Heym – DAG-based parallel execution vs sequential tools
- Workflow Structure – Nodes, edges, and execution flow
- Core Concepts – Execution flow overview
- Node Types – Merge node and other types
- Triggers – Entry points that trigger runs
- SSE Streaming – Event stream format for
/execute/stream