← Back to work

Graph-Engineer: DAGs of Sub-Agents

A Claude Code skill that turns a prompt into a validated graph of parallel sub-agents instead of one long serial run

Sample output

A real run of validate_graph.py against a 4-node graph — three research branches dispatched in parallel, converging on a synthesis node. The graph is valid and dispatchable, and the validator still catches something worth fixing: all three branches declare the same input document, which is exactly the “false parallelism” pattern this check exists for.

[plan]    Parallel batch 1: ['research-pgvector', 'research-pinecone', 'research-weaviate']
[warn]    FALSE PARALLELISM: nodes ['research-pgvector', 'research-pinecone', 'research-weaviate'] both consume input 'requirements-doc'. They each pay to load it and neither sees the other's slice. Consider merging them or extracting a shared upstream node.

OK: graph is a valid DAG. 1 warning(s) to consider.

Full example graph and output in the repo.

The problem

Large, multi-part tasks handed to a single agent run serially by default — even when large chunks of the work don’t actually depend on each other. That serial-by-default behavior leaves real speed on the table for any task that decomposes into independent streams.

What I built

A skill that takes an incoming prompt, decomposes it into a directed acyclic graph of sub-agents with explicit dependencies, and validates that graph before anything runs. Independent branches of the graph dispatch in parallel; dependent steps wait on their inputs. The result is a task plan that only runs serially where the work genuinely requires it.

How it works

A finding worth noting

Sub-agent dispatch doesn’t run in degraded mode on claude.ai — parallel dispatch requires the Task tool, which isn’t available there. Cost-ledger figures produced without a dispatched Task tool are projections, not measured values, which matters when comparing estimated versus actual run cost.

Stack

Claude Code, Python, graph validation via Kahn’s algorithm.