WORKFLOW AGENTS · DEPENDENCIES

Agent types: choose sequential or parallel work by dependency

Compose four sub-agents as sequential, parallel or mixed workflows and see which reads find their inputs in shared state.

Computed experiment · sixty inspection seconds

Your experiment

Two fetchers are independent; summarize needs the orders result and report needs the summary and the weather. Start with everything in one parallel workflow, then try the sequential, mixed and mis-grouped shapes, and finally make both fetchers share one output key.

Play replays the computed run over sixty inspection seconds; Next event steps, Restart rewinds, and Inspection time scrubs. Any input change recomputes the run and rewinds it without autoplay.

Event trace

    Computed data

    Final metrics

    Timing and state model inspired by ADK SequentialAgent and ParallelAgent with output keys in shared session state; it runs no agents. Each sub-agent reads its inputs when it starts and writes its output when it ends; parallel branches start together, and when two branches write the same key the one that ends last wins. summarize takes 2 s and report 3 s.

    Dependencies decide the shape

    Four sub-agents share session state. orders and weather fetch data and write it under their output keys; summarize reads the orders key and writes summary; report reads summary and the weather key. A sequential workflow agent runs its children one after another, a parallel workflow agent starts them together. Each child reads its inputs when it starts, so it only sees what earlier finished children wrote.

    Everything in parallel is fast and wrong

    The opening Workflow composition runs all four in one parallel workflow. All start at 0 s, so summarize finds no orders and report finds neither a summary nor weather: three missing reads. The workflow ends after 4 s, the orders agent duration, because orders is the slowest fetcher, and produces a report built from empty inputs. Check Sub-agents fail when an input key is missing and the same run fails fast instead of producing a wrong report, which is easier to notice.

    Sequential is correct, mixed is correct and faster

    Choose Sequential: every input exists when it is read and the report is correct after 4 + 3 + 2 + 3 = 12 s. Choose the mixed shape that runs the two independent fetchers in parallel and then summarize and report in sequence: still correct, in 9 s, because the parallel stage lasts as long as its slowest branch. Set weather agent duration to 6 s and the mixed run takes 11 s. The mis-grouped shape puts summarize next to orders in parallel, so summarize reads a missing key and the report is wrong after 10 s.

    Shared output keys race

    In the mixed shape, clear Each fetcher writes its own output key so both fetchers write data. weather finishes at 3 s and orders at 4 s, so orders wins; summarize happens to get orders, but report reads data as weather and gets orders instead. Set weather to 6 s and weather wins the race, so summarize now reads weather data. In the sequential shape weather always overwrites orders. Distinct output keys remove the race.

    Reading the run and its limits

    Play, Next event, Restart, Speed and Inspection time show each sub-agent start, its inputs and the verdict across sixty seconds; the table lists start and end times and what each agent read. The model is inspired by ADK SequentialAgent and ParallelAgent with output keys, but it runs no agents and ignores model latency variance, retries, loop agents and events that real runners emit.

    Views are my own and do not represent any employer, past or present.

    Search