The question: the shape of the work depends on the input — you can't draw the graph ahead of time. Start with runtime width: let the LLM decide how many sub-questions.
The shape (one level deep):
START ─► decompose ─► research_topic (parallel_worker) ─► synthesize
│ │ │
└──┴──┴─ (flat: no children)
An open-ended question is decomposed into N sub-questions — N is chosen at runtime (3–7) — each researched in parallel, then synthesized.
python -m L4a_flat_research.deep_research
python -m L4a_flat_research.deep_research "How should I train for my first marathon in 6 months?"
⚠️ 5–9 live LLM calls (1 decompose + 3–7 research + 1 synthesize), ~20–30s. Costs real API quota.
The decomposer prints e.g. 5 sub-questions, they research in parallel, then a synthesized briefing. The number differs every run — a fixed graph couldn't do that.
@node(parallel_worker=True)— one worker definition, fanned out across a runtime-sized list.rerun_on_resume=True— required on any node that callsctx.run_node. ADK raises aValueErrorwithout it: on resume it has to re-execute the dispatching node to rebuild the children it spawned, since those aren't in the static graph.- The decomposer's
sub_questionsschema is bounded (min_length=3, max_length=7) — that bounds the shape. retry_config=bounds the failure. A parallel worker cancels every sibling and re-raises the instant one child fails, so one transient 429 would discard the whole run — including calls you already paid for. The retry is applied to the inner per-item node, so each branch retries independently and a blip is absorbed before it can take the others down. (max_concurrencyexists on the worker but isn't reachable through the publicnode()API in 2.3.0.)
Where ADK 2 gives this a direct home: a 1.x
ParallelAgentneeds a fixed list known at build time. Here the list size is decided at runtime — you could still do it in 1.x by dropping to rawasyncio, but then the fan-out is no longer part of the workflow ADK can trace.
→ Next: L4b makes the depth runtime too — branches recursively spawn their own deeper questions.