- Run several independent checks at the same time (parallel / fan-out and fan-in).
- Revisit and revise a result multiple times until it passes review (loops / cycles).
Parallel work (fan-out / fan-in)
Scenario: a customer asks, “Is something down?” The agent must search three independent sources — help docs, past support tickets, and the status page. None of these searches depends on another, so they can be executed in parallel. Running them sequentially makes the customer wait for search 1, then 2, then 3; running them concurrently means the customer only waits for the slowest search. This is the fan-out / fan-in pattern:- Fan-out: several edges leave
STARTand each edge goes to its own node. Those nodes run concurrently. - Fan-in (join): a join node waits for every branch to complete and merges the results so the workflow continues as a single flow.
answer_writer. The customer waits only as long as the slowest branch, not the sum of all branches.
When to use fan-out / fan-in:
- Independent tasks that can run concurrently (searches, diagnostics, parallel checks).
- When you want to reduce end-to-end latency by overlapping I/O-bound or independent CPU work.
Looping (cycles / back edges)
Some work requires iteration: draft → review → revise → review again. By default a workflow progresses forward without returning. To support revision you add a backward edge (a cycle). That back edge lets the flow repeat a node until the result is acceptable. Key points:- Add a router (routing function) that decides whether to continue or finish.
- Always include a termination condition (a passing review, a maximum iteration count, or both) to prevent infinite loops.
- The
routeris an ordinary Python function (a routing node). It returns a key that the runtime uses to select the downstream branch. - The loop is:
reply_writer->reviewer->router-> (done->finalizerORrevise->reviser-> reviewer). - Termination examples:
review == "reply passes", a maximum iteration counter, or an elapsed time limit.

Always include a clear termination condition for loops (for example, a passing review result, a maximum iteration limit, or a timeout) to avoid infinite revision cycles.
Agentic templates vs explicit Workflow graphs
The ADK exposes higher-level agentic shapes that make common patterns easier to express, but you can always drop down to a raw graph for full control.- Parallel helpers (e.g.,
ParallelAgent) accept a list of sub-agents and handle fan-out and the join automatically. - Loop wrappers (e.g.,
LoopAgent) run a set of agents repeatedly up to a configured iteration limit.
Workflow nodes when you need custom join behavior, nonstandard routing keys, or termination based on content rather than iteration counts.
Common workflow shapes
Best practices
- Fan-out when tasks are independent to reduce latency.
- Use a join node to collect and normalize results from parallel branches.
- Implement routers as pure functions that return deterministic routing keys.
- Always include a termination condition for loops (passing criteria, iteration limit, or timeout).
- Prefer agentic templates for standard patterns and raw graphs for custom control.
Links and references
- Google ADK Workflows (reference)
- Workflow patterns (overview)
- Designing resilient workflows (patterns and anti-patterns)
