FEATenhancementgood first issue
Repository metrics
- Stars
- (6,809 stars)
- PR merge metrics
- (PR metrics pending)
Description
Problem
GraphWorkflow currently walks the topology sequentially even when the DAG has independent branches. If the graph is A -> B, A -> C, B -> D, C -> D, today B and C execute one after the other despite having no data dependency on each other.
Proposed feature
Detect independent branches at run time and execute them concurrently using ThreadPoolExecutor. A correctness-preserving pure latency win.
Design sketch
- Topological sort groups nodes into "layers": layer N contains all nodes whose dependencies are in layer < N.
- Each layer is executed concurrently with
ThreadPoolExecutor(max_workers=len(layer)). - Per-run concurrency cap exposed as
max_parallel_nodeson the constructor (default: CPU count). - Same deep-copy isolation pattern used in the recent
AgentRearrange.batch_runrefactor to prevent shared-state bugs.
Files
swarms/structs/graph_workflow.py
Why
Pure latency improvement with no behavior change for serial graphs. DAGs with any width benefit immediately.